SQLite Problem

Peter Haworth pete at lcsql.com
Thu Mar 12 13:21:00 EDT 2015


Just came across an SQLite problem.

I issued the following statement in a revQueryDatabase command

SELECT Date,printf('%6.2f',Value) FROM Transactions

No errors on that.  Subsequently I use revDatabaseColumnNames to get the
column names followed by a loop using revDatabaseColumnNamed to get the
column values.  The latter returns an error indicating that printf('%6.2f'
and ,Value are invalid column names.

It appears that the comma in the printf command confuses Livecode. If I use
sqlite3 with .mode column and .headings and issue the same statement, it
uses the printf function as the column heading.

There are a couple of workarounds for this. You can change the SELECT
command to use "printf('%6.2f',Value) AS FormattedValue".  Or you can use
revDatabaseColumnNumbered to get the column values in the order they are
referenced in the SELECT statement.



More information about the use-livecode mailing list