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

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

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « third_party/sqlite/src/test/e_totalchanges.test ('k') | third_party/sqlite/src/test/e_uri.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2010 September 20 1 # 2010 September 20
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 INSERT INTO main.t1 VALUES(3, 'iii'); 139 INSERT INTO main.t1 VALUES(3, 'iii');
140 } {} 140 } {}
141 do_update_tests e_update-1.2 { 141 do_update_tests e_update-1.2 {
142 1 "UPDATE t1 SET b = 'roman' ; SELECT * FROM t1" 142 1 "UPDATE t1 SET b = 'roman' ; SELECT * FROM t1"
143 {1 roman 2 roman 3 roman} 143 {1 roman 2 roman 3 roman}
144 144
145 2 "UPDATE t1 SET a = 'greek' ; SELECT * FROM t1" 145 2 "UPDATE t1 SET a = 'greek' ; SELECT * FROM t1"
146 {greek roman greek roman greek roman} 146 {greek roman greek roman greek roman}
147 } 147 }
148 148
149 # EVIDENCE-OF: R-42117-40023 Otherwise, the UPDATE affects only those 149 # EVIDENCE-OF: R-58095-46013 Otherwise, the UPDATE affects only those
150 # rows for which the result of evaluating the WHERE clause expression as 150 # rows for which the WHERE clause boolean expression is true.
151 # a boolean expression is true.
152 # 151 #
153 do_execsql_test e_update-1.3.0 { 152 do_execsql_test e_update-1.3.0 {
154 DELETE FROM main.t1; 153 DELETE FROM main.t1;
155 INSERT INTO main.t1 VALUES(NULL, ''); 154 INSERT INTO main.t1 VALUES(NULL, '');
156 INSERT INTO main.t1 VALUES(1, 'i'); 155 INSERT INTO main.t1 VALUES(1, 'i');
157 INSERT INTO main.t1 VALUES(2, 'ii'); 156 INSERT INTO main.t1 VALUES(2, 'ii');
158 INSERT INTO main.t1 VALUES(3, 'iii'); 157 INSERT INTO main.t1 VALUES(3, 'iii');
159 } {} 158 } {}
160 do_update_tests e_update-1.3 { 159 do_update_tests e_update-1.3 {
161 1 "UPDATE t1 SET b = 'roman' WHERE a<2 ; SELECT * FROM t1" 160 1 "UPDATE t1 SET b = 'roman' WHERE a<2 ; SELECT * FROM t1"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 INSERT INTO t2(rowid, a, b, c) VALUES(3, 2, 6, 5); 257 INSERT INTO t2(rowid, a, b, c) VALUES(3, 2, 6, 5);
259 } {} 258 } {}
260 do_update_tests e_update-1.7 -query { 259 do_update_tests e_update-1.7 -query {
261 SELECT * FROM t2 260 SELECT * FROM t2
262 } { 261 } {
263 1 "UPDATE t2 SET a=b+c" {5 1 4 14 5 9 11 6 5} 262 1 "UPDATE t2 SET a=b+c" {5 1 4 14 5 9 11 6 5}
264 2 "UPDATE t2 SET a=b, b=a" {1 5 4 5 14 9 6 11 5} 263 2 "UPDATE t2 SET a=b, b=a" {1 5 4 5 14 9 6 11 5}
265 3 "UPDATE t2 SET a=c||c, c=NULL" {44 5 {} 99 14 {} 55 11 {}} 264 3 "UPDATE t2 SET a=c||c, c=NULL" {44 5 {} 99 14 {} 55 11 {}}
266 } 265 }
267 266
268 # EVIDENCE-OF: R-12619-24112 The optional conflict-clause allows the 267 # EVIDENCE-OF: R-28518-13457 The optional "OR action" conflict clause
269 # user to nominate a specific constraint conflict resolution algorithm 268 # that follows the UPDATE keyword allows the user to nominate a specific
270 # to use during this one UPDATE command. 269 # constraint conflict resolution algorithm to use during this one UPDATE
270 # command.
271 # 271 #
272 do_execsql_test e_update-1.8.0 { 272 do_execsql_test e_update-1.8.0 {
273 DELETE FROM t3; 273 DELETE FROM t3;
274 INSERT INTO t3 VALUES(1, 'one'); 274 INSERT INTO t3 VALUES(1, 'one');
275 INSERT INTO t3 VALUES(2, 'two'); 275 INSERT INTO t3 VALUES(2, 'two');
276 INSERT INTO t3 VALUES(3, 'three'); 276 INSERT INTO t3 VALUES(3, 'three');
277 INSERT INTO t3 VALUES(4, 'four'); 277 INSERT INTO t3 VALUES(4, 'four');
278 } {} 278 } {}
279 foreach {tn sql error ac data } { 279 foreach {tn sql error ac data } {
280 1 "UPDATE t3 SET b='one' WHERE a=3" 280 1 "UPDATE t3 SET b='one' WHERE a=3"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 do_catchsql_test e_update-1.8.$tn.1 $sql [list [expr {$error!=""}] $error] 315 do_catchsql_test e_update-1.8.$tn.1 $sql [list [expr {$error!=""}] $error]
316 do_execsql_test e_update-1.8.$tn.2 {SELECT * FROM t3} [list {*}$data] 316 do_execsql_test e_update-1.8.$tn.2 {SELECT * FROM t3} [list {*}$data]
317 do_test e_update-1.8.$tn.3 {sqlite3_get_autocommit db} $ac 317 do_test e_update-1.8.$tn.3 {sqlite3_get_autocommit db} $ac
318 } 318 }
319 319
320 320
321 321
322 # EVIDENCE-OF: R-12123-54095 The table-name specified as part of an 322 # EVIDENCE-OF: R-12123-54095 The table-name specified as part of an
323 # UPDATE statement within a trigger body must be unqualified. 323 # UPDATE statement within a trigger body must be unqualified.
324 # 324 #
325 # EVIDENCE-OF: R-09690-36749 In other words, the database-name. prefix 325 # EVIDENCE-OF: R-43190-62442 In other words, the schema-name. prefix on
326 # on the table name of the UPDATE is not allowed within triggers. 326 # the table name of the UPDATE is not allowed within triggers.
327 # 327 #
328 do_update_tests e_update-2.1 -error { 328 do_update_tests e_update-2.1 -error {
329 qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers 329 qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers
330 } { 330 } {
331 1 { 331 1 {
332 CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN 332 CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
333 UPDATE main.t2 SET a=1, b=2, c=3; 333 UPDATE main.t2 SET a=1, b=2, c=3;
334 END; 334 END;
335 } {} 335 } {}
336 336
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 1 "UPDATE t7 SET s = q ORDER BY r LIMIT -1" {1 2 3 4 5 6 7 8 9 10} 596 1 "UPDATE t7 SET s = q ORDER BY r LIMIT -1" {1 2 3 4 5 6 7 8 9 10}
597 2 "UPDATE t7 SET s = q ORDER BY r ASC LIMIT -1" {1 2 3 4 5 6 7 8 9 10} 597 2 "UPDATE t7 SET s = q ORDER BY r ASC LIMIT -1" {1 2 3 4 5 6 7 8 9 10}
598 3 "UPDATE t7 SET s = q ORDER BY r DESC LIMIT -1" {1 2 3 4 5 6 7 8 9 10} 598 3 "UPDATE t7 SET s = q ORDER BY r DESC LIMIT -1" {1 2 3 4 5 6 7 8 9 10}
599 4 "UPDATE t7 SET s = q ORDER BY q DESC LIMIT 5" {6 7 8 9 10} 599 4 "UPDATE t7 SET s = q ORDER BY q DESC LIMIT 5" {6 7 8 9 10}
600 } 600 }
601 601
602 602
603 } ;# ifcapable update_delete_limit 603 } ;# ifcapable update_delete_limit
604 604
605 finish_test 605 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/e_totalchanges.test ('k') | third_party/sqlite/src/test/e_uri.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698