/ Check-in [c5fb7d6a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Adding test cases for the "PRAGMA data_version" command.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | data_version_pragma
Files: files | file ages | folders
SHA1:c5fb7d6a106d46f10e71abe3a6d4243b21ed02a5
User & Date: drh 2014-12-19 20:27:02
Context
2014-12-20
14:34
Update the PRAGMA data_version command so that it reponse to changes made by a shared-cache database connection, and also to changes made by the same database connection. Add test cases to verify the new behavior. Closed-Leaf check-in: 44ee5383 user: drh tags: data_version_pragma
2014-12-19
20:27
Adding test cases for the "PRAGMA data_version" command. check-in: c5fb7d6a user: drh tags: data_version_pragma
19:28
Experimental "PRAGMA data_version" command for detecting when another process has changed the database file. check-in: 43db1f44 user: drh tags: data_version_pragma
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added test/pragma3.test.

            1  +# 2014-12-19
            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.
           12  +#
           13  +# This file implements tests for PRAGMA data_version command.
           14  +#
           15  +
           16  +set testdir [file dirname $argv0]
           17  +source $testdir/tester.tcl
           18  +
           19  +do_execsql_test pragma3-100 {
           20  +  PRAGMA data_version;
           21  +} {1}
           22  +do_execsql_test pragma3-101 {
           23  +  PRAGMA temp.data_version;
           24  +} {1}
           25  +
           26  +# Writing is a no-op 
           27  +do_execsql_test pragma3-102 {
           28  +  PRAGMA main.data_version=1234;
           29  +  PRAGMA main.data_version;
           30  +} {1 1}
           31  +
           32  +do_execsql_test pragma3-110 {
           33  +  CREATE TABLE t1(a);
           34  +  INSERT INTO t1 VALUES(100),(200),(300);
           35  +  SELECT * FROM t1;
           36  +  PRAGMA data_version;
           37  +} {100 200 300 1}
           38  +
           39  +sqlite3 db2 test.db
           40  +do_test pragma3-120 {
           41  +  db2 eval {
           42  +    SELECT * FROM t1;
           43  +    PRAGMA data_version;
           44  +  }
           45  +} {100 200 300 1}
           46  +
           47  +do_execsql_test pragma3-130 {
           48  +  INSERT INTO t1 VALUES(400),(500);
           49  +  SELECT * FROM t1;
           50  +  PRAGMA data_version;
           51  +} {100 200 300 400 500 1}
           52  +
           53  +do_test pragma3-140 {
           54  +  db2 eval {
           55  +    SELECT * FROM t1;
           56  +    PRAGMA data_version;
           57  +    UPDATE t1 SET a=a+1;
           58  +    SELECT * FROM t1;
           59  +    PRAGMA data_version;
           60  +  }
           61  +} {100 200 300 400 500 2 101 201 301 401 501 2}
           62  +
           63  +do_execsql_test pragma3-150 {
           64  +  SELECT * FROM t1;
           65  +  PRAGMA data_version;
           66  +} {101 201 301 401 501 2}
           67  +
           68  +
           69  +db2 close
           70  +finish_test