Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/ext/rbu/rbu9.test

Issue 2747283002: [sql] Import reference version of SQLite 3.17.. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # 2014 November 21
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 #
12 # Test RBU with virtual tables. And tables with no PRIMARY KEY declarations.
13 #
14
15 if {![info exists testdir]} {
16 set testdir [file join [file dirname [info script]] .. .. test]
17 }
18 source $testdir/tester.tcl
19 set ::testprefix rbu9
20
21 ifcapable !fts3 {
22 finish_test
23 return
24 }
25
26 do_execsql_test 1.1 {
27 CREATE VIRTUAL TABLE f1 USING fts4(a, b, c);
28 INSERT INTO f1(rowid, a, b, c) VALUES(11, 'a', 'b', 'c');
29 INSERT INTO f1(rowid, a, b, c) VALUES(12, 'd', 'e', 'f');
30 INSERT INTO f1(rowid, a, b, c) VALUES(13, 'g', 'h', 'i');
31 }
32
33 do_test 1.1 {
34 forcedelete rbu.db
35 sqlite3 db2 rbu.db
36 db2 eval {
37 CREATE TABLE data_f1(rbu_rowid, a, b, c, rbu_control);
38 INSERT INTO data_f1 VALUES(14, 'x', 'y', 'z', 0); -- INSERT
39 INSERT INTO data_f1 VALUES(11, NULL, NULL, NULL, 1); -- DELETE
40 INSERT INTO data_f1 VALUES(13, NULL, NULL, 'X', '..x'); -- UPDATE
41 }
42 db2 close
43 } {}
44
45 do_test 1.2.1 {
46 while 1 {
47 sqlite3rbu rbu test.db rbu.db
48 set rc [rbu step]
49 if {$rc != "SQLITE_OK"} break
50 rbu close
51 }
52 rbu close
53 } {SQLITE_DONE}
54
55 do_execsql_test 1.2.2 { SELECT rowid, * FROM f1 } {
56 12 d e f
57 13 g h X
58 14 x y z
59 }
60 do_execsql_test 1.2.3 { INSERT INTO f1(f1) VALUES('integrity-check') }
61 integrity_check 1.2.4
62
63 #-------------------------------------------------------------------------
64 # Tables with no PK declaration.
65 #
66
67 # Run the RBU in file $rbu on target database $target until completion.
68 #
69 proc run_rbu {target rbu} {
70 sqlite3rbu rbu $target $rbu
71 while { [rbu step]=="SQLITE_OK" } {}
72 rbu close
73 }
74
75 foreach {tn idx} {
76 1 { }
77 2 {
78 CREATE INDEX i1 ON t1(a);
79 }
80 3 {
81 CREATE INDEX i1 ON t1(b, c);
82 CREATE INDEX i2 ON t1(c, b);
83 CREATE INDEX i3 ON t1(a, a, a, b, b, b, c, c, c);
84 }
85 } {
86
87 reset_db
88 do_execsql_test 2.$tn.1 {
89 CREATE TABLE t1(a, b, c);
90 INSERT INTO t1 VALUES(1, 2, 3);
91 INSERT INTO t1 VALUES(4, 5, 6);
92 INSERT INTO t1(rowid, a, b, c) VALUES(-1, 'a', 'b', 'c');
93 INSERT INTO t1(rowid, a, b, c) VALUES(-2, 'd', 'e', 'f');
94 }
95
96 db eval $idx
97
98 do_test 2.$tn.2 {
99 forcedelete rbu.db
100 sqlite3 db2 rbu.db
101 db2 eval {
102 CREATE TABLE data_t1(rbu_rowid, a, b, c, rbu_control);
103 INSERT INTO data_t1 VALUES(3, 'x', 'y', 'z', 0);
104 INSERT INTO data_t1 VALUES(NULL, 'X', 'Y', 'Z', 0);
105 INSERT INTO data_t1 VALUES('1', NULL, NULL, NULL, 1);
106 INSERT INTO data_t1 VALUES(-2, NULL, NULL, 'fff', '..x');
107 }
108 db2 close
109 } {}
110
111 run_rbu test.db rbu.db
112
113 do_execsql_test 2.$tn.3 {
114 SELECT rowid, a, b, c FROM t1 ORDER BY rowid;
115 } {
116 -2 d e fff
117 -1 a b c
118 2 4 5 6
119 3 x y z
120 4 X Y Z
121 }
122
123 integrity_check 2.$tn.4
124 }
125
126
127 finish_test
128
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3170000/ext/rbu/rbu8.test ('k') | third_party/sqlite/sqlite-src-3170000/ext/rbu/rbuA.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698