mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Further work on the new API. All the functions to execute queries are there
now. (CVS 1427) FossilOrigin-Name: fc94575d77f9865e1553bb70c2e3eda2a0b8669e
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
# focus of this script is testing the ATTACH and DETACH commands
|
||||
# and related functionality.
|
||||
#
|
||||
# $Id: attach2.test,v 1.8 2004/05/21 01:47:27 danielk1977 Exp $
|
||||
# $Id: attach2.test,v 1.9 2004/05/21 10:08:55 danielk1977 Exp $
|
||||
#
|
||||
|
||||
|
||||
@ -126,13 +126,13 @@ do_test attach2-3.1 {
|
||||
set DB [sqlite db test.db]
|
||||
set rc [catch {sqlite3_prepare $DB "ATTACH 'test2.db' AS t2" -1 TAIL} VM]
|
||||
if {$rc} {lappend rc $VM}
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
set rc
|
||||
} {0}
|
||||
do_test attach2-3.2 {
|
||||
set rc [catch {sqlite3_prepare $DB "DETACH t2" -1 TAIL} VM]
|
||||
if {$rc} {lappend rc $VM}
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
set rc
|
||||
} {0}
|
||||
|
||||
|
@ -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.5 2004/05/21 02:11:41 danielk1977 Exp $
|
||||
# $Id: bind.test,v 1.6 2004/05/21 10:08:55 danielk1977 Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -31,7 +31,7 @@ do_test bind-1.3 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 {} {} {}}
|
||||
do_test bind-1.4 {
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
sqlite_bind $VM 1 {test value 1} normal
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
} SQLITE_DONE
|
||||
@ -39,7 +39,7 @@ do_test bind-1.5 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 {} {} {} 2 {test value 1} {} {}}
|
||||
do_test bind-1.6 {
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
sqlite_bind $VM 3 {'test value 2'} normal
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
} SQLITE_DONE
|
||||
@ -47,7 +47,7 @@ do_test bind-1.7 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 {} {} {} 2 {test value 1} {} {} 3 {test value 1} {} {'test value 2'}}
|
||||
do_test bind-1.8 {
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
set sqlite_static_bind_value 123
|
||||
sqlite_bind $VM 1 {} static
|
||||
sqlite_bind $VM 2 {abcdefg} normal
|
||||
@ -57,14 +57,14 @@ do_test bind-1.8 {
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 123 abcdefg {}}
|
||||
do_test bind-1.9 {
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
sqlite_bind $VM 1 {456} normal
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 123 abcdefg {} 2 456 abcdefg {}}
|
||||
|
||||
do_test bind-1.99 {
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
} {}
|
||||
|
||||
do_test bind-2.1 {
|
||||
@ -81,14 +81,14 @@ do_test bind-2.2 {
|
||||
sqlite3_bind_int32 $VM 2 456
|
||||
sqlite3_bind_int32 $VM 3 789
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 123 456 789}
|
||||
do_test bind-2.3 {
|
||||
sqlite3_bind_int32 $VM 2 -2000000000
|
||||
sqlite3_bind_int32 $VM 3 2000000000
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 123 456 789 2 123 -2000000000 2000000000}
|
||||
do_test bind-2.4 {
|
||||
@ -106,7 +106,7 @@ do_test bind-3.1 {
|
||||
sqlite3_bind_int64 $VM 2 -2000000000000
|
||||
sqlite3_bind_int64 $VM 3 2000000000000
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 32 -2000000000000 2000000000000}
|
||||
do_test bind-3.2 {
|
||||
@ -124,7 +124,7 @@ do_test bind-4.1 {
|
||||
sqlite3_bind_double $VM 2 0.00001
|
||||
sqlite3_bind_double $VM 3 123456789
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 1234.1234 1e-05 123456789}
|
||||
do_test bind-4.2 {
|
||||
@ -142,7 +142,7 @@ do_test bind-5.1 {
|
||||
sqlite3_bind_null $VM 2
|
||||
sqlite3_bind_null $VM 3
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 {} {} {}}
|
||||
do_test bind-5.2 {
|
||||
@ -160,7 +160,7 @@ do_test bind-6.1 {
|
||||
sqlite3_bind_text $VM 2 "." 2
|
||||
sqlite3_bind_text $VM 3 world -1
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 hello . world}
|
||||
do_test bind-6.2 {
|
||||
@ -178,7 +178,7 @@ do_test bind-7.1 {
|
||||
sqlite3_bind_text16 $VM 2 [encoding convertto unicode ""] 0
|
||||
sqlite3_bind_text16 $VM 3 [encoding convertto unicode world] 10
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
sqlite_reset $VM
|
||||
sqlite3_reset $VM
|
||||
execsql {SELECT rowid, * FROM t1}
|
||||
} {1 hello {} world}
|
||||
do_test bind-7.2 {
|
||||
@ -216,7 +216,7 @@ do_test bind-8.7 {
|
||||
|
||||
|
||||
do_test bind-9.99 {
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
} {}
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script testing the callback-free C/C++ API.
|
||||
#
|
||||
# $Id: capi2.test,v 1.11 2004/05/21 01:47:27 danielk1977 Exp $
|
||||
# $Id: capi2.test,v 1.12 2004/05/21 10:08:55 danielk1977 Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -57,7 +57,7 @@ do_test capi2-1.9 {
|
||||
list $N $VALUES $COLNAMES
|
||||
} {0 {} {}}
|
||||
do_test capi2-1.10 {
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
} {}
|
||||
|
||||
# Check to make sure that the "tail" of a multi-statement SQL script
|
||||
@ -84,7 +84,7 @@ do_test capi2-2.3 {
|
||||
lappend r $n $val $colname
|
||||
} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
|
||||
do_test capi2-2.4 {
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
} {}
|
||||
do_test capi2-2.5 {
|
||||
set VM [sqlite3_prepare $DB $SQL -1 SQL]
|
||||
@ -97,7 +97,7 @@ do_test capi2-2.6 {
|
||||
lappend r $n $val $colname
|
||||
} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
|
||||
do_test capi2-2.7 {
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
} {}
|
||||
do_test capi2-2.8 {
|
||||
set VM [sqlite3_prepare $DB $SQL -1 SQL]
|
||||
@ -149,7 +149,7 @@ do_test capi2-3.7 {
|
||||
list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
} {SQLITE_ROW 1 {{}} {5/0 NUMERIC}}
|
||||
do_test capi2-3.8 {
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
} {}
|
||||
do_test capi2-3.9 {
|
||||
execsql {CREATE UNIQUE INDEX i1 ON t1(a)}
|
||||
@ -165,11 +165,11 @@ do_test capi2-3.10 {
|
||||
} {SQLITE_DONE 0 {} {}}
|
||||
do_test capi2-3.10b {db changes} {1}
|
||||
do_test capi2-3.11 {
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
} {}
|
||||
do_test capi2-3.11b {db changes} {1}
|
||||
do_test capi2-3.12 {
|
||||
list [catch {sqlite_finalize $VM} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM} msg] [set msg]
|
||||
} {1 {(21) library routine called out of sequence}}
|
||||
do_test capi2-3.13 {
|
||||
set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(1,3,4)} -1 TAIL]
|
||||
@ -177,7 +177,7 @@ do_test capi2-3.13 {
|
||||
} {SQLITE_ERROR 0 {} {}}
|
||||
do_test capi2-3.13b {db changes} {0}
|
||||
do_test capi2-3.14 {
|
||||
list [catch {sqlite_finalize $VM} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM} msg] [set msg]
|
||||
} {1 {(19) column a is not unique}}
|
||||
do_test capi2-3.15 {
|
||||
set VM [sqlite3_prepare $DB {CREATE TABLE t2(a NOT NULL, b)} -1 TAIL]
|
||||
@ -187,14 +187,14 @@ do_test capi2-3.16 {
|
||||
list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
} {SQLITE_DONE 0 {} {}}
|
||||
do_test capi2-3.17 {
|
||||
list [catch {sqlite_finalize $VM} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM} msg] [set msg]
|
||||
} {0 {}}
|
||||
do_test capi2-3.18 {
|
||||
set VM [sqlite3_prepare $DB {INSERT INTO t2 VALUES(NULL,2)} -1 TAIL]
|
||||
list [sqlite_step $VM N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
} {SQLITE_ERROR 0 {} {}}
|
||||
do_test capi2-3.19 {
|
||||
list [catch {sqlite_finalize $VM} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM} msg] [set msg]
|
||||
} {1 {(19) t2.a may not be NULL}}
|
||||
|
||||
# Two or more virtual machines exists at the same time.
|
||||
@ -218,7 +218,7 @@ do_test capi2-4.5 {
|
||||
execsql {SELECT * FROM t2 ORDER BY a}
|
||||
} {2 3}
|
||||
do_test capi2-4.6 {
|
||||
list [catch {sqlite_finalize $VM2} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM2} msg] [set msg]
|
||||
} {0 {}}
|
||||
do_test capi2-4.7 {
|
||||
list [sqlite_step $VM3 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
@ -227,7 +227,7 @@ do_test capi2-4.8 {
|
||||
execsql {SELECT * FROM t2 ORDER BY a}
|
||||
} {2 3 3 4}
|
||||
do_test capi2-4.9 {
|
||||
list [catch {sqlite_finalize $VM3} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM3} msg] [set msg]
|
||||
} {0 {}}
|
||||
do_test capi2-4.10 {
|
||||
list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
@ -236,7 +236,7 @@ do_test capi2-4.11 {
|
||||
execsql {SELECT * FROM t2 ORDER BY a}
|
||||
} {1 2 2 3 3 4}
|
||||
do_test capi2-4.12 {
|
||||
list [catch {sqlite_finalize $VM1} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM1} msg] [set msg]
|
||||
} {0 {}}
|
||||
|
||||
# Interleaved SELECTs
|
||||
@ -266,13 +266,13 @@ do_test capi2-5.7 {
|
||||
list [sqlite_step $VM3 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
} {SQLITE_DONE 2 {} {a b {} {}}}
|
||||
do_test capi2-5.8 {
|
||||
list [catch {sqlite_finalize $VM3} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM3} msg] [set msg]
|
||||
} {0 {}}
|
||||
do_test capi2-5.9 {
|
||||
list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
} {SQLITE_ROW 2 {1 2} {a b {} {}}}
|
||||
do_test capi2-5.10 {
|
||||
list [catch {sqlite_finalize $VM1} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM1} msg] [set msg]
|
||||
} {0 {}}
|
||||
do_test capi2-5.11 {
|
||||
list [sqlite_step $VM2 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
@ -281,7 +281,7 @@ do_test capi2-5.12 {
|
||||
list [sqlite_step $VM2 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
} {SQLITE_ROW 2 {1 2} {a b {} {}}}
|
||||
do_test capi2-5.11 {
|
||||
list [catch {sqlite_finalize $VM2} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM2} msg] [set msg]
|
||||
} {0 {}}
|
||||
|
||||
# Check for proper SQLITE_BUSY returns.
|
||||
@ -341,7 +341,7 @@ do_test capi2-6.13 {
|
||||
do_test capi2-6.14 {
|
||||
list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
} {SQLITE_ROW 1 6 {x counter}}
|
||||
# puts [list [catch {sqlite_finalize $VM1} msg] [set msg]]; exit
|
||||
# puts [list [catch {sqlite3_finalize $VM1} msg] [set msg]]; exit
|
||||
do_test capi2-6.15 {
|
||||
execsql {SELECT * FROM t1}
|
||||
} {1 2 3}
|
||||
@ -391,7 +391,7 @@ do_test capi2-6.28 {
|
||||
list [sqlite_step $VM1 N VALUE COLNAME] [set N] [set VALUE] [set COLNAME]
|
||||
} {SQLITE_ROW 1 13 {x counter}}
|
||||
do_test capi2-6.99 {
|
||||
list [catch {sqlite_finalize $VM1} msg] [set msg]
|
||||
list [catch {sqlite3_finalize $VM1} msg] [set msg]
|
||||
} {0 {}}
|
||||
catchsql {ROLLBACK}
|
||||
|
||||
@ -458,7 +458,7 @@ do_test capi2-7.12 {
|
||||
#
|
||||
do_test capi2-8.1 {
|
||||
set VM1 [sqlite3_prepare $DB {SELECT * FROM t2} -1 TAIL]
|
||||
sqlite_finalize $VM1
|
||||
sqlite3_finalize $VM1
|
||||
} {}
|
||||
|
||||
# Tickets #384 and #385 - make sure the TAIL argument to sqlite3_prepare
|
||||
@ -467,7 +467,7 @@ do_test capi2-8.1 {
|
||||
do_test capi2-9.1 {
|
||||
set VM1 [sqlite3_prepare $DB {SELECT * FROM t2} -1 DUMMY]
|
||||
sqlite_step $VM1
|
||||
sqlite_finalize $VM1
|
||||
sqlite3_finalize $VM1
|
||||
} {}
|
||||
|
||||
db2 close
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script testing the callback-free C/C++ API.
|
||||
#
|
||||
# $Id: capi3.test,v 1.2 2004/05/21 01:47:27 danielk1977 Exp $
|
||||
# $Id: capi3.test,v 1.3 2004/05/21 10:08:55 danielk1977 Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -54,7 +54,7 @@ set DB [sqlite db test.db]
|
||||
|
||||
do_test capi3-1.1 {
|
||||
set STMT [sqlite3_prepare $DB {SELECT name FROM sqlite_master} -1 TAIL]
|
||||
sqlite_finalize $STMT
|
||||
sqlite3_finalize $STMT
|
||||
set TAIL
|
||||
} {}
|
||||
do_test capi3-1.2 {
|
||||
@ -66,7 +66,7 @@ do_test capi3-1.3 {
|
||||
do_test capi3-1.4 {
|
||||
set sql {SELECT name FROM sqlite_master;SELECT 10}
|
||||
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
|
||||
sqlite_finalize $STMT
|
||||
sqlite3_finalize $STMT
|
||||
set TAIL
|
||||
} {SELECT 10}
|
||||
do_test capi3-1.5 {
|
||||
@ -85,13 +85,13 @@ do_test capi3-1.7 {
|
||||
do_test capi3-2.1 {
|
||||
set sql16 [utf16 {SELECT name FROM sqlite_master}]
|
||||
set STMT [sqlite3_prepare16 $DB $sql16 -1 ::TAIL]
|
||||
sqlite_finalize $STMT
|
||||
sqlite3_finalize $STMT
|
||||
utf8 $::TAIL
|
||||
} {}
|
||||
do_test capi3-2.2 {
|
||||
set sql [utf16 {SELECT name FROM sqlite_master;SELECT 10}]
|
||||
set STMT [sqlite3_prepare16 $DB $sql -1 TAIL]
|
||||
sqlite_finalize $STMT
|
||||
sqlite3_finalize $STMT
|
||||
utf8 $TAIL
|
||||
} {SELECT 10}
|
||||
do_test capi3-2.3 {
|
||||
@ -155,6 +155,8 @@ do_test capi3-4.4 {
|
||||
sqlite3_close $db2
|
||||
} {}
|
||||
|
||||
db close
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements some common TCL routines used for regression
|
||||
# testing the SQLite library
|
||||
#
|
||||
# $Id: tester.tcl,v 1.34 2004/05/21 01:47:27 danielk1977 Exp $
|
||||
# $Id: tester.tcl,v 1.35 2004/05/21 10:08:55 danielk1977 Exp $
|
||||
|
||||
# Make sure tclsqlite was compiled correctly. Abort now with an
|
||||
# error message if not.
|
||||
@ -205,7 +205,7 @@ proc stepsql {dbptr sql} {
|
||||
while {[sqlite_step $vm N VAL COL]=="SQLITE_ROW"} {
|
||||
foreach v $VAL {lappend r $v}
|
||||
}
|
||||
if {[catch {sqlite_finalize $vm} errmsg]} {
|
||||
if {[catch {sqlite3_finalize $vm} errmsg]} {
|
||||
return [list 1 $errmsg]
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the VACUUM statement.
|
||||
#
|
||||
# $Id: vacuum.test,v 1.16 2004/05/21 01:47:27 danielk1977 Exp $
|
||||
# $Id: vacuum.test,v 1.17 2004/05/21 10:08:55 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -139,7 +139,7 @@ do_test vacuum-4.1 {
|
||||
sqlite_step $VM N VALUES COLNAMES
|
||||
} {SQLITE_DONE}
|
||||
do_test vacuum-4.2 {
|
||||
sqlite_finalize $VM
|
||||
sqlite3_finalize $VM
|
||||
} {}
|
||||
|
||||
# Ticket #515. VACUUM after deleting and recreating the table that
|
||||
|
Reference in New Issue
Block a user