OLD | NEW |
1 # 2003 January 29 | 1 # 2003 January 29 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 sqlite3_errcode $db2 | 165 sqlite3_errcode $db2 |
166 } {SQLITE_OK} | 166 } {SQLITE_OK} |
167 # FIX ME: Should test the db handle works. | 167 # FIX ME: Should test the db handle works. |
168 do_test capi3-3.2 { | 168 do_test capi3-3.2 { |
169 sqlite3_close $db2 | 169 sqlite3_close $db2 |
170 } {SQLITE_OK} | 170 } {SQLITE_OK} |
171 do_test capi3-3.3 { | 171 do_test capi3-3.3 { |
172 catch { | 172 catch { |
173 set db2 [sqlite3_open /bogus/path/test.db {}] | 173 set db2 [sqlite3_open /bogus/path/test.db {}] |
174 } | 174 } |
175 sqlite3_extended_errcode $db2 | 175 set ::capi3_errno [sqlite3_system_errno $db2] |
176 } {SQLITE_CANTOPEN} | 176 list [sqlite3_extended_errcode $db2] [expr {$::capi3_errno!=0}] |
| 177 } {SQLITE_CANTOPEN 1} |
177 do_test capi3-3.4 { | 178 do_test capi3-3.4 { |
178 sqlite3_errmsg $db2 | 179 sqlite3_errmsg $db2 |
179 } {unable to open database file} | 180 } {unable to open database file} |
180 do_test capi3-3.5 { | 181 do_test capi3-3.5 { |
181 sqlite3_close $db2 | 182 list [sqlite3_system_errno $db2] [sqlite3_close $db2] |
182 } {SQLITE_OK} | 183 } [list $::capi3_errno SQLITE_OK] |
183 if {[clang_sanitize_address]==0} { | 184 if {[clang_sanitize_address]==0} { |
184 do_test capi3-3.6.1-misuse { | 185 do_test capi3-3.6.1-misuse { |
185 sqlite3_close $db2 | 186 sqlite3_close $db2 |
186 } {SQLITE_MISUSE} | 187 } {SQLITE_MISUSE} |
187 do_test capi3-3.6.2-misuse { | 188 do_test capi3-3.6.2-misuse { |
188 sqlite3_errmsg $db2 | 189 sqlite3_errmsg $db2 |
189 } {library routine called out of sequence} | 190 } {library routine called out of sequence} |
190 ifcapable {utf16} { | 191 ifcapable {utf16} { |
191 do_test capi3-3.6.3-misuse { | 192 do_test capi3-3.6.3-misuse { |
192 utf8 [sqlite3_errmsg16 $db2] | 193 utf8 [sqlite3_errmsg16 $db2] |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 catchsql { | 919 catchsql { |
919 ROLLBACK; | 920 ROLLBACK; |
920 } | 921 } |
921 } {0 {}} | 922 } {0 {}} |
922 do_test capi3-11.9.3 { | 923 do_test capi3-11.9.3 { |
923 sqlite3_get_autocommit $DB | 924 sqlite3_get_autocommit $DB |
924 } 1 | 925 } 1 |
925 do_test capi3-11.10 { | 926 do_test capi3-11.10 { |
926 sqlite3_step $STMT | 927 sqlite3_step $STMT |
927 } {SQLITE_ROW} | 928 } {SQLITE_ROW} |
928 ifcapable !autoreset { | |
929 # If SQLITE_OMIT_AUTORESET is defined, then the statement must be | |
930 # reset() before it can be passed to step() again. | |
931 do_test capi3-11.11a { sqlite3_step $STMT } {SQLITE_MISUSE} | |
932 do_test capi3-11.11b { sqlite3_reset $STMT } {SQLITE_ABORT} | |
933 } | |
934 do_test capi3-11.11 { | 929 do_test capi3-11.11 { |
935 sqlite3_step $STMT | 930 sqlite3_step $STMT |
936 } {SQLITE_DONE} | 931 } {SQLITE_DONE} |
937 do_test capi3-11.12 { | 932 ifcapable !autoreset { |
938 sqlite3_step $STMT | 933 do_test capi3-11.12armor { |
939 sqlite3_step $STMT | 934 sqlite3_step $STMT |
940 } {SQLITE_ROW} | 935 sqlite3_step $STMT |
| 936 } {SQLITE_MISUSE} |
| 937 } else { |
| 938 do_test capi3-11.12 { |
| 939 sqlite3_step $STMT |
| 940 sqlite3_step $STMT |
| 941 } {SQLITE_ROW} |
| 942 } |
941 do_test capi3-11.13 { | 943 do_test capi3-11.13 { |
942 sqlite3_finalize $STMT | 944 sqlite3_finalize $STMT |
943 } {SQLITE_OK} | 945 } {SQLITE_OK} |
944 do_test capi3-11.14 { | 946 do_test capi3-11.14 { |
945 execsql { | 947 execsql { |
946 SELECT a FROM t2; | 948 SELECT a FROM t2; |
947 } | 949 } |
948 } {1 2} | 950 } {1 2} |
949 do_test capi3-11.14.1 { | 951 do_test capi3-11.14.1 { |
950 sqlite3_get_autocommit $DB | 952 sqlite3_get_autocommit $DB |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 if {![info exists tester_do_binarylog]} { | 1258 if {![info exists tester_do_binarylog]} { |
1257 db close | 1259 db close |
1258 vfs_unregister_all | 1260 vfs_unregister_all |
1259 do_test capi3-20.1 { | 1261 do_test capi3-20.1 { |
1260 sqlite3_sleep 100 | 1262 sqlite3_sleep 100 |
1261 } {0} | 1263 } {0} |
1262 vfs_reregister_all | 1264 vfs_reregister_all |
1263 } | 1265 } |
1264 | 1266 |
1265 finish_test | 1267 finish_test |
OLD | NEW |