| Index: third_party/sqlite/src/test/capi3.test
|
| diff --git a/third_party/sqlite/src/test/capi3.test b/third_party/sqlite/src/test/capi3.test
|
| index cc1461a7eefd2a63183bee297f1419570938697a..9f3d6f6916448ffc7a4f4e0e5b7260e9e3a22a5d 100644
|
| --- a/third_party/sqlite/src/test/capi3.test
|
| +++ b/third_party/sqlite/src/test/capi3.test
|
| @@ -16,6 +16,7 @@
|
|
|
| set testdir [file dirname $argv0]
|
| source $testdir/tester.tcl
|
| +set ::testprefix capi3
|
|
|
| # Do not use a codec for tests in this file, as the database file is
|
| # manipulated directly using tcl scripts (using the [hexio_write] command).
|
| @@ -179,16 +180,18 @@ do_test capi3-3.4 {
|
| do_test capi3-3.5 {
|
| sqlite3_close $db2
|
| } {SQLITE_OK}
|
| -do_test capi3-3.6.1-misuse {
|
| - sqlite3_close $db2
|
| -} {SQLITE_MISUSE}
|
| -do_test capi3-3.6.2-misuse {
|
| - sqlite3_errmsg $db2
|
| -} {library routine called out of sequence}
|
| -ifcapable {utf16} {
|
| - do_test capi3-3.6.3-misuse {
|
| - utf8 [sqlite3_errmsg16 $db2]
|
| +if {[clang_sanitize_address]==0} {
|
| + do_test capi3-3.6.1-misuse {
|
| + sqlite3_close $db2
|
| + } {SQLITE_MISUSE}
|
| + do_test capi3-3.6.2-misuse {
|
| + sqlite3_errmsg $db2
|
| } {library routine called out of sequence}
|
| + ifcapable {utf16} {
|
| + do_test capi3-3.6.3-misuse {
|
| + utf8 [sqlite3_errmsg16 $db2]
|
| + } {library routine called out of sequence}
|
| + }
|
| }
|
|
|
| do_test capi3-3.7 {
|
| @@ -649,17 +652,24 @@ do_test capi3-6.1 {
|
| db cache flush
|
| sqlite3_close $DB
|
| } {SQLITE_BUSY}
|
| +
|
| +# 6.2 and 6.3 used to return SQLITE_ERROR and SQLITE_SCHEMA, respectively.
|
| +# But since attempting to close a connection no longer resets the internal
|
| +# schema and expires all statements, this is no longer the case.
|
| do_test capi3-6.2 {
|
| sqlite3_step $STMT
|
| -} {SQLITE_ERROR}
|
| +} {SQLITE_ROW}
|
| #check_data $STMT capi3-6.3 {INTEGER} {1} {1.0} {1}
|
| do_test capi3-6.3 {
|
| sqlite3_finalize $STMT
|
| -} {SQLITE_SCHEMA}
|
| -do_test capi3-6.4-misuse {
|
| - db cache flush
|
| - sqlite3_close $DB
|
| } {SQLITE_OK}
|
| +
|
| +if {[clang_sanitize_address]==0} {
|
| + do_test capi3-6.4-misuse {
|
| + db cache flush
|
| + sqlite3_close $DB
|
| + } {SQLITE_OK}
|
| +}
|
| db close
|
|
|
| # This procedure sets the value of the file-format in file 'test.db'
|
| @@ -697,7 +707,7 @@ if {![sqlite3 -has-codec]} {
|
| # Now test that the library correctly handles bogus entries in the
|
| # sqlite_master table (schema corruption).
|
| do_test capi3-8.1 {
|
| - file delete -force test.db test.db-journal
|
| + forcedelete test.db test.db-journal
|
| sqlite3 db test.db
|
| execsql {
|
| CREATE TABLE t1(a);
|
| @@ -722,7 +732,7 @@ if {![sqlite3 -has-codec]} {
|
| # Build a 5-field row record. The first field is a string 'table', and
|
| # subsequent fields are all NULL.
|
| db close
|
| - file delete -force test.db test.db-journal
|
| + forcedelete test.db test.db-journal
|
| sqlite3 db test.db
|
| execsql {
|
| CREATE TABLE t1(a);
|
| @@ -739,8 +749,8 @@ if {![sqlite3 -has-codec]} {
|
| } {1 {malformed database schema (?)}}
|
| db close
|
| }
|
| -file delete -force test.db
|
| -file delete -force test.db-journal
|
| +forcedelete test.db
|
| +forcedelete test.db-journal
|
|
|
|
|
| # Test the english language string equivalents for sqlite error codes
|
| @@ -778,6 +788,7 @@ foreach {code english} $code2english {
|
| }
|
|
|
| # Test the error message when a "real" out of memory occurs.
|
| +if { [permutation] != "nofaultsim" } {
|
| ifcapable memdebug {
|
| do_test capi3-10-1 {
|
| sqlite3 db test.db
|
| @@ -816,6 +827,7 @@ ifcapable memdebug {
|
| db close
|
| sqlite3_memdebug_fail -1
|
| }
|
| +}
|
|
|
| # The following tests - capi3-11.* - test that a COMMIT or ROLLBACK
|
| # statement issued while there are still outstanding VMs that are part of
|
| @@ -894,19 +906,26 @@ do_test capi3-11.9.2 {
|
| catchsql {
|
| ROLLBACK;
|
| }
|
| -} {1 {cannot rollback transaction - SQL statements in progress}}
|
| +} {0 {}}
|
| do_test capi3-11.9.3 {
|
| sqlite3_get_autocommit $DB
|
| -} 0
|
| +} 1
|
| do_test capi3-11.10 {
|
| sqlite3_step $STMT
|
| } {SQLITE_ROW}
|
| +ifcapable !autoreset {
|
| + # If SQLITE_OMIT_AUTORESET is defined, then the statement must be
|
| + # reset() before it can be passed to step() again.
|
| + do_test capi3-11.11a { sqlite3_step $STMT } {SQLITE_MISUSE}
|
| + do_test capi3-11.11b { sqlite3_reset $STMT } {SQLITE_ABORT}
|
| +}
|
| do_test capi3-11.11 {
|
| sqlite3_step $STMT
|
| -} {SQLITE_ROW}
|
| +} {SQLITE_DONE}
|
| do_test capi3-11.12 {
|
| sqlite3_step $STMT
|
| -} {SQLITE_DONE}
|
| + sqlite3_step $STMT
|
| +} {SQLITE_ROW}
|
| do_test capi3-11.13 {
|
| sqlite3_finalize $STMT
|
| } {SQLITE_OK}
|
| @@ -914,15 +933,15 @@ do_test capi3-11.14 {
|
| execsql {
|
| SELECT a FROM t2;
|
| }
|
| -} {1 2 3}
|
| +} {1 2}
|
| do_test capi3-11.14.1 {
|
| sqlite3_get_autocommit $DB
|
| -} 0
|
| +} 1
|
| do_test capi3-11.15 {
|
| catchsql {
|
| ROLLBACK;
|
| }
|
| -} {0 {}}
|
| +} {1 {cannot rollback - no transaction is active}}
|
| do_test capi3-11.15.1 {
|
| sqlite3_get_autocommit $DB
|
| } 1
|
| @@ -1046,11 +1065,13 @@ if {[llength [info commands sqlite3_sleep]]>0} {
|
| }
|
|
|
| # Ticket #1219: Make sure binding APIs can handle a NULL pointer.
|
| -#
|
| -do_test capi3-14.1-misuse {
|
| - set rc [catch {sqlite3_bind_text 0 1 hello 5} msg]
|
| - lappend rc $msg
|
| -} {1 SQLITE_MISUSE}
|
| +#
|
| +if {[clang_sanitize_address]==0} {
|
| + do_test capi3-14.1-misuse {
|
| + set rc [catch {sqlite3_bind_text 0 1 hello 5} msg]
|
| + lappend rc $msg
|
| + } {1 SQLITE_MISUSE}
|
| +}
|
|
|
| # Ticket #1650: Honor the nBytes parameter to sqlite3_prepare.
|
| #
|
| @@ -1201,6 +1222,23 @@ do_test capi3-19.1 {
|
| sqlite3_prepare_tkt3134 db
|
| } {}
|
|
|
| +# Test that calling sqlite3_column_blob() on a TEXT value does not change
|
| +# the return type of subsequent calls to sqlite3_column_type().
|
| +#
|
| +do_execsql_test 20.1 {
|
| + CREATE TABLE t4(x);
|
| + INSERT INTO t4 VALUES('abcdefghij');
|
| +}
|
| +do_test 20.2 {
|
| + set stmt [sqlite3_prepare db "SELECT * FROM t4" -1 dummy]
|
| + sqlite3_step $stmt
|
| +} {SQLITE_ROW}
|
| +do_test 20.3 { sqlite3_column_type $stmt 0 } {TEXT}
|
| +do_test 20.4 { sqlite3_column_blob $stmt 0 } {abcdefghij}
|
| +do_test 20.5 { sqlite3_column_type $stmt 0 } {TEXT}
|
| +do_test 20.6 { sqlite3_finalize $stmt } SQLITE_OK
|
| +
|
| +
|
| # Tests of the interface when no VFS is registered.
|
| #
|
| if {![info exists tester_do_binarylog]} {
|
|
|