aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-04-26 17:36:35 +0000
committerdrh <drh@noemail.net>2010-04-26 17:36:35 +0000
commit93791ea0bac51d58675a54621e3fd7a1cce75d36 (patch)
tree62339757df886442e7c516c3ecbee3b1dc6bd769 /src
parentc6d2b4a365aa4d535a30631481b851632ffd6470 (diff)
downloadsqlite-93791ea0bac51d58675a54621e3fd7a1cce75d36.tar.gz
sqlite-93791ea0bac51d58675a54621e3fd7a1cce75d36.zip
Change the default_cache_size pragma to always store a positive value.
FossilOrigin-Name: 36fb2cae75b5dfe1fe818895f03c0b4f4190a722
Diffstat (limited to 'src')
-rw-r--r--src/pragma.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/pragma.c b/src/pragma.c
index f03078f24..037a290a9 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -329,11 +329,11 @@ void sqlite3Pragma(
** page cache size value and the persistent page cache size value
** stored in the database file.
**
- ** The default cache size is stored in meta-value 2 of page 1 of the
- ** database file. The cache size is actually the absolute value of
- ** this memory location. The sign of meta-value 2 determines the
- ** synchronous setting. A negative value means synchronous is off
- ** and a positive value means synchronous is on.
+ ** Older versions of SQLite would set the default cache size to a
+ ** negative number to indicate synchronous=OFF. These days, synchronous
+ ** is always on by default regardless of the sign of the default cache
+ ** size. But continue to take the absolute value of the default cache
+ ** size of historical compatibility.
*/
if( sqlite3StrICmp(zLeft,"default_cache_size")==0 ){
static const VdbeOpList getCacheSize[] = {
@@ -362,10 +362,6 @@ void sqlite3Pragma(
if( size<0 ) size = -size;
sqlite3BeginWriteOperation(pParse, 0, iDb);
sqlite3VdbeAddOp2(v, OP_Integer, size, 1);
- sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, 2, BTREE_DEFAULT_CACHE_SIZE);
- addr = sqlite3VdbeAddOp2(v, OP_IfPos, 2, 0);
- sqlite3VdbeAddOp2(v, OP_Integer, -size, 1);
- sqlite3VdbeJumpHere(v, addr);
sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, 1);
pDb->pSchema->cache_size = size;
sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);