There's a several-year-old discussion of this issue here: http://wiki.tcl.tk/19627
It looks like 'impedance mis-match' is an appropriate term for this and that the tcl/sqlite type relationship is problematic, due to the typelessness of tcl and the omission in the api of a way to indicate the type of the substitution. I'm going to use something other than tcl for what I'm doing. On Sun, Jan 26, 2014 at 10:37 AM, Donald Allen <donaldcal...@gmail.com> wrote: > This script > > #!/usr/bin/env tclsh > > package require sqlite3 > > set x 1 > > sqlite3 db /tmp/foo > > db eval {select (2 > :x) as foo} { > puts "foo was $foo" > } > > run on an up-to-date Arch Linux system produces > > foo was 0 > > obviously incorrect. There seems to be an issue with variable > substitution here. Changing the line in question to > > db eval {select (2 > 1) as foo} { > > and re-running produces > > foo was 1 > > obviously correct. > > The sqlite documentation on the tcl api says that variable > substitution can occur "in any position where it is legal to put a > string or number literal". There is no information in the > documentation about how to control this, so the api has to be deciding > for itself whether a string or numeric literal is appropriate and I > think it is getting it wrong here. > > db eval {select (2 > cast (:x as integer)) as foo} { > > works correctly. > > db eval {select (2 > '1') as foo} { > > produces > > foo was 0 > > Looks like a bug to me, but perhaps I'm missing something. Comments? > > /Don Allen _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users