Posted to tcl by aspect at Sat Mar 05 01:05:54 GMT 2016view raw
- package require sqlite3
 - sqlite3 db ""
 -  
 - set n 2
 - set s 2
 - expr {$n}
 - string length $s
 -  
 - db eval {create table t (t, c text); insert into t values ('text','2'), ('numeric',2);}
 - puts [db eval {select t from t where c=$s}] ;# text numeric
 - puts [db eval {select t from t where c=$n}] ;# text numeric
 -  
 - puts [db eval {select t from t where c>$s}] ;#
 - puts [db eval {select t from t where c>$n}] ;#
 - db eval {drop table t}
 -  
 - db eval {create table t (t, c numeric); insert into t values ('text','2'), ('numeric',2);}
 - puts [db eval {select t from t where c=$s}] ;# text numeric
 - puts [db eval {select t from t where c=$n}] ;# text numeric
 -  
 - puts [db eval {select t from t where c>$s}] ;#
 - puts [db eval {select t from t where c>$n}] ;#
 - db eval {drop table t}
 -  
 - db eval {create table t (t, c); insert into t values ('text','2'), ('numeric',2);}
 - puts [db eval {select t from t where c=$s}] ;# text
 - puts [db eval {select t from t where c=$n}] ;# numeric
 -  
 - # '2' > 2
 - puts [db eval {select t from t where c>$s}] ;#
 - puts [db eval {select t from t where c>$n}] ;# text
 - db eval {drop table t}
 -  
 -