OLD | NEW |
1 # 2004 June 30 | 1 # 2004 June 30 |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } {SQLITE_ROW} | 47 } {SQLITE_ROW} |
48 | 48 |
49 ifcapable conflict { | 49 ifcapable conflict { |
50 # This causes a ROLLBACK, which deletes the table out from underneath the | 50 # This causes a ROLLBACK, which deletes the table out from underneath the |
51 # SELECT statement. | 51 # SELECT statement. |
52 # | 52 # |
53 do_test rollback-1.4 { | 53 do_test rollback-1.4 { |
54 catchsql { | 54 catchsql { |
55 INSERT INTO t3 SELECT a FROM t1; | 55 INSERT INTO t3 SELECT a FROM t1; |
56 } | 56 } |
57 } {1 {column a is not unique}} | 57 } {1 {UNIQUE constraint failed: t3.a}} |
58 | 58 |
59 # Try to continue with the SELECT statement | 59 # Try to continue with the SELECT statement |
60 # | 60 # |
61 do_test rollback-1.5 { | 61 do_test rollback-1.5 { |
62 sqlite3_step $STMT | 62 sqlite3_step $STMT |
63 } {SQLITE_ERROR} | 63 } {SQLITE_ROW} |
64 | 64 |
65 # Restart the SELECT statement | 65 # Restart the SELECT statement |
66 # | 66 # |
67 do_test rollback-1.6 { sqlite3_reset $STMT } {SQLITE_ABORT} | 67 do_test rollback-1.6 { sqlite3_reset $STMT } {SQLITE_OK} |
68 } else { | 68 } else { |
69 do_test rollback-1.6 { sqlite3_reset $STMT } {SQLITE_OK} | 69 do_test rollback-1.6 { sqlite3_reset $STMT } {SQLITE_OK} |
70 } | 70 } |
71 | 71 |
72 do_test rollback-1.7 { | 72 do_test rollback-1.7 { |
73 sqlite3_step $STMT | 73 sqlite3_step $STMT |
74 } {SQLITE_ROW} | 74 } {SQLITE_ROW} |
75 do_test rollback-1.8 { | 75 do_test rollback-1.8 { |
76 sqlite3_step $STMT | 76 sqlite3_step $STMT |
77 } {SQLITE_ROW} | 77 } {SQLITE_ROW} |
78 do_test rollback-1.9 { | 78 do_test rollback-1.9 { |
79 sqlite3_finalize $STMT | 79 sqlite3_finalize $STMT |
80 } {SQLITE_OK} | 80 } {SQLITE_OK} |
81 | 81 |
82 if {$tcl_platform(platform) == "unix" | 82 if {$tcl_platform(platform) == "unix" |
83 && [permutation] ne "onefile" | 83 && [permutation] ne "onefile" |
84 && [permutation] ne "inmemory_journal" | 84 && [permutation] ne "inmemory_journal" |
85 } { | 85 } { |
86 do_test rollback-2.1 { | 86 do_test rollback-2.1 { |
87 execsql { | 87 execsql { |
88 BEGIN; | 88 BEGIN; |
89 INSERT INTO t3 VALUES('hello world'); | 89 INSERT INTO t3 VALUES('hello world'); |
90 } | 90 } |
91 file copy -force test.db testA.db | 91 forcecopy test.db testA.db |
92 file copy -force test.db-journal testA.db-journal | 92 forcecopy test.db-journal testA.db-journal |
93 execsql { | 93 execsql { |
94 COMMIT; | 94 COMMIT; |
95 } | 95 } |
96 } {} | 96 } {} |
97 | 97 |
98 # At this point files testA.db and testA.db-journal are present in the | 98 # At this point files testA.db and testA.db-journal are present in the |
99 # file system. This block adds a master-journal file pointer to the | 99 # file system. This block adds a master-journal file pointer to the |
100 # end of testA.db-journal. The master-journal file does not exist. | 100 # end of testA.db-journal. The master-journal file does not exist. |
101 # | 101 # |
102 set mj [file normalize testA.db-mj-123] | 102 set mj [file normalize testA.db-mj-123] |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 do_test rollback-2.4 { | 141 do_test rollback-2.4 { |
142 execsql { | 142 execsql { |
143 SELECT distinct tbl_name FROM sqlite_master; | 143 SELECT distinct tbl_name FROM sqlite_master; |
144 } db2 | 144 } db2 |
145 } {t1 t3} | 145 } {t1 t3} |
146 | 146 |
147 db2 close | 147 db2 close |
148 } | 148 } |
149 | 149 |
150 finish_test | 150 finish_test |
OLD | NEW |