Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/session/sessionconflict.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / session / sessionconflict.test` 76 lines ยท 1657 bytes Raw Blame History 1 # 2011 March 07 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #*********************************************************************** 11 # This file implements regression tests for SQLite library. 12 # 13 14 if {![info exists testdir]} { 15 set testdir [file join [file dirname [info script]] .. .. test] 16 } 17 source [file join [file dirname [info script]] session_common.tcl] 18 source $testdir/tester.tcl 19 ifcapable !session {finish_test; return} 20 21 set testprefix sessionconflict 22 23 db close 24 sqlite3_shutdown 25 test_sqlite3_log log 26 proc log {code msg} { puts "LOG $code $msg" } 27 sqlite3 db test.db 28 29 forcedelete test.db2 30 sqlite3 db2 test.db2 31 32 do_test 1.0 { 33 do_common_sql { 34 CREATE TABLE t1(a PRIMARY KEY, b, c UNIQUE); 35 INSERT INTO t1 VALUES(1, 1, 1); 36 INSERT INTO t1 VALUES(2, 2, 2); 37 INSERT INTO t1 VALUES(3, 3, 3); 38 } 39 } {} 40 41 do_execsql_test -db db2 1.1 { 42 INSERT INTO t1 VALUES(6, 6, 6); 43 } 44 45 proc xConflict {args} { 46 return "ABORT" 47 } 48 49 50 do_test 1.2 { 51 set chng [changeset_from_sql { 52 UPDATE t1 SET b=10, c=10 WHERE a=1; 53 UPDATE t1 SET b=444 WHERE a=2; 54 INSERT INTO t1 VALUES(4, 4, 4); 55 INSERT INTO t1 VALUES(5, 5, 5); 56 INSERT INTO t1 VALUES(6, 6, 6); 57 }] 58 59 execsql BEGIN db2 60 set res [list [catch { sqlite3changeset_apply db2 $chng xConflict } msg] $msg] 61 execsql ROLLBACK db2 62 set res 63 } {1 SQLITE_ABORT} 64 65 do_execsql_test -db db2 1.3 { 66 SELECT * FROM t1; 67 } { 68 1 1 1 69 2 2 2 70 3 3 3 71 6 6 6 72 } 73 74 75 db2 close 76 finish_test