-C Adding\stest\scases\sfor\sthe\s"PRAGMA\sdata_version"\scommand.
-D 2014-12-19T20:27:02.112
+C Update\sthe\sPRAGMA\sdata_version\scommand\sso\sthat\sit\sreponse\sto\schanges\smade\nby\sa\sshared-cache\sdatabase\sconnection,\sand\salso\sto\schanges\smade\sby\sthe\ssame\ndatabase\sconnection.\s\sAdd\stest\scases\sto\sverify\sthe\snew\sbehavior.
+D 2014-12-20T14:34:02.508
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 6c4f961fa91d0b4fa121946a19f9e5eac2f2f809
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/os_unix.c fb587121840f690101336879adfa6d0b2cd0e8c7
F src/os_win.c ecb04a0dad2fa6fa659931a9d8f0f3aca33f908a
F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21
-F src/pager.c abe022cd72e112a05db5fd1d6d46f5ed93284247
+F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb
F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77
F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45
F src/pcache.c ace1b67632deeaa84859b4c16c27711dfb7db3d4
F test/permutations.test 4e12d43f4639ea8a0e366d9c64e0009afe2eb544
F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5
F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13
-F test/pragma3.test 117ef9768f6c8d11823de7bbe3231b35c426b013
+F test/pragma3.test af097524ab7fdac11d3a37a5bab4f947f2d5d16c
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a
F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 43db1f44bce5a0ee50197b95ab0d844540b69d86
-R 2feb9c2cda6af5a5f57185acec7e4041
+P c5fb7d6a106d46f10e71abe3a6d4243b21ed02a5
+R 4d00079d15bfd5a1a2ef4485d7808f56
U drh
-Z 8c3ff0ee7ae569dc5dbcf90ed4307270
+Z 7090cd431f3e847d9d9c987c1e3b054c
sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */
PagerSavepoint *aSavepoint; /* Array of active savepoints */
int nSavepoint; /* Number of elements in aSavepoint[] */
- u32 nReset; /* Number of calls to pager_reset() */
+ u32 iDataVersion; /* Changes whenever database content changes */
char dbFileVers[16]; /* Changes whenever database file changes */
int nMmapOut; /* Number of mmap pages currently outstanding */
** Discard the entire contents of the in-memory page-cache.
*/
static void pager_reset(Pager *pPager){
- pPager->nReset++;
+ pPager->iDataVersion++;
sqlite3BackupRestart(pPager->pBackup);
sqlite3PcacheClear(pPager->pPCache);
}
/*
-** Return the pPager->nReset value
+** Return the pPager->iDataVersion value
*/
u32 sqlite3PagerDataVersion(Pager *pPager){
assert( pPager->eState>PAGER_OPEN );
- return pPager->nReset;
+ return pPager->iDataVersion;
}
/*
}
PAGERTRACE(("COMMIT %d\n", PAGERID(pPager)));
+ pPager->iDataVersion++;
rc = pager_end_transaction(pPager, pPager->setMaster, 1);
return pager_error(pPager, rc);
}
PRAGMA temp.data_version;
} {1}
-# Writing is a no-op
+# Writing to the pragma is a no-op
do_execsql_test pragma3-102 {
PRAGMA main.data_version=1234;
PRAGMA main.data_version;
} {1 1}
+# EVIDENCE-OF: R-27726-60934 The "PRAGMA data_version" command provides
+# an indication that the database file has been modified.
+#
+# EVIDENCE-OF: R-30058-27547 The integer values returned by two
+# invocations of "PRAGMA data_version" will be different if changes
+# where committed to that database in between the two invocations.
+#
+# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses
+# to changes committed by the same database connection, by database
+# connections sharing a cache in shared cache mode, and by completely
+# independent database connections including connections in separate
+# threads and processes.
+#
+# In this test, it response to two separate changes on the same database
+# connection.
+#
do_execsql_test pragma3-110 {
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(100),(200),(300);
SELECT * FROM t1;
PRAGMA data_version;
-} {100 200 300 1}
+} {100 200 300 3}
sqlite3 db2 test.db
do_test pragma3-120 {
INSERT INTO t1 VALUES(400),(500);
SELECT * FROM t1;
PRAGMA data_version;
-} {100 200 300 400 500 1}
+} {100 200 300 400 500 4}
+# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses
+# to changes committed by the same database connection, by database
+# connections sharing a cache in shared cache mode, and by completely
+# independent database connections including connections in separate
+# threads and processes.
+#
+# In these test, it response to changes in a different database connection
+# part of the same process.
+#
do_test pragma3-140 {
db2 eval {
SELECT * FROM t1;
SELECT * FROM t1;
PRAGMA data_version;
}
-} {100 200 300 400 500 2 101 201 301 401 501 2}
-
+} {100 200 300 400 500 2 101 201 301 401 501 3}
do_execsql_test pragma3-150 {
SELECT * FROM t1;
PRAGMA data_version;
-} {101 201 301 401 501 2}
-
+} {101 201 301 401 501 5}
+# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses
+# to changes committed by the same database connection, by database
+# connections sharing a cache in shared cache mode, and by completely
+# independent database connections including connections in separate
+# threads and processes.
+#
+# This test verifies behavior when a separate process changes the database
+# file.
+#
+do_test pragma3-200 {
+ set fd [open pragma3.txt wb]
+ puts $fd {
+ sqlite3 db test.db;
+ db eval {DELETE FROM t1 WHERE a>300};
+ db close;
+ exit;
+ }
+ close $fd
+ exec [info nameofexec] pragma3.txt
+ forcedelete pragma3.txt
+ db eval {
+ PRAGMA data_version;
+ SELECT * FROM t1;
+ }
+} {6 101 201}
db2 close
+db close
+
+# EVIDENCE-OF: R-10201-09349 The "PRAGMA data_version" command responses
+# to changes committed by the same database connection, by database
+# connections sharing a cache in shared cache mode, and by completely
+# independent database connections including connections in separate
+# threads and processes.
+#
+# The next series of tests verifies the behavior for shared-cache
+# database connections.
+#
+ifcapable shared_cache {
+ set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
+ sqlite3 db test.db
+ sqlite3 db2 test.db
+ do_test pragma3-300 {
+ db eval {
+ PRAGMA data_version;
+ CREATE TABLE t3(a,b,c);
+ PRAGMA data_version;
+ }
+ } {1 2}
+ do_test pragma3-310 {
+ db2 eval {
+ PRAGMA data_version;
+ INSERT INTO t3(a,b,c) VALUES('abc','def','ghi');
+ SELECT * FROM t3;
+ PRAGMA data_version;
+ }
+ } {2 abc def ghi 3}
+ do_test pragma3-320 {
+ db eval {
+ PRAGMA data_version;
+ SELECT * FROM t3;
+ }
+ } {3 abc def ghi}
+ db2 close
+ sqlite3_enable_shared_cache $::enable_shared_cache
+}
+
finish_test