01-07-2009, 08:36 AM
Macro
out
#compile CSqlite
str dbfile="$desktop$\test.db3"
str sql
;create database for testing
CSqlite db1.Open(dbfile)
db1.Exec("DROP TABLE table1")
db1.Exec("CREATE TABLE table1 (A,B)")
db1.Exec("INSERT INTO table1 VALUES ('one','two')")
db1.Exec("INSERT INTO table1 VALUES ('three','four')")
db1.Exec("INSERT INTO table1 VALUES ('te','five')")
;search
CSqlite db2.Open(dbfile)
ARRAY(str) ar; int r c
db2.Exec("SELECT * FROM table1 WHERE A LIKE 't%e'" ar) ;;in SQL, % is used instead of * (0 or more characters), _ instead of ? (single character)
for r 0 ar.len(2)
,out "row %i" r+1
,for c 0 ar.len(1)
,,out ar[c r]