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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 [get_row_values $VM] \ | 228 [get_row_values $VM] \ |
229 [get_column_names $VM] | 229 [get_column_names $VM] |
230 } {SQLITE_ERROR 0 {} {}} | 230 } {SQLITE_ERROR 0 {} {}} |
231 | 231 |
232 # Update for v3: Preparing a statement does not affect the change counter. | 232 # Update for v3: Preparing a statement does not affect the change counter. |
233 # (Test result changes from 0 to 1). (Later:) change counter updates occur | 233 # (Test result changes from 0 to 1). (Later:) change counter updates occur |
234 # when sqlite3_step returns, not at finalize time. | 234 # when sqlite3_step returns, not at finalize time. |
235 do_test capi2-3.13b {db changes} {0} | 235 do_test capi2-3.13b {db changes} {0} |
236 | 236 |
237 do_test capi2-3.14 { | 237 do_test capi2-3.14 { |
238 list [sqlite3_finalize $VM] [sqlite3_errmsg $DB] | 238 list [sqlite3_finalize $VM] [sqlite3_errmsg $DB] \ |
239 } {SQLITE_CONSTRAINT {column a is not unique}} | 239 [sqlite3_extended_errcode $DB] |
| 240 } {SQLITE_CONSTRAINT {UNIQUE constraint failed: t1.a} SQLITE_CONSTRAINT_UNIQUE} |
240 do_test capi2-3.15 { | 241 do_test capi2-3.15 { |
241 set VM [sqlite3_prepare $DB {CREATE TABLE t2(a NOT NULL, b)} -1 TAIL] | 242 set VM [sqlite3_prepare $DB {CREATE TABLE t2(a NOT NULL, b)} -1 TAIL] |
242 set TAIL | 243 set TAIL |
243 } {} | 244 } {} |
244 do_test capi2-3.16 { | 245 do_test capi2-3.16 { |
245 list [sqlite3_step $VM] \ | 246 list [sqlite3_step $VM] \ |
246 [sqlite3_column_count $VM] \ | 247 [sqlite3_column_count $VM] \ |
247 [get_row_values $VM] \ | 248 [get_row_values $VM] \ |
248 [get_column_names $VM] | 249 [get_column_names $VM] |
249 } {SQLITE_DONE 0 {} {}} | 250 } {SQLITE_DONE 0 {} {}} |
250 do_test capi2-3.17 { | 251 do_test capi2-3.17 { |
251 list [sqlite3_finalize $VM] [sqlite3_errmsg $DB] | 252 list [sqlite3_finalize $VM] [sqlite3_errmsg $DB] |
252 } {SQLITE_OK {not an error}} | 253 } {SQLITE_OK {not an error}} |
253 do_test capi2-3.18 { | 254 do_test capi2-3.18 { |
254 set VM [sqlite3_prepare $DB {INSERT INTO t2 VALUES(NULL,2)} -1 TAIL] | 255 set VM [sqlite3_prepare $DB {INSERT INTO t2 VALUES(NULL,2)} -1 TAIL] |
255 list [sqlite3_step $VM] \ | 256 list [sqlite3_step $VM] \ |
256 [sqlite3_column_count $VM] \ | 257 [sqlite3_column_count $VM] \ |
257 [get_row_values $VM] \ | 258 [get_row_values $VM] \ |
258 [get_column_names $VM] | 259 [get_column_names $VM] |
259 } {SQLITE_ERROR 0 {} {}} | 260 } {SQLITE_ERROR 0 {} {}} |
260 do_test capi2-3.19 { | 261 do_test capi2-3.19 { |
261 list [sqlite3_finalize $VM] [sqlite3_errmsg $DB] | 262 list [sqlite3_finalize $VM] [sqlite3_errmsg $DB] \ |
262 } {SQLITE_CONSTRAINT {t2.a may not be NULL}} | 263 [sqlite3_extended_errcode $DB] |
| 264 } {SQLITE_CONSTRAINT {NOT NULL constraint failed: t2.a} SQLITE_CONSTRAINT_NOTNUL
L} |
263 | 265 |
264 do_test capi2-3.20 { | 266 do_test capi2-3.20 { |
265 execsql { | 267 execsql { |
266 CREATE TABLE a1(message_id, name , UNIQUE(message_id, name) ); | 268 CREATE TABLE a1(message_id, name , UNIQUE(message_id, name) ); |
267 INSERT INTO a1 VALUES(1, 1); | 269 INSERT INTO a1 VALUES(1, 1); |
268 } | 270 } |
269 } {} | 271 } {} |
270 do_test capi2-3.21 { | 272 do_test capi2-3.21 { |
271 set VM [sqlite3_prepare $DB {INSERT INTO a1 VALUES(1, 1)} -1 TAIL] | 273 set VM [sqlite3_prepare $DB {INSERT INTO a1 VALUES(1, 1)} -1 TAIL] |
272 sqlite3_step $VM | 274 sqlite3_step $VM |
273 } {SQLITE_ERROR} | 275 } {SQLITE_ERROR} |
274 do_test capi2-3.22 { | 276 do_test capi2-3.22 { |
275 sqlite3_errcode $DB | 277 sqlite3_errcode $DB |
276 } {SQLITE_ERROR} | 278 } {SQLITE_ERROR} |
277 do_test capi2-3.23 { | 279 do_test capi2-3.23 { |
278 sqlite3_finalize $VM | 280 sqlite3_finalize $VM |
279 } {SQLITE_CONSTRAINT} | 281 } {SQLITE_CONSTRAINT} |
280 do_test capi2-3.24 { | 282 do_test capi2-3.24 { |
281 sqlite3_errcode $DB | 283 list [sqlite3_errcode $DB] [sqlite3_extended_errcode $DB] |
282 } {SQLITE_CONSTRAINT} | 284 } {SQLITE_CONSTRAINT SQLITE_CONSTRAINT_UNIQUE} |
283 | 285 |
284 # Two or more virtual machines exists at the same time. | 286 # Two or more virtual machines exists at the same time. |
285 # | 287 # |
286 do_test capi2-4.1 { | 288 do_test capi2-4.1 { |
287 set VM1 [sqlite3_prepare $DB {INSERT INTO t2 VALUES(1,2)} -1 TAIL] | 289 set VM1 [sqlite3_prepare $DB {INSERT INTO t2 VALUES(1,2)} -1 TAIL] |
288 set TAIL | 290 set TAIL |
289 } {} | 291 } {} |
290 do_test capi2-4.2 { | 292 do_test capi2-4.2 { |
291 set VM2 [sqlite3_prepare $DB {INSERT INTO t2 VALUES(2,3)} -1 TAIL] | 293 set VM2 [sqlite3_prepare $DB {INSERT INTO t2 VALUES(2,3)} -1 TAIL] |
292 set TAIL | 294 set TAIL |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 list [sqlite3_step $VM1] \ | 548 list [sqlite3_step $VM1] \ |
547 [sqlite3_column_count $VM1] \ | 549 [sqlite3_column_count $VM1] \ |
548 [get_row_values $VM1] \ | 550 [get_row_values $VM1] \ |
549 [get_column_names $VM1] | 551 [get_column_names $VM1] |
550 } {SQLITE_ROW 1 12 {x counter}} | 552 } {SQLITE_ROW 1 12 {x counter}} |
551 do_test capi2-6.27 { | 553 do_test capi2-6.27 { |
552 catchsql { | 554 catchsql { |
553 INSERT INTO t1 VALUES(2,4,5); | 555 INSERT INTO t1 VALUES(2,4,5); |
554 SELECT * FROM t1; | 556 SELECT * FROM t1; |
555 } | 557 } |
556 } {1 {column a is not unique}} | 558 } {1 {UNIQUE constraint failed: t1.a}} |
557 do_test capi2-6.28 { | 559 do_test capi2-6.28 { |
558 list [sqlite3_step $VM1] \ | 560 list [sqlite3_step $VM1] \ |
559 [sqlite3_column_count $VM1] \ | 561 [sqlite3_column_count $VM1] \ |
560 [get_row_values $VM1] \ | 562 [get_row_values $VM1] \ |
561 [get_column_names $VM1] | 563 [get_column_names $VM1] |
562 } {SQLITE_ROW 1 13 {x counter}} | 564 } {SQLITE_ROW 1 13 {x counter}} |
563 do_test capi2-6.99 { | 565 do_test capi2-6.99 { |
564 sqlite3_finalize $VM1 | 566 sqlite3_finalize $VM1 |
565 } {SQLITE_OK} | 567 } {SQLITE_OK} |
566 catchsql {ROLLBACK} | 568 catchsql {ROLLBACK} |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 do_test capi2-13.11 { | 794 do_test capi2-13.11 { |
793 check_origins {select * from (select * from tab1 limit 10 offset 10)} | 795 check_origins {select * from (select * from tab1 limit 10 offset 10)} |
794 } [list {main tab1 col1} {main tab1 col2}] | 796 } [list {main tab1 col1} {main tab1 col2}] |
795 } | 797 } |
796 | 798 |
797 | 799 |
798 } ;# ifcapable columnmetadata | 800 } ;# ifcapable columnmetadata |
799 | 801 |
800 db2 close | 802 db2 close |
801 finish_test | 803 finish_test |
OLD | NEW |