Annotation of embedaddon/sqlite3/test/wal6.test, revision 1.1

1.1     ! misho       1: # 2010 December 1
        !             2: #
        !             3: # The author disclaims copyright to this source code.  In place of
        !             4: # a legal notice, here is a blessing:
        !             5: #
        !             6: #    May you do good and not evil.
        !             7: #    May you find forgiveness for yourself and forgive others.
        !             8: #    May you share freely, never taking more than you give.
        !             9: #
        !            10: #***********************************************************************
        !            11: # This file implements regression tests for SQLite library.  The
        !            12: # focus of this file is testing the operation of the library in
        !            13: # "PRAGMA journal_mode=WAL" mode.
        !            14: #
        !            15: 
        !            16: set testdir [file dirname $argv0]
        !            17: source $testdir/tester.tcl
        !            18: source $testdir/lock_common.tcl
        !            19: source $testdir/wal_common.tcl
        !            20: source $testdir/malloc_common.tcl
        !            21: ifcapable !wal {finish_test ; return }
        !            22: 
        !            23: #-------------------------------------------------------------------------
        !            24: # Changing to WAL mode in one connection forces the change in others.
        !            25: #
        !            26: db close
        !            27: forcedelete test.db
        !            28: 
        !            29: set all_journal_modes {delete persist truncate memory off}
        !            30: foreach jmode $all_journal_modes {
        !            31: 
        !            32:        do_test wal6-1.0.$jmode {
        !            33:     sqlite3 db test.db
        !            34:     execsql "PRAGMA journal_mode = $jmode;"
        !            35:        } $jmode
        !            36: 
        !            37:        do_test wal6-1.1.$jmode {
        !            38:          execsql {
        !            39:            CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
        !            40:            INSERT INTO t1 VALUES(1,2);
        !            41:            SELECT * FROM t1;
        !            42:          }
        !            43:        } {1 2}
        !            44: 
        !            45: # Under Windows, you'll get an error trying to delete
        !            46: # a file this is already opened.  Close the first connection
        !            47: # so the other tests work.
        !            48: if {$tcl_platform(platform)=="windows"} {
        !            49:   if {$jmode=="persist" || $jmode=="truncate"} {
        !            50:     db close
        !            51:   }
        !            52: }
        !            53: 
        !            54:        do_test wal6-1.2.$jmode {
        !            55:          sqlite3 db2 test.db
        !            56:          execsql {
        !            57:                PRAGMA journal_mode=WAL;
        !            58:                INSERT INTO t1 VALUES(3,4);
        !            59:                SELECT * FROM t1 ORDER BY a;
        !            60:          } db2
        !            61:        } {wal 1 2 3 4}
        !            62: 
        !            63: if {$tcl_platform(platform)=="windows"} {
        !            64:   if {$jmode=="persist" || $jmode=="truncate"} {
        !            65:          sqlite3 db test.db
        !            66:   }
        !            67: }
        !            68: 
        !            69:        do_test wal6-1.3.$jmode {
        !            70:          execsql {
        !            71:                  SELECT * FROM t1 ORDER BY a;
        !            72:          }
        !            73:        } {1 2 3 4}
        !            74: 
        !            75:        db close
        !            76:        db2 close
        !            77:   forcedelete test.db
        !            78: 
        !            79: }
        !            80: 
        !            81: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>