4 # The author disclaims copyright to this source code. In place of
5 # a legal notice, here is a blessing:
7 # May you do good and not evil.
8 # May you find forgiveness for yourself and forgive others.
9 # May you share freely, never taking more than you give.
11 #***********************************************************************
12 # This file implements regression tests for SQLite library. The
13 # focus of this script testing the sqlite_bind API.
15 # $Id: bind.test,v 1.1 2003/09/06 22:45:21 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
23 set DB [sqlite db test.db]
24 execsql {CREATE TABLE t1(a,b,c)}
25 set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(?,?,?)} TAIL]
29 sqlite_step $VM N VALUES COLNAMES
32 execsql {SELECT rowid, * FROM t1}
36 sqlite_bind $VM 1 {test value 1} normal
37 sqlite_step $VM N VALUES COLNAMES
40 execsql {SELECT rowid, * FROM t1}
41 } {1 {} {} {} 2 {test value 1} {} {}}
44 sqlite_bind $VM 3 {'test value 2'} normal
45 sqlite_step $VM N VALUES COLNAMES
48 execsql {SELECT rowid, * FROM t1}
49 } {1 {} {} {} 2 {test value 1} {} {} 3 {test value 1} {} {'test value 2'}}
52 set sqlite_static_bind_value 123
53 sqlite_bind $VM 1 {} static
54 sqlite_bind $VM 2 {abcdefg} normal
55 sqlite_bind $VM 3 {} null
56 execsql {DELETE FROM t1}
57 sqlite_step $VM N VALUES COLNAMES
58 execsql {SELECT rowid, * FROM t1}
62 sqlite_bind $VM 1 {456} normal
63 sqlite_step $VM N VALUES COLNAMES
64 execsql {SELECT rowid, * FROM t1}
65 } {1 123 abcdefg {} 2 456 abcdefg {}}