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

Side by Side Diff: third_party/sqlite/src/test/trigger9.test

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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
1 # 2008 January 1 1 # 2008 January 1
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 14 matching lines...) Expand all
25 # in "INSTEAD OF" triggers have NULL values in unused 25 # in "INSTEAD OF" triggers have NULL values in unused
26 # fields. 26 # fields.
27 # 27 #
28 28
29 set testdir [file dirname $argv0] 29 set testdir [file dirname $argv0]
30 source $testdir/tester.tcl 30 source $testdir/tester.tcl
31 ifcapable {!trigger} { 31 ifcapable {!trigger} {
32 finish_test 32 finish_test
33 return 33 return
34 } 34 }
35 set ::testprefix trigger9
35 36
36 proc has_rowdata {sql} { 37 proc has_rowdata {sql} {
37 expr {[lsearch [execsql "explain $sql"] RowData]>=0} 38 expr {[lsearch [execsql "explain $sql"] RowData]>=0}
38 } 39 }
39 40
40 do_test trigger9-1.1 { 41 do_test trigger9-1.1 {
41 execsql { 42 execsql {
42 PRAGMA page_size = 1024; 43 PRAGMA page_size = 1024;
43 CREATE TABLE t1(x, y, z); 44 CREATE TABLE t1(x, y, z);
44 INSERT INTO t1 VALUES('1', randstr(10000,10000), '2'); 45 INSERT INTO t1 VALUES('1', randstr(10000,10000), '2');
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 CREATE TRIGGER trig1 INSTEAD OF UPDATE ON v1 BEGIN 214 CREATE TRIGGER trig1 INSTEAD OF UPDATE ON v1 BEGIN
214 INSERT INTO t2 VALUES(old.a); 215 INSERT INTO t2 VALUES(old.a);
215 END; 216 END;
216 UPDATE v1 SET b = 'hello'; 217 UPDATE v1 SET b = 'hello';
217 SELECT * FROM t2; 218 SELECT * FROM t2;
218 ROLLBACK; 219 ROLLBACK;
219 } 220 }
220 } {2} 221 } {2}
221 } 222 }
222 223
224 reset_db
225 do_execsql_test 4.1 {
226 CREATE TABLE t1(a, b);
227 CREATE TABLE log(x);
228 INSERT INTO t1 VALUES(1, 2);
229 INSERT INTO t1 VALUES(3, 4);
230 CREATE VIEW v1 AS SELECT a, b FROM t1;
231
232 CREATE TRIGGER tr1 INSTEAD OF DELETE ON v1 BEGIN
233 INSERT INTO log VALUES('delete');
234 END;
235
236 CREATE TRIGGER tr2 INSTEAD OF UPDATE ON v1 BEGIN
237 INSERT INTO log VALUES('update');
238 END;
239
240 CREATE TRIGGER tr3 INSTEAD OF INSERT ON v1 BEGIN
241 INSERT INTO log VALUES('insert');
242 END;
243 }
244
245 do_execsql_test 4.2 {
246 DELETE FROM v1 WHERE rowid=1;
247 } {}
248
249 do_execsql_test 4.3 {
250 UPDATE v1 SET a=b WHERE rowid=2;
251 } {}
252
253
254
255
223 finish_test 256 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698