bind.test revision 2
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A# 2003 September 6
2N/A#
2N/A# The author disclaims copyright to this source code. In place of
2N/A# a legal notice, here is a blessing:
2N/A#
2N/A# May you do good and not evil.
2N/A# May you find forgiveness for yourself and forgive others.
2N/A# May you share freely, never taking more than you give.
2N/A#
2N/A#***********************************************************************
2N/A# This file implements regression tests for SQLite library. The
2N/A# focus of this script testing the sqlite_bind API.
2N/A#
2N/A# $Id: bind.test,v 1.1 2003/09/06 22:45:21 drh Exp $
2N/A#
2N/A
2N/Aset testdir [file dirname $argv0]
2N/Asource $testdir/tester.tcl
2N/A
2N/Ado_test bind-1.1 {
2N/A db close
2N/A set DB [sqlite db test.db]
2N/A execsql {CREATE TABLE t1(a,b,c)}
2N/A set VM [sqlite_compile $DB {INSERT INTO t1 VALUES(?,?,?)} TAIL]
2N/A set TAIL
2N/A} {}
2N/Ado_test bind-1.2 {
2N/A sqlite_step $VM N VALUES COLNAMES
2N/A} {SQLITE_DONE}
2N/Ado_test bind-1.3 {
2N/A execsql {SELECT rowid, * FROM t1}
2N/A} {1 {} {} {}}
2N/Ado_test bind-1.4 {
2N/A sqlite_reset $VM
2N/A sqlite_bind $VM 1 {test value 1} normal
2N/A sqlite_step $VM N VALUES COLNAMES
2N/A} SQLITE_DONE
2N/Ado_test bind-1.5 {
2N/A execsql {SELECT rowid, * FROM t1}
2N/A} {1 {} {} {} 2 {test value 1} {} {}}
2N/Ado_test bind-1.6 {
2N/A sqlite_reset $VM
2N/A sqlite_bind $VM 3 {'test value 2'} normal
2N/A sqlite_step $VM N VALUES COLNAMES
2N/A} SQLITE_DONE
2N/Ado_test bind-1.7 {
2N/A execsql {SELECT rowid, * FROM t1}
2N/A} {1 {} {} {} 2 {test value 1} {} {} 3 {test value 1} {} {'test value 2'}}
2N/Ado_test bind-1.8 {
2N/A sqlite_reset $VM
2N/A set sqlite_static_bind_value 123
2N/A sqlite_bind $VM 1 {} static
2N/A sqlite_bind $VM 2 {abcdefg} normal
2N/A sqlite_bind $VM 3 {} null
2N/A execsql {DELETE FROM t1}
2N/A sqlite_step $VM N VALUES COLNAMES
2N/A execsql {SELECT rowid, * FROM t1}
2N/A} {1 123 abcdefg {}}
2N/Ado_test bind-1.9 {
2N/A sqlite_reset $VM
2N/A sqlite_bind $VM 1 {456} normal
2N/A sqlite_step $VM N VALUES COLNAMES
2N/A execsql {SELECT rowid, * FROM t1}
2N/A} {1 123 abcdefg {} 2 456 abcdefg {}}
2N/A
2N/A
2N/Ado_test bind-1.99 {
2N/A sqlite_finalize $VM
2N/A} {}
2N/A
2N/A
2N/Afinish_test