OLD | NEW |
1 # 2007 March 24 | 1 # 2007 March 24 |
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 do_test exclusive-5.0 { | 413 do_test exclusive-5.0 { |
414 execsql { | 414 execsql { |
415 CREATE TABLE abc(a UNIQUE, b UNIQUE, c UNIQUE); | 415 CREATE TABLE abc(a UNIQUE, b UNIQUE, c UNIQUE); |
416 BEGIN; | 416 BEGIN; |
417 INSERT INTO abc VALUES(1, 2, 3); | 417 INSERT INTO abc VALUES(1, 2, 3); |
418 INSERT INTO abc SELECT a+1, b+1, c+1 FROM abc; | 418 INSERT INTO abc SELECT a+1, b+1, c+1 FROM abc; |
419 } | 419 } |
420 } {} | 420 } {} |
421 do_test exclusive-5.1 { | 421 do_test exclusive-5.1 { |
422 # Three files are open: The db, journal and statement-journal. | 422 # Three files are open: The db, journal and statement-journal. |
| 423 # (2016-03-04) The statement-journal is now opened lazily |
423 set sqlite_open_file_count | 424 set sqlite_open_file_count |
424 expr $sqlite_open_file_count-$extrafds | 425 expr $sqlite_open_file_count-$extrafds |
425 } [expr 3 - ($TEMP_STORE>=2)] | 426 } {2} |
426 do_test exclusive-5.2 { | 427 do_test exclusive-5.2 { |
427 execsql { | 428 execsql { |
428 COMMIT; | 429 COMMIT; |
429 } | 430 } |
430 # One file open: the db. | 431 # One file open: the db. |
431 set sqlite_open_file_count | 432 set sqlite_open_file_count |
432 expr $sqlite_open_file_count-$extrafds | 433 expr $sqlite_open_file_count-$extrafds |
433 } {1} | 434 } {1} |
434 do_test exclusive-5.3 { | 435 do_test exclusive-5.3 { |
435 execsql { | 436 execsql { |
436 PRAGMA locking_mode = exclusive; | 437 PRAGMA locking_mode = exclusive; |
437 BEGIN; | 438 BEGIN; |
438 INSERT INTO abc VALUES(5, 6, 7); | 439 INSERT INTO abc VALUES(5, 6, 7); |
439 } | 440 } |
440 # Two files open: the db and journal. | 441 # Two files open: the db and journal. |
441 set sqlite_open_file_count | 442 set sqlite_open_file_count |
442 expr $sqlite_open_file_count-$extrafds | 443 expr $sqlite_open_file_count-$extrafds |
443 } {2} | 444 } {2} |
444 do_test exclusive-5.4 { | 445 do_test exclusive-5.4 { |
445 execsql { | 446 execsql { |
446 INSERT INTO abc SELECT a+10, b+10, c+10 FROM abc; | 447 INSERT INTO abc SELECT a+10, b+10, c+10 FROM abc; |
447 } | 448 } |
448 # Three files are open: The db, journal and statement-journal. | 449 # Three files are open: The db, journal and statement-journal. |
| 450 # 2016-03-04: The statement-journal open is deferred |
449 set sqlite_open_file_count | 451 set sqlite_open_file_count |
450 expr $sqlite_open_file_count-$extrafds | 452 expr $sqlite_open_file_count-$extrafds |
451 } [expr 3 - ($TEMP_STORE>=2)] | 453 } {2} |
452 do_test exclusive-5.5 { | 454 do_test exclusive-5.5 { |
453 execsql { | 455 execsql { |
454 COMMIT; | 456 COMMIT; |
455 } | 457 } |
456 # Three files are still open: The db, journal and statement-journal. | 458 # Three files are still open: The db, journal and statement-journal. |
| 459 # 2016-03-04: The statement-journal open is deferred |
457 set sqlite_open_file_count | 460 set sqlite_open_file_count |
458 expr $sqlite_open_file_count-$extrafds | 461 expr $sqlite_open_file_count-$extrafds |
459 } [expr 3 - ($TEMP_STORE>=2)] | 462 } {2} |
460 do_test exclusive-5.6 { | 463 do_test exclusive-5.6 { |
461 execsql { | 464 execsql { |
462 PRAGMA locking_mode = normal; | 465 PRAGMA locking_mode = normal; |
463 SELECT * FROM abc; | 466 SELECT * FROM abc; |
464 } | 467 } |
465 } {normal 1 2 3 2 3 4 5 6 7 11 12 13 12 13 14 15 16 17} | 468 } {normal 1 2 3 2 3 4 5 6 7 11 12 13 12 13 14 15 16 17} |
466 do_test exclusive-5.7 { | 469 do_test exclusive-5.7 { |
467 # Just the db open. | 470 # Just the db open. |
468 set sqlite_open_file_count | 471 set sqlite_open_file_count |
469 expr $sqlite_open_file_count-$extrafds | 472 expr $sqlite_open_file_count-$extrafds |
(...skipping 29 matching lines...) Expand all Loading... |
499 close $fd | 502 close $fd |
500 sqlite3 db test.db | 503 sqlite3 db test.db |
501 } {} | 504 } {} |
502 | 505 |
503 do_execsql_test exclusive-6.5 { | 506 do_execsql_test exclusive-6.5 { |
504 PRAGMA locking_mode = EXCLUSIVE; | 507 PRAGMA locking_mode = EXCLUSIVE; |
505 SELECT * FROM sqlite_master; | 508 SELECT * FROM sqlite_master; |
506 } {exclusive} | 509 } {exclusive} |
507 | 510 |
508 finish_test | 511 finish_test |
OLD | NEW |