16646 Fix nvme tests after 16633
[illumos-gate.git] / usr / src / lib / libsqlite / test / bind.test
blob0f4313145e94881c8a6789685caf18d662a83f95
2 # 2003 September 6
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
21 do_test bind-1.1 {
22   db close
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]
26   set TAIL
27 } {}
28 do_test bind-1.2 {
29   sqlite_step $VM N VALUES COLNAMES
30 } {SQLITE_DONE}
31 do_test bind-1.3 {
32   execsql {SELECT rowid, * FROM t1}
33 } {1 {} {} {}}
34 do_test bind-1.4 {
35   sqlite_reset $VM
36   sqlite_bind $VM 1 {test value 1} normal
37   sqlite_step $VM N VALUES COLNAMES
38 } SQLITE_DONE
39 do_test bind-1.5 {
40   execsql {SELECT rowid, * FROM t1}
41 } {1 {} {} {} 2 {test value 1} {} {}}
42 do_test bind-1.6 {
43   sqlite_reset $VM
44   sqlite_bind $VM 3 {'test value 2'} normal
45   sqlite_step $VM N VALUES COLNAMES
46 } SQLITE_DONE
47 do_test bind-1.7 {
48   execsql {SELECT rowid, * FROM t1}
49 } {1 {} {} {} 2 {test value 1} {} {} 3 {test value 1} {} {'test value 2'}}
50 do_test bind-1.8 {
51   sqlite_reset $VM
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}
59 } {1 123 abcdefg {}}
60 do_test bind-1.9 {
61   sqlite_reset $VM
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 {}}
68 do_test bind-1.99 {
69   sqlite_finalize $VM
70 } {}
73 finish_test