2004-05-20 15:00:52 +04:00
|
|
|
# 2003 January 29
|
|
|
|
#
|
|
|
|
# The author disclaims copyright to this source code. In place of
|
|
|
|
# a legal notice, here is a blessing:
|
|
|
|
#
|
|
|
|
# May you do good and not evil.
|
|
|
|
# May you find forgiveness for yourself and forgive others.
|
|
|
|
# May you share freely, never taking more than you give.
|
|
|
|
#
|
|
|
|
#***********************************************************************
|
|
|
|
# This file implements regression tests for SQLite library. The
|
|
|
|
# focus of this script testing the callback-free C/C++ API.
|
|
|
|
#
|
2004-06-19 07:33:57 +04:00
|
|
|
# $Id: capi3.test,v 1.12 2004/06/19 03:33:57 danielk1977 Exp $
|
2004-05-20 15:00:52 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
|
|
source $testdir/tester.tcl
|
|
|
|
|
|
|
|
# Return the UTF-16 representation of the supplied UTF-8 string $str.
|
|
|
|
# If $nt is true, append two 0x00 bytes as a nul terminator.
|
|
|
|
proc utf16 {str {nt 1}} {
|
|
|
|
set r [encoding convertto unicode $str]
|
|
|
|
if {$nt} {
|
|
|
|
append r "\x00\x00"
|
|
|
|
}
|
|
|
|
return $r
|
|
|
|
}
|
|
|
|
|
|
|
|
# Return the UTF-8 representation of the supplied UTF-16 string $str.
|
|
|
|
proc utf8 {str} {
|
|
|
|
# If $str ends in two 0x00 0x00 bytes, knock these off before
|
|
|
|
# converting to UTF-8 using TCL.
|
|
|
|
binary scan $str \c* vals
|
|
|
|
if {[lindex $vals end]==0 && [lindex $vals end-1]==0} {
|
|
|
|
set str [binary format \c* [lrange $vals 0 end-2]]
|
|
|
|
}
|
|
|
|
|
|
|
|
set r [encoding convertfrom unicode $str]
|
|
|
|
return $r
|
|
|
|
}
|
|
|
|
|
|
|
|
# These tests complement those in capi2.test. They are organized
|
|
|
|
# as follows:
|
|
|
|
#
|
|
|
|
# capi3-1.*: Test sqlite3_prepare
|
|
|
|
# capi3-2.*: Test sqlite3_prepare16
|
2004-05-21 05:47:26 +04:00
|
|
|
# capi3-3.*: Test sqlite3_open
|
|
|
|
# capi3-4.*: Test sqlite3_open16
|
2004-05-26 14:11:05 +04:00
|
|
|
# capi3-5.*: Test the various sqlite3_result_* APIs
|
2004-06-19 07:33:57 +04:00
|
|
|
# capi3-6.*: Test that sqlite3_close fails if there are outstanding VMs.
|
2004-05-20 15:00:52 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
db close
|
2004-06-19 04:16:31 +04:00
|
|
|
set DB [sqlite3 db test.db]
|
2004-05-20 15:00:52 +04:00
|
|
|
|
|
|
|
do_test capi3-1.1 {
|
|
|
|
set STMT [sqlite3_prepare $DB {SELECT name FROM sqlite_master} -1 TAIL]
|
2004-05-21 14:08:53 +04:00
|
|
|
sqlite3_finalize $STMT
|
2004-05-20 15:00:52 +04:00
|
|
|
set TAIL
|
|
|
|
} {}
|
|
|
|
do_test capi3-1.2 {
|
|
|
|
sqlite3_errcode $DB
|
|
|
|
} {SQLITE_OK}
|
|
|
|
do_test capi3-1.3 {
|
|
|
|
sqlite3_errmsg $DB
|
|
|
|
} {not an error}
|
|
|
|
do_test capi3-1.4 {
|
|
|
|
set sql {SELECT name FROM sqlite_master;SELECT 10}
|
|
|
|
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
|
2004-05-21 14:08:53 +04:00
|
|
|
sqlite3_finalize $STMT
|
2004-05-20 15:00:52 +04:00
|
|
|
set TAIL
|
|
|
|
} {SELECT 10}
|
|
|
|
do_test capi3-1.5 {
|
|
|
|
set sql {SELECT namex FROM sqlite_master}
|
|
|
|
catch {
|
|
|
|
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
|
|
|
|
}
|
|
|
|
} {1}
|
|
|
|
do_test capi3-1.6 {
|
|
|
|
sqlite3_errcode $DB
|
|
|
|
} {SQLITE_ERROR}
|
|
|
|
do_test capi3-1.7 {
|
|
|
|
sqlite3_errmsg $DB
|
|
|
|
} {no such column: namex}
|
|
|
|
|
|
|
|
do_test capi3-2.1 {
|
|
|
|
set sql16 [utf16 {SELECT name FROM sqlite_master}]
|
|
|
|
set STMT [sqlite3_prepare16 $DB $sql16 -1 ::TAIL]
|
2004-05-21 14:08:53 +04:00
|
|
|
sqlite3_finalize $STMT
|
2004-05-20 15:00:52 +04:00
|
|
|
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]
|
2004-05-21 14:08:53 +04:00
|
|
|
sqlite3_finalize $STMT
|
2004-05-20 15:00:52 +04:00
|
|
|
utf8 $TAIL
|
|
|
|
} {SELECT 10}
|
|
|
|
do_test capi3-2.3 {
|
|
|
|
set sql [utf16 {SELECT namex FROM sqlite_master}]
|
|
|
|
catch {
|
|
|
|
set STMT [sqlite3_prepare16 $DB $sql -1 TAIL]
|
|
|
|
}
|
|
|
|
} {1}
|
|
|
|
do_test capi3-2.4 {
|
|
|
|
sqlite3_errcode $DB
|
|
|
|
} {SQLITE_ERROR}
|
|
|
|
do_test capi3-2.5 {
|
|
|
|
sqlite3_errmsg $DB
|
|
|
|
} {no such column: namex}
|
|
|
|
|
2004-05-21 05:47:26 +04:00
|
|
|
# rename sqlite3_open sqlite3_open_old
|
|
|
|
# proc sqlite3_open {fname options} {sqlite3_open_new $fname $options}
|
|
|
|
|
|
|
|
do_test capi3-3.1 {
|
|
|
|
set db2 [sqlite3_open test.db {}]
|
|
|
|
sqlite3_errcode $db2
|
|
|
|
} {SQLITE_OK}
|
|
|
|
# FIX ME: Should test the db handle works.
|
|
|
|
do_test capi3-3.2 {
|
|
|
|
sqlite3_close $db2
|
2004-06-19 07:33:57 +04:00
|
|
|
} {SQLITE_OK}
|
2004-05-21 05:47:26 +04:00
|
|
|
do_test capi3-3.3 {
|
|
|
|
catch {
|
|
|
|
set db2 [sqlite3_open /bogus/path/test.db {}]
|
|
|
|
}
|
|
|
|
sqlite3_errcode $db2
|
|
|
|
} {SQLITE_CANTOPEN}
|
|
|
|
do_test capi3-3.4 {
|
|
|
|
sqlite3_errmsg $db2
|
|
|
|
} {unable to open database file}
|
2004-06-19 07:33:57 +04:00
|
|
|
do_test capi3-3.5 {
|
2004-05-21 05:47:26 +04:00
|
|
|
sqlite3_close $db2
|
2004-06-19 07:33:57 +04:00
|
|
|
} {SQLITE_OK}
|
2004-05-21 05:47:26 +04:00
|
|
|
|
|
|
|
# rename sqlite3_open ""
|
|
|
|
# rename sqlite3_open_old sqlite3_open
|
|
|
|
|
|
|
|
do_test capi3-4.1 {
|
|
|
|
set db2 [sqlite3_open16 [utf16 test.db] {}]
|
|
|
|
sqlite3_errcode $db2
|
|
|
|
} {SQLITE_OK}
|
|
|
|
# FIX ME: Should test the db handle works.
|
|
|
|
do_test capi3-4.2 {
|
|
|
|
sqlite3_close $db2
|
2004-06-19 07:33:57 +04:00
|
|
|
} {SQLITE_OK}
|
2004-05-21 05:47:26 +04:00
|
|
|
do_test capi3-4.3 {
|
|
|
|
catch {
|
|
|
|
set db2 [sqlite3_open16 [utf16 /bogus/path/test.db] {}]
|
|
|
|
}
|
|
|
|
sqlite3_errcode $db2
|
|
|
|
} {SQLITE_CANTOPEN}
|
|
|
|
do_test capi3-4.4 {
|
|
|
|
utf8 [sqlite3_errmsg16 $db2]
|
|
|
|
} {unable to open database file}
|
2004-05-27 13:28:41 +04:00
|
|
|
do_test capi3-4.5 {
|
2004-05-21 05:47:26 +04:00
|
|
|
sqlite3_close $db2
|
2004-06-19 07:33:57 +04:00
|
|
|
} {SQLITE_OK}
|
2004-05-21 05:47:26 +04:00
|
|
|
|
2004-05-27 05:49:51 +04:00
|
|
|
# This proc is used to test the following API calls:
|
2004-05-26 14:11:05 +04:00
|
|
|
#
|
2004-05-27 05:49:51 +04:00
|
|
|
# sqlite3_column_count
|
|
|
|
# sqlite3_column_name
|
|
|
|
# sqlite3_column_name16
|
|
|
|
# sqlite3_column_decltype
|
|
|
|
# sqlite3_column_decltype16
|
2004-05-26 14:11:05 +04:00
|
|
|
#
|
2004-05-27 05:49:51 +04:00
|
|
|
# $STMT is a compiled SQL statement. $test is a prefix
|
|
|
|
# to use for test names within this proc. $names is a list
|
|
|
|
# of the column names that should be returned by $STMT.
|
|
|
|
# $decltypes is a list of column declaration types for $STMT.
|
2004-05-27 05:04:07 +04:00
|
|
|
#
|
2004-05-27 05:49:51 +04:00
|
|
|
# Example:
|
2004-05-26 14:11:05 +04:00
|
|
|
#
|
2004-05-27 05:49:51 +04:00
|
|
|
# set STMT [sqlite3_prepare "SELECT 1, 2, 2;" -1 DUMMY]
|
|
|
|
# check_header test1.1 {1 2 3} {"" "" ""}
|
|
|
|
#
|
2004-05-27 13:28:41 +04:00
|
|
|
proc check_header {STMT test names decltypes} {
|
2004-05-27 05:49:51 +04:00
|
|
|
|
|
|
|
# Use the return value of sqlite3_column_count() to build
|
|
|
|
# a list of column indexes. i.e. If sqlite3_column_count
|
|
|
|
# is 3, build the list {0 1 2}.
|
2004-05-27 13:28:41 +04:00
|
|
|
set ::idxlist [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
set numcols [sqlite3_column_count $STMT]
|
2004-05-27 13:28:41 +04:00
|
|
|
for {set i 0} {$i < $numcols} {incr i} {lappend ::idxlist $i}
|
2004-05-27 05:49:51 +04:00
|
|
|
|
|
|
|
# Column names in UTF-8
|
|
|
|
do_test $test.1 {
|
|
|
|
set cnamelist [list]
|
|
|
|
foreach i $idxlist {lappend cnamelist [sqlite3_column_name $STMT $i]}
|
|
|
|
set cnamelist
|
|
|
|
} $names
|
|
|
|
|
|
|
|
# Column names in UTF-16
|
|
|
|
do_test $test.2 {
|
|
|
|
set cnamelist [list]
|
2004-05-28 17:13:02 +04:00
|
|
|
foreach i $idxlist {
|
|
|
|
lappend cnamelist [utf8 [sqlite3_column_name16 $STMT $i]]
|
|
|
|
}
|
2004-05-27 05:49:51 +04:00
|
|
|
set cnamelist
|
|
|
|
} $names
|
|
|
|
|
|
|
|
# Column names in UTF-8
|
|
|
|
do_test $test.3 {
|
|
|
|
set cnamelist [list]
|
|
|
|
foreach i $idxlist {lappend cnamelist [sqlite3_column_name $STMT $i]}
|
|
|
|
set cnamelist
|
|
|
|
} $names
|
|
|
|
|
|
|
|
# Column names in UTF-16
|
|
|
|
do_test $test.4 {
|
|
|
|
set cnamelist [list]
|
2004-05-28 17:13:02 +04:00
|
|
|
foreach i $idxlist {
|
|
|
|
lappend cnamelist [utf8 [sqlite3_column_name16 $STMT $i]]
|
|
|
|
}
|
2004-05-27 05:49:51 +04:00
|
|
|
set cnamelist
|
|
|
|
} $names
|
2004-05-28 17:13:02 +04:00
|
|
|
|
|
|
|
# Column names in UTF-8
|
|
|
|
do_test $test.5 {
|
|
|
|
set cnamelist [list]
|
|
|
|
foreach i $idxlist {lappend cnamelist [sqlite3_column_decltype $STMT $i]}
|
|
|
|
set cnamelist
|
|
|
|
} $decltypes
|
|
|
|
|
|
|
|
# Column declaration types in UTF-16
|
|
|
|
do_test $test.6 {
|
|
|
|
set cnamelist [list]
|
|
|
|
foreach i $idxlist {
|
|
|
|
lappend cnamelist [utf8 [sqlite3_column_decltype16 $STMT $i]]
|
|
|
|
}
|
|
|
|
set cnamelist
|
|
|
|
} $decltypes
|
|
|
|
|
2004-05-27 05:49:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# This proc is used to test the following APIs:
|
|
|
|
#
|
|
|
|
# sqlite3_data_count
|
|
|
|
# sqlite3_column_type
|
|
|
|
# sqlite3_column_int
|
|
|
|
# sqlite3_column_text
|
|
|
|
# sqlite3_column_text16
|
|
|
|
# sqlite3_column_double
|
|
|
|
#
|
|
|
|
# $STMT is a compiled SQL statement for which the previous call
|
|
|
|
# to sqlite3_step returned SQLITE_ROW. $test is a prefix to use
|
|
|
|
# for test names within this proc. $types is a list of the
|
|
|
|
# manifest types for the current row. $ints, $doubles and $strings
|
|
|
|
# are lists of the integer, real and string representations of
|
|
|
|
# the values in the current row.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# set STMT [sqlite3_prepare "SELECT 'hello', 1.1, NULL" -1 DUMMY]
|
|
|
|
# sqlite3_step $STMT
|
|
|
|
# check_data test1.2 {TEXT REAL NULL} {0 1 0} {0 1.1 0} {hello 1.1 {}}
|
|
|
|
#
|
|
|
|
proc check_data {STMT test types ints doubles strings} {
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:49:51 +04:00
|
|
|
# Use the return value of sqlite3_column_count() to build
|
|
|
|
# a list of column indexes. i.e. If sqlite3_column_count
|
|
|
|
# is 3, build the list {0 1 2}.
|
2004-05-27 13:28:41 +04:00
|
|
|
set ::idxlist [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
set numcols [sqlite3_data_count $STMT]
|
2004-05-27 13:28:41 +04:00
|
|
|
for {set i 0} {$i < $numcols} {incr i} {lappend ::idxlist $i}
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:04:07 +04:00
|
|
|
# types
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.1 {
|
2004-05-26 14:11:05 +04:00
|
|
|
set types [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend types [sqlite3_column_type $STMT $i]}
|
2004-05-26 14:11:05 +04:00
|
|
|
set types
|
2004-05-27 05:49:51 +04:00
|
|
|
} $types
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:04:07 +04:00
|
|
|
# Integers
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.2 {
|
2004-05-26 14:11:05 +04:00
|
|
|
set ints [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend ints [sqlite3_column_int $STMT $i]}
|
2004-05-26 14:11:05 +04:00
|
|
|
set ints
|
2004-05-27 05:49:51 +04:00
|
|
|
} $ints
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:04:07 +04:00
|
|
|
# UTF-8
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.3 {
|
2004-05-26 14:11:05 +04:00
|
|
|
set utf8 [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend utf8 [sqlite3_column_text $STMT $i]}
|
2004-05-26 14:11:05 +04:00
|
|
|
set utf8
|
2004-05-27 05:49:51 +04:00
|
|
|
} $strings
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:04:07 +04:00
|
|
|
# Floats
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.4 {
|
2004-05-27 05:04:07 +04:00
|
|
|
set utf8 [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend utf8 [sqlite3_column_double $STMT $i]}
|
2004-05-27 05:04:07 +04:00
|
|
|
set utf8
|
2004-05-27 05:49:51 +04:00
|
|
|
} $doubles
|
2004-05-27 05:04:07 +04:00
|
|
|
|
|
|
|
# UTF-16
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.5 {
|
2004-05-26 14:11:05 +04:00
|
|
|
set utf8 [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend utf8 [utf8 [sqlite3_column_text16 $STMT $i]]}
|
2004-05-26 14:11:05 +04:00
|
|
|
set utf8
|
2004-05-27 05:49:51 +04:00
|
|
|
} $strings
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:04:07 +04:00
|
|
|
# Integers
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.6 {
|
2004-05-27 05:04:07 +04:00
|
|
|
set ints [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend ints [sqlite3_column_int $STMT $i]}
|
2004-05-27 05:04:07 +04:00
|
|
|
set ints
|
2004-05-27 05:49:51 +04:00
|
|
|
} $ints
|
2004-05-27 05:04:07 +04:00
|
|
|
|
|
|
|
# Floats
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.7 {
|
2004-05-27 05:04:07 +04:00
|
|
|
set utf8 [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend utf8 [sqlite3_column_double $STMT $i]}
|
2004-05-27 05:04:07 +04:00
|
|
|
set utf8
|
2004-05-27 05:49:51 +04:00
|
|
|
} $doubles
|
2004-05-27 05:04:07 +04:00
|
|
|
|
|
|
|
# UTF-8
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.8 {
|
2004-05-27 05:04:07 +04:00
|
|
|
set utf8 [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend utf8 [sqlite3_column_text $STMT $i]}
|
2004-05-27 05:04:07 +04:00
|
|
|
set utf8
|
2004-05-27 05:49:51 +04:00
|
|
|
} $strings
|
2004-05-27 05:04:07 +04:00
|
|
|
|
|
|
|
# Types
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test $test.9 {
|
2004-05-26 14:11:05 +04:00
|
|
|
set types [list]
|
2004-05-27 05:49:51 +04:00
|
|
|
foreach i $idxlist {lappend types [sqlite3_column_type $STMT $i]}
|
2004-05-26 14:11:05 +04:00
|
|
|
set types
|
2004-05-27 05:49:51 +04:00
|
|
|
} $types
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
do_test capi3-5.0 {
|
|
|
|
execsql {
|
|
|
|
CREATE TABLE t1(a VARINT, b BLOB, c VARCHAR(16));
|
|
|
|
INSERT INTO t1 VALUES(1, 2, 3);
|
|
|
|
INSERT INTO t1 VALUES('one', 'two', NULL);
|
2004-05-27 13:28:41 +04:00
|
|
|
INSERT INTO t1 VALUES(1.2, 1.3, 1.4);
|
2004-05-27 05:49:51 +04:00
|
|
|
}
|
|
|
|
set sql "SELECT * FROM t1"
|
|
|
|
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:49:51 +04:00
|
|
|
sqlite3_column_count $STMT
|
|
|
|
} 3
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-28 17:13:02 +04:00
|
|
|
check_header $STMT capi3-5.1 {a b c} {VARINT BLOB VARCHAR(16)}
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test capi3-5.2 {
|
2004-05-26 14:11:05 +04:00
|
|
|
sqlite3_step $STMT
|
|
|
|
} SQLITE_ROW
|
|
|
|
|
2004-05-28 17:13:02 +04:00
|
|
|
check_header $STMT capi3-5.3 {a b c} {VARINT BLOB VARCHAR(16)}
|
2004-05-27 14:30:52 +04:00
|
|
|
check_data $STMT capi3-5.4 {INTEGER INTEGER TEXT} {1 2 3} {1.0 2.0 3.0} {1 2 3}
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test capi3-5.5 {
|
|
|
|
sqlite3_step $STMT
|
|
|
|
} SQLITE_ROW
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-28 17:13:02 +04:00
|
|
|
check_header $STMT capi3-5.6 {a b c} {VARINT BLOB VARCHAR(16)}
|
2004-05-27 14:30:52 +04:00
|
|
|
check_data $STMT capi3-5.7 {TEXT TEXT NULL} {0 0 0} {0.0 0.0 0.0} {one two {}}
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-27 05:49:51 +04:00
|
|
|
do_test capi3-5.8 {
|
2004-05-26 14:11:05 +04:00
|
|
|
sqlite3_step $STMT
|
2004-05-27 13:28:41 +04:00
|
|
|
} SQLITE_ROW
|
|
|
|
|
2004-05-28 17:13:02 +04:00
|
|
|
check_header $STMT capi3-5.9 {a b c} {VARINT BLOB VARCHAR(16)}
|
2004-05-27 14:30:52 +04:00
|
|
|
check_data $STMT capi3-5.10 {FLOAT FLOAT TEXT} {1 1 1} {1.2 1.3 1.4} {1.2 1.3 1.4}
|
2004-05-27 13:28:41 +04:00
|
|
|
|
|
|
|
do_test capi3-5.11 {
|
|
|
|
sqlite3_step $STMT
|
2004-05-26 14:11:05 +04:00
|
|
|
} SQLITE_DONE
|
|
|
|
|
2004-05-27 13:28:41 +04:00
|
|
|
do_test capi3-5.12 {
|
2004-05-26 14:11:05 +04:00
|
|
|
sqlite3_finalize $STMT
|
2004-05-27 05:49:51 +04:00
|
|
|
} SQLITE_OK
|
2004-05-26 14:11:05 +04:00
|
|
|
|
2004-05-21 14:08:53 +04:00
|
|
|
db close
|
|
|
|
|
2004-06-19 07:33:57 +04:00
|
|
|
do_test capi3-6.0 {
|
|
|
|
set DB [sqlite3_open test.db]
|
|
|
|
set sql {SELECT a FROM t1 order by rowid}
|
|
|
|
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
|
|
|
|
expr 0
|
|
|
|
} {0}
|
|
|
|
do_test capi3-6.1 {
|
|
|
|
sqlite3_close $DB
|
|
|
|
} {SQLITE_BUSY}
|
|
|
|
do_test capi3-6.2 {
|
|
|
|
sqlite3_step $STMT
|
|
|
|
} {SQLITE_ROW}
|
|
|
|
check_data $STMT capi3-6.3 {INTEGER} {1} {1.0} {1}
|
|
|
|
do_test capi3-6.3 {
|
|
|
|
sqlite3_finalize $STMT
|
|
|
|
} {SQLITE_OK}
|
|
|
|
do_test capi3-6.4 {
|
|
|
|
sqlite3_close $DB
|
|
|
|
} {SQLITE_OK}
|
|
|
|
|
2004-05-20 15:00:52 +04:00
|
|
|
finish_test
|
|
|
|
|
|
|
|
|