| OLD | NEW |
| 1 # 2002 January 29 | 1 # 2002 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 9 FAIL {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 | 300 9 FAIL {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 |
| 301 10 ABORT {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 | 301 10 ABORT {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 |
| 302 11 ROLLBACK {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 | 302 11 ROLLBACK {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 |
| 303 12 {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 | 303 12 {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 |
| 304 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 | 304 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0 |
| 305 14 {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 0 0 | 305 14 {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 0 0 |
| 306 15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 1 | 306 15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 1 |
| 307 16 {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 0 0 | 307 16 {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 0 0 |
| 308 } { | 308 } { |
| 309 if {$t0} {set t1 {column a is not unique}} | 309 if {$t0} {set t1 {column a is not unique}} |
| 310 if {[info exists TEMP_STORE] && $TEMP_STORE>=2} { | 310 if {[info exists TEMP_STORE] && $TEMP_STORE==3} { |
| 311 set t3 0 | 311 set t3 0 |
| 312 } else { | 312 } else { |
| 313 set t3 [expr {$t3+$t4}] | 313 set t3 [expr {$t3+$t4}] |
| 314 } | 314 } |
| 315 do_test conflict-6.$i { | 315 do_test conflict-6.$i { |
| 316 db close | 316 db close |
| 317 sqlite3 db test.db | 317 sqlite3 db test.db |
| 318 if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"} | 318 if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"} |
| 319 execsql {pragma temp_store=file} | 319 execsql {pragma temp_store=file} |
| 320 set ::sqlite_opentemp_count 0 | 320 set ::sqlite_opentemp_count 0 |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 } | 782 } |
| 783 } {1 {PRIMARY KEY must be unique}} | 783 } {1 {PRIMARY KEY must be unique}} |
| 784 do_test conflict-12.4 { | 784 do_test conflict-12.4 { |
| 785 execsql { | 785 execsql { |
| 786 UPDATE OR REPLACE t5 SET a=a+1 WHERE a=1; | 786 UPDATE OR REPLACE t5 SET a=a+1 WHERE a=1; |
| 787 SELECT * FROM t5; | 787 SELECT * FROM t5; |
| 788 } | 788 } |
| 789 } {2 one} | 789 } {2 one} |
| 790 | 790 |
| 791 | 791 |
| 792 # Ticket [c38baa3d969eab7946dc50ba9d9b4f0057a19437] |
| 793 # REPLACE works like ABORT on a CHECK constraint. |
| 794 # |
| 795 do_test conflict-13.1 { |
| 796 execsql { |
| 797 CREATE TABLE t13(a CHECK(a!=2)); |
| 798 BEGIN; |
| 799 REPLACE INTO t13 VALUES(1); |
| 800 } |
| 801 catchsql { |
| 802 REPLACE INTO t13 VALUES(2); |
| 803 } |
| 804 } {1 {constraint failed}} |
| 805 do_test conflict-13.2 { |
| 806 execsql { |
| 807 REPLACE INTO t13 VALUES(3); |
| 808 COMMIT; |
| 809 SELECT * FROM t13; |
| 810 } |
| 811 } {1 3} |
| 812 |
| 813 |
| 792 finish_test | 814 finish_test |
| OLD | NEW |