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

  1. wooledg:~$ cat foo
  2. #!/opt/ebase/bin/tclsh
  3. package require tdbc::sqlite3
  4. tdbc::sqlite3::connection create db foo.sql
  5.  
  6. db allrows -- {create table foo (temp int primary key)}
  7. foreach t {10 20 30 40 50 60 70 80 90 100} {
  8. db allrows -- {insert into foo(temp) values(:t)} [list t $t]
  9. }
  10.  
  11. set sql1 {select count(*) from foo where temp > 65}
  12. set sql2 {select count(*) from foo where temp > :t}
  13. set d [dict create t 65]
  14. puts [db allrows -as dicts -- $sql1 $d]
  15. puts [db allrows -as dicts -- $sql2 $d]
  16. puts [info patchlevel]
  17. wooledg:~$ ./foo
  18. {count(*) 4}
  19. {count(*) 4}
  20. 8.6.3
  21.  

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