Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add tests for snapshot interfaces. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | serializable-snapshot |
Files: | files | file ages | folders |
SHA1: |
1f7ee7af7b620262ae663d65889b6a87 |
User & Date: | dan 2016-11-18 18:22:05.618 |
Context
2016-11-18
| ||
18:43 | Require that the database handle be in autocommit mode for sqlite3_snapshot_get() to succeed. This is because it may open a read transaction on the database file. (check-in: 83b658dad0 user: dan tags: serializable-snapshot) | |
18:22 | Add tests for snapshot interfaces. (check-in: 1f7ee7af7b user: dan tags: serializable-snapshot) | |
14:38 | Enhance existing snapshot tests to serialize/deserialize snapshots. No new tests. (check-in: 16b9bf9274 user: dan tags: serializable-snapshot) | |
Changes
Added test/snapshot2.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | # 2016 November 18 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The focus # of this file is the sqlite3_snapshot_xxx() APIs. # set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !snapshot {finish_test; return} set testprefix snapshot2 # This test does not work with the inmemory_journal permutation. The reason # is that each connection opened as part of this permutation executes # "PRAGMA journal_mode=memory", which fails if the database is in wal mode # and there are one or more existing connections. if {[permutation]=="inmemory_journal"} { finish_test return } #------------------------------------------------------------------------- # Check that it is not possible to obtain a snapshot immediately after # a wal mode database with an empty wal file is opened. But it is after # the file has been written, even by some other connection. # do_execsql_test 1.0 { PRAGMA journal_mode = wal; CREATE TABLE t1(a, b, c); INSERT INTO t1 VALUES(1, 2, 3); INSERT INTO t1 VALUES(4, 5, 6); } {wal} db close do_test 1.1.1 { list [file exists test.db] [file exists test.db-wal] } {1 0} sqlite3 db test.db do_execsql_test 1.1.2 { SELECT * FROM t1 } {1 2 3 4 5 6} do_test 1.1.3 { execsql BEGIN list [catch { sqlite3_snapshot_get_blob db main } msg] $msg } {1 SQLITE_ERROR} execsql COMMIT do_test 1.1.4 { execsql { INSERT INTO t1 VALUES(7, 8, 9) } execsql BEGIN string length [sqlite3_snapshot_get_blob db main] } 48 execsql COMMIT db close do_test 1.2.1 { list [file exists test.db] [file exists test.db-wal] } {1 0} sqlite3 db test.db do_execsql_test 1.2.2 { SELECT * FROM t1 } {1 2 3 4 5 6 7 8 9} do_test 1.2.3 { execsql BEGIN list [catch { sqlite3_snapshot_get_blob db main } msg] $msg } {1 SQLITE_ERROR} execsql COMMIT do_test 1.2.4 { sqlite3 db2 test.db execsql { INSERT INTO t1 VALUES(10, 11, 12) } db2 execsql BEGIN string length [sqlite3_snapshot_get_blob db main] } 48 execsql COMMIT db2 close finish_test |