| OLD | NEW |
| 1 # 2001 September 15. | 1 # 2001 September 15. |
| 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 execsql { | 228 execsql { |
| 229 CREATE TABLE t5(a,b,c,PRIMARY KEY(a,b)); | 229 CREATE TABLE t5(a,b,c,PRIMARY KEY(a,b)); |
| 230 INSERT INTO t5 VALUES(1,2,3); | 230 INSERT INTO t5 VALUES(1,2,3); |
| 231 SELECT * FROM t5 ORDER BY a; | 231 SELECT * FROM t5 ORDER BY a; |
| 232 } | 232 } |
| 233 } {1 2 3} | 233 } {1 2 3} |
| 234 do_test misc1-7.4 { | 234 do_test misc1-7.4 { |
| 235 catchsql { | 235 catchsql { |
| 236 INSERT INTO t5 VALUES(1,2,4); | 236 INSERT INTO t5 VALUES(1,2,4); |
| 237 } | 237 } |
| 238 } {1 {columns a, b are not unique}} | 238 } {1 {UNIQUE constraint failed: t5.a, t5.b}} |
| 239 do_test misc1-7.5 { | 239 do_test misc1-7.5 { |
| 240 catchsql { | 240 catchsql { |
| 241 INSERT INTO t5 VALUES(0,2,4); | 241 INSERT INTO t5 VALUES(0,2,4); |
| 242 } | 242 } |
| 243 } {0 {}} | 243 } {0 {}} |
| 244 do_test misc1-7.6 { | 244 do_test misc1-7.6 { |
| 245 execsql { | 245 execsql { |
| 246 SELECT * FROM t5 ORDER BY a; | 246 SELECT * FROM t5 ORDER BY a; |
| 247 } | 247 } |
| 248 } {0 2 4 1 2 3} | 248 } {0 2 4 1 2 3} |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 OR x=(SELECT x FROM t9 WHERE y=10) | 465 OR x=(SELECT x FROM t9 WHERE y=10) |
| 466 OR x=(SELECT x FROM t9 WHERE y=11) | 466 OR x=(SELECT x FROM t9 WHERE y=11) |
| 467 OR x=(SELECT x FROM t9 WHERE y=12) | 467 OR x=(SELECT x FROM t9 WHERE y=12) |
| 468 OR x=(SELECT x FROM t9 WHERE y=13) | 468 OR x=(SELECT x FROM t9 WHERE y=13) |
| 469 OR x=(SELECT x FROM t9 WHERE y=14) | 469 OR x=(SELECT x FROM t9 WHERE y=14) |
| 470 ; | 470 ; |
| 471 } | 471 } |
| 472 } {1 2 3 4 5 6 7 8 9 10 11} | 472 } {1 2 3 4 5 6 7 8 9 10 11} |
| 473 } | 473 } |
| 474 | 474 |
| 475 # |
| 476 # The following tests can only work if the current SQLite VFS has the concept |
| 477 # of a current directory. |
| 478 # |
| 479 ifcapable curdir { |
| 475 # Make sure a database connection still works after changing the | 480 # Make sure a database connection still works after changing the |
| 476 # working directory. | 481 # working directory. |
| 477 # | 482 # |
| 478 do_test misc1-14.1 { | 483 do_test misc1-14.1 { |
| 479 file mkdir tempdir | 484 file mkdir tempdir |
| 480 cd tempdir | 485 cd tempdir |
| 481 execsql {BEGIN} | 486 execsql {BEGIN} |
| 482 file exists ./test.db-journal | 487 file exists ./test.db-journal |
| 483 } {0} | 488 } {0} |
| 484 do_test misc1-14.2a { | 489 do_test misc1-14.2a { |
| 485 execsql {UPDATE t1 SET a=a||'x' WHERE 0} | 490 execsql {UPDATE t1 SET a=a||'x' WHERE 0} |
| 486 file exists ../test.db-journal | 491 file exists ../test.db-journal |
| 487 } {0} | 492 } {0} |
| 488 do_test misc1-14.2b { | 493 do_test misc1-14.2b { |
| 489 execsql {UPDATE t1 SET a=a||'y' WHERE 1} | 494 execsql {UPDATE t1 SET a=a||'y' WHERE 1} |
| 490 file exists ../test.db-journal | 495 file exists ../test.db-journal |
| 491 } {1} | 496 } {1} |
| 492 do_test misc1-14.3 { | 497 do_test misc1-14.3 { |
| 493 cd .. | 498 cd .. |
| 494 file delete -force tempdir | 499 forcedelete tempdir |
| 495 execsql {COMMIT} | 500 execsql {COMMIT} |
| 496 file exists ./test.db-journal | 501 file exists ./test.db-journal |
| 497 } {0} | 502 } {0} |
| 503 } |
| 498 | 504 |
| 499 # A failed create table should not leave the table in the internal | 505 # A failed create table should not leave the table in the internal |
| 500 # data structures. Ticket #238. | 506 # data structures. Ticket #238. |
| 501 # | 507 # |
| 502 do_test misc1-15.1.1 { | 508 do_test misc1-15.1.1 { |
| 503 catchsql { | 509 catchsql { |
| 504 CREATE TABLE t10 AS SELECT c1; | 510 CREATE TABLE t10 AS SELECT c1; |
| 505 } | 511 } |
| 506 } {1 {no such column: c1}} | 512 } {1 {no such column: c1}} |
| 507 do_test misc1-15.1.2 { | 513 do_test misc1-15.1.2 { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 SELECT TestString FROM RealTable ORDER BY 1; | 585 SELECT TestString FROM RealTable ORDER BY 1; |
| 580 } | 586 } |
| 581 } {2 3} | 587 } {2 3} |
| 582 } | 588 } |
| 583 | 589 |
| 584 do_test misc1-18.1 { | 590 do_test misc1-18.1 { |
| 585 set n [sqlite3_sleep 100] | 591 set n [sqlite3_sleep 100] |
| 586 expr {$n>=100} | 592 expr {$n>=100} |
| 587 } {1} | 593 } {1} |
| 588 | 594 |
| 595 # 2014-01-10: In a CREATE TABLE AS, if one or more of the column names |
| 596 # are an empty string, that is still OK. |
| 597 # |
| 598 do_execsql_test misc1-19.1 { |
| 599 CREATE TABLE t19 AS SELECT 1, 2 AS '', 3; |
| 600 SELECT * FROM t19; |
| 601 } {1 2 3} |
| 602 do_execsql_test misc1-19.2 { |
| 603 CREATE TABLE t19b AS SELECT 4 AS '', 5 AS '', 6 AS ''; |
| 604 SELECT * FROM t19b; |
| 605 } {4 5 6} |
| 606 |
| 607 # 2014-05-16: Tests for the SQLITE_TESTCTRL_FAULT_INSTALL feature. |
| 608 # |
| 609 unset -nocomplain fault_callbacks |
| 610 set fault_callbacks {} |
| 611 proc fault_callback {n} { |
| 612 lappend ::fault_callbacks $n |
| 613 return 0 |
| 614 } |
| 615 do_test misc1-19.1 { |
| 616 sqlite3_test_control_fault_install fault_callback |
| 617 set fault_callbacks |
| 618 } {0} |
| 619 do_test misc1-19.2 { |
| 620 sqlite3_test_control_fault_install |
| 621 set fault_callbacks |
| 622 } {0} |
| 623 |
| 589 finish_test | 624 finish_test |
| OLD | NEW |