2 #pragma ident "%Z%%M% %I% %E% SMI"
6 # The author disclaims copyright to this source code. In place of
7 # a legal notice, here is a blessing:
9 # May you do good and not evil.
10 # May you find forgiveness for yourself and forgive others.
11 # May you share freely, never taking more than you give.
13 #***********************************************************************
14 # This file implements regression tests for SQLite library. The
15 # focus of this script testing the sqlite_bind API.
17 # $Id: bind.test,v 1.1 2003/09/06 22:45:21 drh Exp $
20 set testdir [file dirname $argv0]
21 source $testdir/tester.tcl
25 set DB [sqlite db test.db]
26 execsql {CREATE TABLE t1(a,b,c)}
27 set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(?,?,?)} TAIL]
31 sqlite_step $VM N VALUES COLNAMES
34 execsql {SELECT rowid, * FROM t1}
38 sqlite_bind $VM 1 {test value 1} normal
39 sqlite_step $VM N VALUES COLNAMES
42 execsql {SELECT rowid, * FROM t1}
43 } {1 {} {} {} 2 {test value 1} {} {}}
46 sqlite_bind $VM 3 {'test value 2'} normal
47 sqlite_step $VM N VALUES COLNAMES
50 execsql {SELECT rowid, * FROM t1}
51 } {1 {} {} {} 2 {test value 1} {} {} 3 {test value 1} {} {'test value 2'}}
54 set sqlite_static_bind_value 123
55 sqlite_bind $VM 1 {} static
56 sqlite_bind $VM 2 {abcdefg} normal
57 sqlite_bind $VM 3 {} null
58 execsql {DELETE FROM t1}
59 sqlite_step $VM N VALUES COLNAMES
60 execsql {SELECT rowid, * FROM t1}
64 sqlite_bind $VM 1 {456} normal
65 sqlite_step $VM N VALUES COLNAMES
66 execsql {SELECT rowid, * FROM t1}
67 } {1 123 abcdefg {} 2 456 abcdefg {}}