Can anyone tell me why this query
SELECT printf("$ %4.2f",total) FROM tickets WHERE total > 0;
where total is type real,
works fine ($1.00) when I run it in a sqlite db manager but when I build the exact same string in B4A using stringbuilder, it fails on the same db ?
I know. I'm using a function to format the returned field before plugging it into webview.
I was just curious why it errors out while printf is a legal sqlite function.
As Manfred indicated, the printf function was introduced in version 3.8.3 of SQLite. If your version is lower, it will not work. It is not forward compatible. My device has a version of: 3.8.6. and the function works for me; see my below code:
B4X:
txt="SELECT printf('$ %4.2f',total) AS F_total FROM tickets WHERE total > 0"
Cursor1=SQL1.ExecQuery(txt)
For i=0 To Cursor1.RowCount-1
Cursor1.Position=i
Log (Cursor1.GetString("F_total") ) 'example: displays: $ 4.20 or $ 8234.00
Next