spatialite_gui error with frintf

25 views
Skip to first unread message

Greg Krakow

unread,
Jan 24, 2023, 11:34:01 AM1/24/23
to SpatiaLite Users
Hi Sandro,

I have enjoyed using spatialite and spatialite_gui almost daily for many years.

I use the following Windows software:

Edition    Windows 10 Enterprise
Version    21H2
OS build    19044.2364
Experience    Windows Feature Experience Pack 120.2212.4190.0

I am currently using spatialite_gui version  2.1.0-beta1 windows binary. When I run the following sql: SELECT printf("%.1f", 3.14159265358979323846);
in the command window I get the following error:
SQL error no such column: %.1f

I get the same error when running the query from spatialite version  5.0.1  from the Windows command line, CMD.

I get a valid response of 3.1 when running the query from sqlite3 version 3.37.2 from CMD.

Is there a newer binary available? Should I use the round function and then cast to string to get the same results?

Thanks,
Greg Krakow

a.fu...@lqt.it

unread,
Jan 24, 2023, 12:02:40 PM1/24/23
to spatiali...@googlegroups.com
Hi Greg,

your SQL syntax is simply dirty.

short recall:
- double quotes (") are for delimiting table or column names
- text constants require instead to be delimited by single quotes (')

you are simply required to rewrite your query the clean way:

SELECT printf('%.1f', 3.14159265358979323846);


> I get a valid response of 3.1 when running the query from sqlite3
> version 3.37.2 from CMD.
>

earlier versions of SQLite where unable to distinguish between
single and double quotes, but recent versions have finally
corrected this embarrassing defect.

however the more stringent check depends on a specific
compile-time option, so it could well be that sqlite
tools of different distributions behave differently.

respecting the syntax rules about single and double quoting
is the most effective way to avoid unexpacted surprises.

bye Sandro

Reply all
Reply to author
Forward
0 new messages