Posted to tcl by greycat at Mon Jul 30 19:06:53 GMT 2018view pretty

wooledg:~$ cat foo
#!/opt/ebase/bin/tclsh
package require tdbc::sqlite3
tdbc::sqlite3::connection create db foo.sql

db allrows -- {create table foo (temp int primary key)}
foreach t {10 20 30 40 50 60 70 80 90 100} {
    db allrows -- {insert into foo(temp) values(:t)} [list t $t]
}

set sql1 {select count(*) from foo where temp > 65}
set sql2 {select count(*) from foo where temp > :t}
set d [dict create t 65]
puts [db allrows -as dicts -- $sql1 $d]
puts [db allrows -as dicts -- $sql2 $d]
puts [info patchlevel]
wooledg:~$ ./foo
{count(*) 4}
{count(*) 4}
8.6.3

Comments

Posted by CecilWesterhof at Mon Jul 30 19:41:38 GMT 2018 [text] [code]

If I do not use a type it goes also wrong, but in a different way. {count(*) 10} {count(*) 3} 8.6.6