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

Side by Side Diff: third_party/sqlite/src/test/delete.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 # 2001 September 15 1 # 2001 September 15
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 # from a read-only database. Ticket #304. 268 # from a read-only database. Ticket #304.
269 # 269 #
270 do_test delete-8.0 { 270 do_test delete-8.0 {
271 execsql { 271 execsql {
272 PRAGMA count_changes=OFF; 272 PRAGMA count_changes=OFF;
273 INSERT INTO t3 VALUES(123); 273 INSERT INTO t3 VALUES(123);
274 SELECT * FROM t3; 274 SELECT * FROM t3;
275 } 275 }
276 } {123} 276 } {123}
277 db close 277 db close
278 catch {file delete -force test.db-journal} 278 catch {forcedelete test.db-journal}
279 catch {file attributes test.db -permissions 0444} 279 catch {file attributes test.db -permissions 0444}
280 catch {file attributes test.db -readonly 1} 280 catch {file attributes test.db -readonly 1}
281 sqlite3 db test.db 281 sqlite3 db test.db
282 set ::DB [sqlite3_connection_pointer db] 282 set ::DB [sqlite3_connection_pointer db]
283 do_test delete-8.1 { 283 do_test delete-8.1 {
284 catchsql { 284 catchsql {
285 DELETE FROM t3; 285 DELETE FROM t3;
286 } 286 }
287 } {1 {attempt to write a readonly database}} 287 } {1 {attempt to write a readonly database}}
288 do_test delete-8.2 { 288 do_test delete-8.2 {
(...skipping 16 matching lines...) Expand all
305 DELETE FROM t3 WHERE a<100; 305 DELETE FROM t3 WHERE a<100;
306 } 306 }
307 # v2 result: {0 {}} 307 # v2 result: {0 {}}
308 } {1 {attempt to write a readonly database}} 308 } {1 {attempt to write a readonly database}}
309 do_test delete-8.6 { 309 do_test delete-8.6 {
310 execsql {SELECT * FROM t3} 310 execsql {SELECT * FROM t3}
311 } {123} 311 } {123}
312 integrity_check delete-8.7 312 integrity_check delete-8.7
313 313
314 # Need to do the following for tcl 8.5 on mac. On that configuration, the 314 # Need to do the following for tcl 8.5 on mac. On that configuration, the
315 # -readonly flag is taken so seriously that a subsequent [file delete -force] 315 # -readonly flag is taken so seriously that a subsequent [forcedelete]
316 # (required before the next test file can be executed) will fail. 316 # (required before the next test file can be executed) will fail.
317 # 317 #
318 catch {file attributes test.db -readonly 0} 318 catch {file attributes test.db -readonly 0}
319 db close 319 db close
320 file delete -force test.db test.db-journal 320 forcedelete test.db test.db-journal
321 321
322 # The following tests verify that SQLite correctly handles the case 322 # The following tests verify that SQLite correctly handles the case
323 # where an index B-Tree is being scanned, the rowid column being read 323 # where an index B-Tree is being scanned, the rowid column being read
324 # from each index entry and another statement deletes some rows from 324 # from each index entry and another statement deletes some rows from
325 # the index B-Tree. At one point this (obscure) scenario was causing 325 # the index B-Tree. At one point this (obscure) scenario was causing
326 # SQLite to return spurious SQLITE_CORRUPT errors and arguably incorrect 326 # SQLite to return spurious SQLITE_CORRUPT errors and arguably incorrect
327 # query results. 327 # query results.
328 # 328 #
329 do_test delete-9.1 { 329 do_test delete-9.1 {
330 sqlite3 db test.db 330 sqlite3 db test.db
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 set res [list] 385 set res [list]
386 db eval { SELECT t5.rowid AS r, c, d FROM t5, t6 ORDER BY a } { 386 db eval { SELECT t5.rowid AS r, c, d FROM t5, t6 ORDER BY a } {
387 if {$r==2} { db eval { DELETE FROM t5 WHERE rowid = 3 } } 387 if {$r==2} { db eval { DELETE FROM t5 WHERE rowid = 3 } }
388 lappend res $r $c $d 388 lappend res $r $c $d
389 } 389 }
390 set res 390 set res
391 } {1 a b 1 c d 2 a b 2 c d} 391 } {1 a b 1 c d 2 a b 2 c d}
392 392
393 393
394 finish_test 394 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698