OLD | NEW |
1 # 2008 April 17 | 1 # 2008 April 17 |
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 execsql { | 125 execsql { |
126 PRAGMA main.journal_mode; | 126 PRAGMA main.journal_mode; |
127 PRAGMA temp.journal_mode; | 127 PRAGMA temp.journal_mode; |
128 PRAGMA aux1.journal_mode; | 128 PRAGMA aux1.journal_mode; |
129 } | 129 } |
130 } [list off [temp_journal_mode persist] memory] | 130 } [list off [temp_journal_mode persist] memory] |
131 do_test jrnlmode-1.11 { | 131 do_test jrnlmode-1.11 { |
132 execsql { | 132 execsql { |
133 PRAGMA journal_mode; | 133 PRAGMA journal_mode; |
134 } | 134 } |
135 } {persist} | 135 } {off} |
136 do_test jrnlmode-1.12 { | 136 do_test jrnlmode-1.12 { |
137 execsql { | 137 execsql { |
138 ATTACH ':memory:' as aux2; | 138 ATTACH ':memory:' as aux2; |
139 } | 139 } |
140 execsql { | 140 execsql { |
141 PRAGMA main.journal_mode; | 141 PRAGMA main.journal_mode; |
142 PRAGMA aux1.journal_mode; | 142 PRAGMA aux1.journal_mode; |
143 PRAGMA aux2.journal_mode; | 143 PRAGMA aux2.journal_mode; |
144 } | 144 } |
145 } {off memory memory} | 145 } {off memory memory} |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 execsql {pragma page_size=1024} | 310 execsql {pragma page_size=1024} |
311 execsql {pragma journal_mode=persist} | 311 execsql {pragma journal_mode=persist} |
312 } {persist} | 312 } {persist} |
313 | 313 |
314 do_test jrnlmode-5.2 { | 314 do_test jrnlmode-5.2 { |
315 execsql { PRAGMA journal_size_limit } | 315 execsql { PRAGMA journal_size_limit } |
316 } {-1} | 316 } {-1} |
317 do_test jrnlmode-5.3 { | 317 do_test jrnlmode-5.3 { |
318 execsql { | 318 execsql { |
319 ATTACH 'test2.db' AS aux; | 319 ATTACH 'test2.db' AS aux; |
| 320 PRAGMA aux.journal_mode=persist; |
320 PRAGMA aux.journal_size_limit; | 321 PRAGMA aux.journal_size_limit; |
321 } | 322 } |
322 } {-1} | 323 } {persist -1} |
323 do_test jrnlmode-5.4.1 { | 324 do_test jrnlmode-5.4.1 { |
324 execsql { PRAGMA aux.journal_size_limit = 999999999999 } | 325 execsql { PRAGMA aux.journal_size_limit = 999999999999 } |
325 } {999999999999} | 326 } {999999999999} |
326 do_test jrnlmode-5.4.2 { | 327 do_test jrnlmode-5.4.2 { |
327 execsql { PRAGMA aux.journal_size_limit = 10240 } | 328 execsql { PRAGMA aux.journal_size_limit = 10240 } |
328 } {10240} | 329 } {10240} |
329 do_test jrnlmode-5.5 { | 330 do_test jrnlmode-5.5 { |
330 execsql { PRAGMA main.journal_size_limit = 20480 } | 331 execsql { PRAGMA main.journal_size_limit = 20480 } |
331 } {20480} | 332 } {20480} |
332 do_test jrnlmode-5.6 { | 333 do_test jrnlmode-5.6 { |
333 execsql { PRAGMA journal_size_limit } | 334 execsql { PRAGMA journal_size_limit } |
334 } {20480} | 335 } {20480} |
335 do_test jrnlmode-5.7 { | 336 do_test jrnlmode-5.7 { |
336 execsql { PRAGMA aux.journal_size_limit } | 337 execsql { PRAGMA aux.journal_size_limit } |
337 } {10240} | 338 } {10240} |
338 | 339 |
339 do_test jrnlmode-5.8 { | 340 do_test jrnlmode-5.8 { |
340 execsql { ATTACH 'test3.db' AS aux2 } | 341 execsql { |
341 } {} | 342 ATTACH 'test3.db' AS aux2; |
| 343 PRAGMA aux2.journal_mode=persist; |
| 344 } |
| 345 } {persist} |
342 | 346 |
343 do_test jrnlmode-5.9 { | 347 do_test jrnlmode-5.9 { |
344 execsql { | 348 execsql { |
345 CREATE TABLE main.t1(a, b, c); | 349 CREATE TABLE main.t1(a, b, c); |
346 CREATE TABLE aux.t2(a, b, c); | 350 CREATE TABLE aux.t2(a, b, c); |
347 CREATE TABLE aux2.t3(a, b, c); | 351 CREATE TABLE aux2.t3(a, b, c); |
348 } | 352 } |
349 } {} | 353 } {} |
350 do_test jrnlmode-5.10 { | 354 do_test jrnlmode-5.10 { |
351 list \ | 355 list \ |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } {1} | 451 } {1} |
448 do_test jrnlmode-5.22 { | 452 do_test jrnlmode-5.22 { |
449 execsql COMMIT | 453 execsql COMMIT |
450 list [file exists test.db-journal] [file size test.db-journal] | 454 list [file exists test.db-journal] [file size test.db-journal] |
451 } {1 0} | 455 } {1 0} |
452 } | 456 } |
453 | 457 |
454 ifcapable pragma { | 458 ifcapable pragma { |
455 # These tests are not run as part of the "journaltest" permutation, | 459 # These tests are not run as part of the "journaltest" permutation, |
456 # as the test_journal.c layer is incompatible with in-memory journaling. | 460 # as the test_journal.c layer is incompatible with in-memory journaling. |
457 if {[catch {set ::permutations_test_prefix} z] || $z ne "journaltest"} { | 461 if {[permutation] ne "journaltest"} { |
458 | 462 |
459 do_test jrnlmode-6.1 { | 463 do_test jrnlmode-6.1 { |
460 execsql { | 464 execsql { |
461 PRAGMA journal_mode = truncate; | 465 PRAGMA journal_mode = truncate; |
462 CREATE TABLE t4(a, b); | 466 CREATE TABLE t4(a, b); |
463 BEGIN; | 467 BEGIN; |
464 INSERT INTO t4 VALUES(1, 2); | 468 INSERT INTO t4 VALUES(1, 2); |
465 PRAGMA journal_mode = memory; | 469 PRAGMA journal_mode = memory; |
466 } | 470 } |
467 } {truncate truncate} | 471 } {truncate truncate} |
468 do_test jrnlmode-6.2 { | 472 do_test jrnlmode-6.2 { |
469 file exists test.db-journal | 473 file exists test.db-journal |
470 } {1} | 474 } {1} |
471 do_test jrnlmode-6.3 { | 475 do_test jrnlmode-6.3 { |
472 execsql { | 476 execsql { |
473 COMMIT; | 477 COMMIT; |
474 SELECT * FROM t4; | 478 SELECT * FROM t4; |
475 } | 479 } |
476 } {1 2} | 480 } {1 2} |
477 do_test jrnlmode-6.4 { | 481 do_test jrnlmode-6.4 { |
478 file exists test.db-journal | 482 file exists test.db-journal |
479 } {1} | 483 } {1} |
480 do_test jrnlmode-6.5 { | 484 do_test jrnlmode-6.5 { |
481 execsql { | 485 execsql { |
482 PRAGMA journal_mode = MEMORY; | 486 PRAGMA journal_mode = MEMORY; |
483 BEGIN; | 487 BEGIN; |
484 INSERT INTO t4 VALUES(3, 4); | 488 INSERT INTO t4 VALUES(3, 4); |
485 } | 489 } |
486 file exists test.db-journal | 490 file exists test.db-journal |
487 } {1} | 491 } {0} |
488 do_test jrnlmode-6.7 { | 492 do_test jrnlmode-6.7 { |
489 execsql { | 493 execsql { |
490 COMMIT; | 494 COMMIT; |
491 SELECT * FROM t4; | 495 SELECT * FROM t4; |
492 } | 496 } |
493 } {1 2 3 4} | 497 } {1 2 3 4} |
494 do_test jrnlmode-6.8 { | 498 do_test jrnlmode-6.8 { |
495 file exists test.db-journal | 499 file exists test.db-journal |
496 } {1} | 500 } {0} |
497 do_test jrnlmode-6.9 { | 501 do_test jrnlmode-6.9 { |
498 execsql { | 502 execsql { |
499 PRAGMA journal_mode = DELETE; | 503 PRAGMA journal_mode = DELETE; |
500 BEGIN IMMEDIATE; COMMIT; | 504 BEGIN IMMEDIATE; INSERT INTO t4 VALUES(1,2); COMMIT; |
501 } | 505 } |
502 file exists test.db-journal | 506 file exists test.db-journal |
503 } {0} | 507 } {0} |
504 } | 508 } |
505 } | 509 } |
506 | 510 |
| 511 ifcapable pragma { |
| 512 catch { db close } |
| 513 do_test jrnlmode-7.1 { |
| 514 foreach f [glob -nocomplain test.db*] { file delete -force $f } |
| 515 sqlite3 db test.db |
| 516 execsql { |
| 517 PRAGMA journal_mode = memory; |
| 518 PRAGMA auto_vacuum = 0; |
| 519 PRAGMA page_size = 1024; |
| 520 PRAGMA user_version = 5; |
| 521 PRAGMA user_version; |
| 522 } |
| 523 } {memory 5} |
| 524 do_test jrnlmode-7.2 { file size test.db } {1024} |
| 525 } |
| 526 |
| 527 do_execsql_test jrnlmode-8.1 { PRAGMA locking_mode=EXCLUSIVE } {exclusive} |
| 528 do_execsql_test jrnlmode-8.2 { CREATE TABLE t1(x) } {} |
| 529 do_execsql_test jrnlmode-8.3 { INSERT INTO t1 VALUES(123) } {} |
| 530 do_execsql_test jrnlmode-8.4 { SELECT * FROM t1 } {123} |
| 531 do_execsql_test jrnlmode-8.5 { PRAGMA journal_mode=PERSIST } {persist} |
| 532 do_execsql_test jrnlmode-8.6 { PRAGMA journal_mode=DELETE } {delete} |
| 533 do_execsql_test jrnlmode-8.7 { PRAGMA journal_mode=TRUNCATE } {truncate} |
| 534 do_execsql_test jrnlmode-8.8 { PRAGMA journal_mode=DELETE } {delete} |
| 535 do_execsql_test jrnlmode-8.9 { CREATE TABLE t2(y) } {} |
| 536 do_execsql_test jrnlmode-8.10 { INSERT INTO t2 VALUES(456) } {} |
| 537 do_execsql_test jrnlmode-8.11 { SELECT * FROM t1, t2 } {123 456} |
| 538 do_execsql_test jrnlmode-8.12 { PRAGMA locking_mode=NORMAL } {normal} |
| 539 do_execsql_test jrnlmode-8.13 { PRAGMA journal_mode=PERSIST } {persist} |
| 540 do_execsql_test jrnlmode-8.14 { PRAGMA journal_mode=TRUNCATE } {truncate} |
| 541 do_execsql_test jrnlmode-8.15 { PRAGMA journal_mode=PERSIST } {persist} |
| 542 do_execsql_test jrnlmode-8.16 { PRAGMA journal_mode=DELETE } {delete} |
| 543 do_execsql_test jrnlmode-8.17 { PRAGMA journal_mode=TRUNCATE } {truncate} |
| 544 do_execsql_test jrnlmode-8.18 { PRAGMA locking_mode=EXCLUSIVE } {exclusive} |
| 545 do_execsql_test jrnlmode-8.19 { CREATE TABLE t3(z) } {} |
| 546 do_execsql_test jrnlmode-8.20 { BEGIN IMMEDIATE } {} |
| 547 do_execsql_test jrnlmode-8.21 { PRAGMA journal_mode=DELETE } {delete} |
| 548 do_execsql_test jrnlmode-8.22 { COMMIT } {} |
| 549 do_execsql_test jrnlmode-8.23 { PRAGMA journal_mode=DELETE } {delete} |
| 550 do_execsql_test jrnlmode-8.24 { PRAGMA journal_mode=TRUNCATE } {truncate} |
| 551 do_execsql_test jrnlmode-8.25 { PRAGMA locking_mode=NORMAL } {normal} |
| 552 do_execsql_test jrnlmode-8.26 { CREATE TABLE t4(w) } {} |
| 553 do_execsql_test jrnlmode-8.27 { BEGIN IMMEDIATE } {} |
| 554 do_execsql_test jrnlmode-8.28 { PRAGMA journal_mode=DELETE } {delete} |
| 555 do_execsql_test jrnlmode-8.29 { COMMIT } {} |
| 556 do_execsql_test jrnlmode-8.30 { PRAGMA journal_mode=DELETE } {delete} |
| 557 |
507 finish_test | 558 finish_test |
OLD | NEW |