1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Update tests to work even if some features of the library are disabled. (CVS 2050)

FossilOrigin-Name: b11fc9b3f3a2711f98e7e45724aa1d30081197f3
This commit is contained in:
drh
2004-11-03 16:27:01 +00:00
parent a71aa00102
commit 6bf895708c
21 changed files with 303 additions and 213 deletions

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the sqlite_bind API.
#
# $Id: bind.test,v 1.20 2004/09/24 12:48:13 drh Exp $
# $Id: bind.test,v 1.21 2004/11/03 16:27:02 drh Exp $
#
set testdir [file dirname $argv0]
@ -96,33 +96,54 @@ do_test bind-1.99 {
sqlite3_finalize $VM
} SQLITE_OK
do_test bind-2.1 {
execsql {
DELETE FROM t1;
}
set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,${x})} -1 TAIL]
set TAIL
} {}
# Prepare the statement in different ways depending on whether or not
# the $var processing is compiled into the library.
#
ifcapable {tclvar} {
do_test bind-2.1 {
execsql {
DELETE FROM t1;
}
set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,${x})} -1 TX]
set TX
} {}
set v1 {$one}
set v2 {$::two}
set v3 {${x}}
}
ifcapable {!tclvar} {
do_test bind-2.1 {
execsql {
DELETE FROM t1;
}
set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(:one,:two,:_)} -1 TX]
set TX
} {}
set v1 {:one}
set v2 {:two}
set v3 {:_}
}
do_test bind-2.1.1 {
sqlite3_bind_parameter_count $VM
} 3
do_test bind-2.1.2 {
sqlite3_bind_parameter_name $VM 1
} {$one}
} $v1
do_test bind-2.1.3 {
sqlite3_bind_parameter_name $VM 2
} {$::two}
} $v2
do_test bind-2.1.4 {
sqlite3_bind_parameter_name $VM 3
} {${x}}
} $v3
do_test bind-2.1.5 {
sqlite3_bind_parameter_index $VM {$one}
sqlite3_bind_parameter_index $VM $v1
} 1
do_test bind-2.1.6 {
sqlite3_bind_parameter_index $VM {$::two}
sqlite3_bind_parameter_index $VM $v2
} 2
do_test bind-2.1.7 {
sqlite3_bind_parameter_index $VM {${x}}
sqlite3_bind_parameter_index $VM $v3
} 3
do_test bind-2.1.8 {
sqlite3_bind_parameter_index $VM {:hi}
@ -346,33 +367,50 @@ do_test bind-9.7 {
execsql {SELECT * FROM t2}
} {1 999 1000 1001 {} {}}
do_test bind-10.1 {
catch {sqlite3_finalize $VM}
set VM [
sqlite3_prepare $DB {
INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,$abc,:abc,$ab,$abc,:abc)
} -1 TAIL
]
sqlite3_bind_parameter_count $VM
} 3
ifcapable {tclvar} {
do_test bind-10.1 {
catch {sqlite3_finalize $VM}
set VM [
sqlite3_prepare $DB {
INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,$abc,:abc,$ab,$abc,:abc)
} -1 TAIL
]
sqlite3_bind_parameter_count $VM
} 3
set v1 {$abc}
set v2 {$ab}
}
ifcapable {!tclvar} {
do_test bind-10.1 {
catch {sqlite3_finalize $VM}
set VM [
sqlite3_prepare $DB {
INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,:xyz,:abc,:xy,:xyz,:abc)
} -1 TAIL
]
sqlite3_bind_parameter_count $VM
} 3
set v1 {:xyz}
set v2 {:xy}
}
do_test bind-10.2 {
sqlite3_bind_parameter_index $VM :abc
} 1
do_test bind-10.3 {
sqlite3_bind_parameter_index $VM {$abc}
sqlite3_bind_parameter_index $VM $v1
} 2
do_test bind-10.4 {
sqlite3_bind_parameter_index $VM {$ab}
sqlite3_bind_parameter_index $VM $v2
} 3
do_test bind-10.5 {
sqlite3_bind_parameter_name $VM 1
} :abc
do_test bind-10.6 {
sqlite3_bind_parameter_name $VM 2
} {$abc}
} $v1
do_test bind-10.7 {
sqlite3_bind_parameter_name $VM 3
} {$ab}
} $v2
do_test bind-10.8 {
sqlite3_bind_int $VM 1 1
sqlite3_bind_int $VM 2 2