]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Bring the PRAGMA logic into closer alignment with trunk, and in the process
authordrh <drh@noemail.net>
Fri, 9 May 2014 11:45:55 +0000 (11:45 +0000)
committerdrh <drh@noemail.net>
Fri, 9 May 2014 11:45:55 +0000 (11:45 +0000)
fix a couple of crashes.

FossilOrigin-Name: d66fe706dad000888a177c19aa217bbb68edb4d2

manifest
manifest.uuid
src/pragma.c

index 8e1b95e42d0f8f6833eb58a892fe789ffedaf09e..29b1d37a0fe042c2898149eaf1f82003b9f4c263 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,11 +1,11 @@
-C Initial\sattempt\sto\smerge\sin\sall\strunk\schanges\sover\sthe\sprevious\s1.5\syears.\nThis\scheck-in\scompiles\sbut\sthere\sare\scompiler\swarnings\sand\s"make\stest"\nsegfaults\safter\sonly\srunning\sa\sfew\stest\smodules.
-D 2014-05-08T23:01:59.070
+C Bring\sthe\sPRAGMA\slogic\sinto\scloser\salignment\swith\strunk,\sand\sin\sthe\sprocess\nfix\sa\scouple\sof\scrashes.
+D 2014-05-09T11:45:55.952
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 444faa7b5c5b3189fa674ff42be94d87a37eba9d
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
 F Makefile.msc 7e6c495d9a145054a09f518781916c7503f7a8e9
 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0
-F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 w README
+F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8
 F VERSION 9f823c026c6a32fc5f84d212a8aae0a221dba45c
 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
 F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811
@@ -108,17 +108,17 @@ F ext/icu/icu.c d415ccf984defeb9df2c0e1afcfaa2f6dc05eacb
 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
 F ext/misc/amatch.c 678056a4bfcd83c4e82dea81d37543cd1d6dbee1
 F ext/misc/closure.c 636024302cde41b2bf0c542f81c40c624cfb7012
-F ext/misc/fuzzer.c 136533c53cfce0957f0b48fa11dba27e21c5c01d w src/test_fuzzer.c
+F ext/misc/fuzzer.c 136533c53cfce0957f0b48fa11dba27e21c5c01d
 F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e
 F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
 F ext/misc/regexp.c af92cdaa5058fcec1451e49becc7ba44dba023dc
 F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
-F ext/misc/spellfix.c 93f3961074cebe63c31fcefe62ca2a032ee8dfed w src/test_spellfix.c
+F ext/misc/spellfix.c 93f3961074cebe63c31fcefe62ca2a032ee8dfed
 F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512
 F ext/misc/vfslog.c fe40fab5c077a40477f7e5eba994309ecac6cc95
 F ext/misc/vtshim.c babb0dc2bf116029e3e7c9a618b8a1377045303e
-F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212 w src/test_wholenumber.c
+F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
 F ext/rtree/rtree.c 8884ffb0db17df33084b0ae2d475427a4276e383
 F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
@@ -217,7 +217,7 @@ F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0
 F src/pcache.c d8eafac28290d4bb80332005435db44991d07fc2
 F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
 F src/pcache1.c 102e6f5a2fbc646154463eb856d1fd716867b64c
-F src/pragma.c 67d3b4a85cb1844ace98889de10d5b7ae8bf4a80
+F src/pragma.c 039578fb7d7cad90a5a2269651ad3b1ad98451cc
 F src/prepare.c 954f80160f120ca715ffa5db5549c3262abb335e
 F src/printf.c e5a0005f8b3de21f85da6a709d2fbee76775bf4b
 F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
@@ -1175,7 +1175,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix a94fb9b1b1ef06efc2898975cdfcfa9643731f5e
-P 6a5c59dd7e0de9b5a2136f1c333afe522f724a71 116bed5af664899a73b46dca528ac0c021fc50c3
-R 06b2bd1e0552b0311ec4ae7a91709791
+P 9411d7dc6fbee689730c6f74736341bccd333d9e
+R 5b8ea3b425b610bd1791d7adc3895350
 U drh
-Z 342cd5aa6e06528e5576874b8f28089b
+Z a9d0aca766697d2a0e74827de095980b
index d502576b531ca99fbc9c031ee89a9cb6997be8e3..4ef67b57b877c5a6a46816282a8f7c6ed6202718 100644 (file)
@@ -1 +1 @@
-9411d7dc6fbee689730c6f74736341bccd333d9e
\ No newline at end of file
+d66fe706dad000888a177c19aa217bbb68edb4d2
\ No newline at end of file
index d84dca8ea8ed0f4c4dd8091ff197b22ea0833d21..b7e97a82e3479241b739b18e104ee7ca21143643 100644 (file)
@@ -601,12 +601,12 @@ static int changeTempStorage(Parse *pParse, const char *zStorageType){
 /*
 ** Generate code to return a single integer value.
 */
-static void returnSingleInt(Parse *pParse, const char *zLabel, i64 *pValue){
+static void returnSingleInt(Parse *pParse, const char *zLabel, i64 value){
   Vdbe *v = sqlite3GetVdbe(pParse);
   int mem = ++pParse->nMem;
-  i64 *pI64 = sqlite3DbMallocRaw(pParse->db, sizeof(*pValue));
+  i64 *pI64 = sqlite3DbMallocRaw(pParse->db, sizeof(value));
   if( pI64 ){
-    memcpy(pI64, pValue, sizeof(*pValue));
+    memcpy(pI64, &value, sizeof(value));
   }
   sqlite3VdbeAddOp4(v, OP_Int64, 0, mem, 0, (char*)pI64, P4_INT64);
   sqlite3VdbeSetNumCols(v, 1);
@@ -629,11 +629,11 @@ static void setAllPagerFlags(sqlite3 *db){
     assert( SQLITE_CacheSpill==PAGER_CACHESPILL );
     assert( (PAGER_FULLFSYNC | PAGER_CKPT_FULLFSYNC | PAGER_CACHESPILL)
              ==  PAGER_FLAGS_MASK );
-    assert( (pDb->safety_level & PAGER_SYNCHRONOUS_MASK)==pDb->safety_level );
     while( (n--) > 0 ){
       if( pDb->pBt ){
         sqlite3BtreeSetPagerFlags(pDb->pBt,
-                 pDb->safety_level | (db->flags & PAGER_FLAGS_MASK) );
+                 (pDb->safety_level & PAGER_SYNCHRONOUS_MASK)
+                   | (db->flags & PAGER_FLAGS_MASK) );
       }
       pDb++;
     }
@@ -873,8 +873,8 @@ void sqlite3Pragma(
     Btree *pBt = pDb->pBt;
     assert( pBt!=0 );
     if( !zRight ){
-      i64 size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;
-      returnSingleInt(pParse, "page_size", &size);
+      int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;
+      returnSingleInt(pParse, "page_size", size);
     }else{
       /* Malloc may fail when setting the page-size, as there is an internal
       ** buffer that the pager module resizes using sqlite3_realloc().
@@ -897,7 +897,7 @@ void sqlite3Pragma(
   */
   case PragTyp_SECURE_DELETE: {
     Btree *pBt = pDb->pBt;
-    sqlite3_int64 b = -1;
+    int b = -1;
     assert( pBt!=0 );
     if( zRight ){
       b = sqlite3GetBoolean(zRight, 0);
@@ -905,11 +905,11 @@ void sqlite3Pragma(
     if( pId2->n==0 && b>=0 ){
       int ii;
       for(ii=0; ii<db->nDb; ii++){
-        sqlite3BtreeSecureDelete(db->aDb[ii].pBt, (int)b);
+        sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);
       }
     }
-    b = (int)sqlite3BtreeSecureDelete(pBt, (int)b);
-    returnSingleInt(pParse, "secure_delete", &b);
+    b = sqlite3BtreeSecureDelete(pBt, b);
+    returnSingleInt(pParse, "secure_delete", b);
     break;
   }
 
@@ -1066,7 +1066,7 @@ void sqlite3Pragma(
       if( iLimit<-1 ) iLimit = -1;
     }
     iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit);
-    returnSingleInt(pParse, "journal_size_limit", &iLimit);
+    returnSingleInt(pParse, "journal_size_limit", iLimit);
     break;
   }
 
@@ -1161,8 +1161,7 @@ void sqlite3Pragma(
   case PragTyp_CACHE_SIZE: {
     assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
     if( !zRight ){
-      i64 cacheSize = pDb->pSchema->cache_size;
-      returnSingleInt(pParse, "cache_size", &cacheSize);
+      returnSingleInt(pParse, "cache_size", pDb->pSchema->cache_size);
     }else{
       int size = sqlite3Atoi(zRight);
       pDb->pSchema->cache_size = size;
@@ -1228,8 +1227,7 @@ void sqlite3Pragma(
   */
   case PragTyp_TEMP_STORE: {
     if( !zRight ){
-      i64 tempStore = db->temp_store;
-      returnSingleInt(pParse, "temp_store", &tempStore);
+      returnSingleInt(pParse, "temp_store", db->temp_store);
     }else{
       changeTempStorage(pParse, zRight);
     }
@@ -1382,16 +1380,15 @@ void sqlite3Pragma(
   */
   case PragTyp_SYNCHRONOUS: {
     if( !zRight ){
-      u8 level = pDb->safety_level;
-      i64 safetyLevel = (i64)(SQLITE_DbSafetyLevelValue(level)-1);
-      returnSingleInt(pParse, "synchronous", &safetyLevel);
+      returnSingleInt(pParse, "synchronous", 
+            SQLITE_DbSafetyLevelValue(pDb->safety_level)-1);
     }else{
       if( !db->autoCommit ){
         sqlite3ErrorMsg(pParse, 
             "Safety level may not be changed inside a transaction");
       }else{
-        u8 level = getSafetyLevel(zRight,0,1)+1;
-        pDb->safety_level = (level | SQLITE_SAFETYLEVEL_FIXED);
+        pDb->safety_level = (getSafetyLevel(zRight,0,1)+1)
+                                      | SQLITE_SAFETYLEVEL_FIXED;
         setAllPagerFlags(db);
       }
     }
@@ -2190,14 +2187,12 @@ void sqlite3Pragma(
   ** of N.
   */
   case PragTyp_WAL_AUTOCHECKPOINT: {
-    i64 walArg = 0;
     if( zRight ){
       sqlite3_wal_autocheckpoint(db, sqlite3Atoi(zRight));
     }
-    if( db->xWalCallback==sqlite3WalDefaultHook ){
-      walArg = SQLITE_PTR_TO_INT(db->pWalArg);
-    }
-    returnSingleInt(pParse, "wal_autocheckpoint", &walArg);
+    returnSingleInt(pParse, "wal_autocheckpoint", 
+       db->xWalCallback==sqlite3WalDefaultHook ? 
+           SQLITE_PTR_TO_INT(db->pWalArg) : 0);
   }
   break;
 #endif
@@ -2227,7 +2222,7 @@ void sqlite3Pragma(
     if( zRight ){
       sqlite3_busy_timeout(db, sqlite3Atoi(zRight));
     }
-    returnSingleInt(pParse, "timeout",  &db->busyTimeout);
+    returnSingleInt(pParse, "timeout",  db->busyTimeout);
     break;
   }