SQLite

Check-in [b4a6d326]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add extra tests for aborting conflicts in the sessions module.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b4a6d32662acacb7767cfb9b8e040e6eb1f99322cb7d0cd44e6265e9ac2fb2e8
User & Date: dan 2024-04-22 20:09:17
Context
2024-04-23
05:38
When running the 'dist' target in ext/wasm for an SEE-capable build, ensure that the resulting zip file and directory name include '-see'. (check-in: 04c552b1 user: stephan tags: trunk)
2024-04-22
20:09
Add extra tests for aborting conflicts in the sessions module. (check-in: b4a6d326 user: dan tags: trunk)
17:03
Minor cleanups to [8fbda563d2f5]. (check-in: 5ee2594b user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added ext/session/sessionconflict.test.























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 2011 March 07
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#

if {![info exists testdir]} {
  set testdir [file join [file dirname [info script]] .. .. test]
} 
source [file join [file dirname [info script]] session_common.tcl]
source $testdir/tester.tcl
ifcapable !session {finish_test; return}

set testprefix sessionconflict

sqlite3_shutdown
test_sqlite3_log log
proc log {code msg} { puts "LOG $code $msg" }
sqlite3 db test.db

forcedelete test.db2
sqlite3 db2 test.db2

do_test 1.0 {
  do_common_sql {
    CREATE TABLE t1(a PRIMARY KEY, b, c UNIQUE);
    INSERT INTO t1 VALUES(1, 1, 1);
    INSERT INTO t1 VALUES(2, 2, 2);
    INSERT INTO t1 VALUES(3, 3, 3);
  }
} {}

do_execsql_test -db db2 1.1 {
  INSERT INTO t1 VALUES(6, 6, 6);
}

proc xConflict {args} {
  return "ABORT"
}


do_test 1.2 {
  set chng [changeset_from_sql {
    UPDATE t1 SET b=10, c=10 WHERE a=1;
    UPDATE t1 SET b=444 WHERE a=2;
    INSERT INTO t1 VALUES(4, 4, 4);
    INSERT INTO t1 VALUES(5, 5, 5);
    INSERT INTO t1 VALUES(6, 6, 6);
  }]

  execsql BEGIN db2
  set res [list [catch { sqlite3changeset_apply db2 $chng xConflict } msg] $msg]
  execsql ROLLBACK db2
  set res
} {1 SQLITE_ABORT}

do_execsql_test -db db2 1.3 {
  SELECT * FROM t1;
} {
  1 1 1
  2 2 2
  3 3 3
  6 6 6
}



finish_test