]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Move the query flattener turn-off from a pragma to an sqlite3_test_control()
authordrh <drh@noemail.net>
Tue, 22 Dec 2009 23:52:32 +0000 (23:52 +0000)
committerdrh <drh@noemail.net>
Tue, 22 Dec 2009 23:52:32 +0000 (23:52 +0000)
call.  Make provisions (not yet implemented) to turn off other optimizers
using the same call.

FossilOrigin-Name: 4a97c623f4e190134de4b2ca406e311034a74797

manifest
manifest.uuid
src/build.c
src/main.c
src/pragma.c
src/select.c
src/sqlite.h.in
src/sqliteInt.h

index 9c034580de94d73e76ae48eaa6912f4c360b98cb..67dd5b96ecbbfe494f7919550a525b72a201de6e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,8 @@
-C Add\sthe\sexperimental\sFTS3\smatchinfo()\sfunction.\sProvides\sdetails\sof\sthe\smatch\sthat\smay\sbe\sused\sfor\sresult\sranking\sand\sother\spurposes.
-D 2009-12-22T18:56:19
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+C Move\sthe\squery\sflattener\sturn-off\sfrom\sa\spragma\sto\san\ssqlite3_test_control()\ncall.\s\sMake\sprovisions\s(not\syet\simplemented)\sto\sturn\soff\sother\soptimizers\nusing\sthe\ssame\scall.
+D 2009-12-22T23:52:32
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -111,7 +114,7 @@ F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff
 F src/btree.c efdef3953c49e28f8b8fa9cc0ac5754cc1a7489a
 F src/btree.h 7944a9dac59eb3e541aad45fd2747f1051e7c63d
 F src/btreeInt.h 54f4245decd0409ea52cf9aee422d3d761d7ac10
-F src/build.c 5a18b6846e99cb923008a8c888d3fd520f0bea52
+F src/build.c 6ab7f8d8fa5b0ac6bfdce359e85f580b7a9b2e86
 F src/callback.c 908f3e0172c3d4058f4ca0acd42c637c52e9669f
 F src/complete.c 4c8a742c4a4a6d9c835912648f5c8f032ea36c7b
 F src/date.c a79c0a8f219370b972e320741f995a3bef9df33f
@@ -129,7 +132,7 @@ F src/journal.c b0ea6b70b532961118ab70301c00a33089f9315c
 F src/legacy.c 9304428e71b1d622b764913e1432e69156814755
 F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
 F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581
-F src/main.c b47cc67a81937d24e3ca14beffe0cbcc8dfda896
+F src/main.c e477f3e3b3cfdce075e23b12875c4e77e6e358ee
 F src/malloc.c 5fa175797f982b178eaf38afba9c588a866be729
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c 552f7e11486272f27948d2de9c012884d1f52908
@@ -156,17 +159,17 @@ F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
 F src/pcache.c 3b079306376e0e04c0d3df40c0a4b750a1839310
 F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
 F src/pcache1.c 2bb2261190b42a348038f5b1c285c8cef415fcc8
-F src/pragma.c c194fc135754c700fefc6f7fbe77e90b1dc40aff
+F src/pragma.c 6936d7df5e04b9f996f8f320d15e65b6944b2caa
 F src/prepare.c 170bd953058efe1c46b8ad9020d49cd6f40f0b45
 F src/printf.c 644bc7d59df3dc56d6d8b9a510914bfc6b51bc69
 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
 F src/resolve.c d052e5c44bab34f83b3c1741aaa07478d18b5dd5
 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
-F src/select.c 9b5ad0e12b2a95fe9cf48d383b6fec5ca31b6a72
+F src/select.c 7e424c8fea32725dec2d86d06d98ffedd7fa5023
 F src/shell.c b9fae60b0f2ce306c20fa99e83c75023bf35f15b
-F src/sqlite.h.in 176e993dce3c9cfe5610aca0ef99f4dfd70896bb
+F src/sqlite.h.in 60cbf318765de59bb454e229bd2d5ec065dd686a
 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
-F src/sqliteInt.h eddc248fb88d76f0c77be45fa72099c48af243af
+F src/sqliteInt.h 2612705b54169e0cd82740f4bf93d7284fe2536a
 F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6
 F src/status.c e651be6b30d397d86384c6867bc016e4913bcac7
 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
@@ -782,7 +785,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 1d8550e5c88db0ea76aea579c1a5bf99d48fbe43
-R 41598dc57bec7fe2cae4d45c4e1125f1
-U dan
-Z 61e8349bf00893649947578111240ad6
+P 37a1de02d1d8a34604f1bee896eaf579d4ba149a
+R c2d4c8288e84ae9afb7a643682bb92e8
+U drh
+Z 6449324b3eb75888a0748fac4f5b69aa
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFLMVvDoxKgR168RlERArP6AJ9MsqPf1HHWZPNd9R2EyQa4uKZbCgCcCRSF
+ZONbln7b9xypgxaX8ksQh18=
+=pFNF
+-----END PGP SIGNATURE-----
index bef4ecaa7c23ab64a88fa79a67d25b2ef6608a0b..7ea3abbb9771680076086a7804ecdbdd3f7c959c 100644 (file)
@@ -1 +1 @@
-37a1de02d1d8a34604f1bee896eaf579d4ba149a
\ No newline at end of file
+4a97c623f4e190134de4b2ca406e311034a74797
\ No newline at end of file
index 7772c4114c2aff0ecd725605dcbd4a8f4a4b69c2..b385e44ef1344ce9524c12e14494076f36a354d2 100644 (file)
@@ -3417,7 +3417,6 @@ int sqlite3OpenTempDatabase(Parse *pParse){
       pParse->rc = rc;
       return 1;
     }
-    assert( (db->flags & SQLITE_InTrans)==0 || db->autoCommit );
     assert( db->aDb[1].pSchema );
     sqlite3PagerJournalMode(sqlite3BtreePager(db->aDb[1].pBt),
                             db->dfltJournalMode);
index d8807553a51185ba80f58ea09ea7f96e1ddbe386..2a4fbcf5eb66f9081317a563d1922a959325e08e 100644 (file)
@@ -2281,6 +2281,22 @@ int sqlite3_test_control(int op, ...){
       break;
     }
 
+    /*  sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N)
+    **
+    ** Enable or disable various optimizations for testing purposes.  The 
+    ** argument N is a bitmask of optimizations to be disabled.  For normal
+    ** operation N should be 0.  The idea is that a test program (like the
+    ** SQL Logic Test or SLT test module) can run the same SQL multiple times
+    ** with various optimizations disabled to verify that the same answer
+    ** is obtained in every case.
+    */
+    case SQLITE_TESTCTRL_OPTIMIZATIONS: {
+      sqlite3 *db = va_arg(ap, sqlite3*);
+      int x = va_arg(ap,int);
+      db->flags = (x & SQLITE_OptMask) | (db->flags & ~SQLITE_OptMask);
+      break;
+    }
+
   }
   va_end(ap);
 #endif /* SQLITE_OMIT_BUILTIN_TEST */
index 9aa43148b884f212886d94028690a02bc07a7756..0afce9706db0ab31ac42a658f6f3e2e65cc136a3 100644 (file)
@@ -185,9 +185,6 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
     { "writable_schema",          SQLITE_WriteSchema|SQLITE_RecoveryMode },
     { "omit_readlock",            SQLITE_NoReadlock    },
 
-    /* For testing purposes only */
-    { "omit_flattener",           SQLITE_OmitFlattener },
-
     /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
     ** flag if there are any active statements. */
     { "read_uncommitted",         SQLITE_ReadUncommitted },
index 00d26b7b0df90469dd457e983fbcdfa3387a5e7e..2e07213f93734fed680775b3f7e8332eb338a56a 100644 (file)
@@ -2592,13 +2592,7 @@ static int flattenSubquery(
   */
   assert( p!=0 );
   assert( p->pPrior==0 );  /* Unable to flatten compound queries */
-
-  /* The "PRAGMA omit_flattener=ON" statement disables query flattening for
-  ** testing purposes.  The only reason to disable the query flattener is
-  ** to verify that we get the same answer with and without the flattener.
-  ** In production use, there is never a reason to turn the flattener off. */
-  if( db->flags & SQLITE_OmitFlattener ) return 0;
-
+  if( db->flags & SQLITE_QueryFlattener ) return 0;
   pSrc = p->pSrc;
   assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
   pSubitem = &pSrc->a[iFrom];
index 50c59e2ee3b13a492a5bfe1d97533b3da5c83128..e5e3e1b7076797fee500354bd82665fed4bfca1a 100644 (file)
@@ -4923,6 +4923,7 @@ int sqlite3_test_control(int op, ...);
 ** Applications should not use any of these parameters or the
 ** [sqlite3_test_control()] interface.
 */
+#define SQLITE_TESTCTRL_FIRST                    5
 #define SQLITE_TESTCTRL_PRNG_SAVE                5
 #define SQLITE_TESTCTRL_PRNG_RESTORE             6
 #define SQLITE_TESTCTRL_PRNG_RESET               7
@@ -4933,6 +4934,8 @@ int sqlite3_test_control(int op, ...);
 #define SQLITE_TESTCTRL_ASSERT                  12
 #define SQLITE_TESTCTRL_ALWAYS                  13
 #define SQLITE_TESTCTRL_RESERVE                 14
+#define SQLITE_TESTCTRL_OPTIMIZATIONS           15
+#define SQLITE_TESTCTRL_LAST                    15
 
 /*
 ** CAPI3REF: SQLite Runtime Status
index 29cad137839850815b45f553849d1ad6d2538c4a..6bbae1aa1ba4ad31bfc031b760f21da78f8ae8ac 100644 (file)
@@ -898,37 +898,43 @@ struct sqlite3 {
 #define ENC(db) ((db)->aDb[0].pSchema->enc)
 
 /*
-** Possible values for the sqlite.flags and or Db.flags fields.
-**
-** On sqlite.flags, the SQLITE_InTrans value means that we have
-** executed a BEGIN.  On Db.flags, SQLITE_InTrans means a statement
-** transaction is active on that particular database file.
-*/
-#define SQLITE_VdbeTrace      0x00000001  /* True to trace VDBE execution */
-#define SQLITE_InTrans        0x00000008  /* True if in a transaction */
-#define SQLITE_InternChanges  0x00000010  /* Uncommitted Hash table changes */
-#define SQLITE_FullColNames   0x00000020  /* Show full column names on SELECT */
-#define SQLITE_ShortColNames  0x00000040  /* Show short columns names */
-#define SQLITE_CountRows      0x00000080  /* Count rows changed by INSERT, */
+** Possible values for the sqlite3.flags.
+*/
+#define SQLITE_VdbeTrace      0x00000100  /* True to trace VDBE execution */
+#define SQLITE_InternChanges  0x00000200  /* Uncommitted Hash table changes */
+#define SQLITE_FullColNames   0x00000400  /* Show full column names on SELECT */
+#define SQLITE_ShortColNames  0x00000800  /* Show short columns names */
+#define SQLITE_CountRows      0x00001000  /* Count rows changed by INSERT, */
                                           /*   DELETE, or UPDATE and return */
                                           /*   the count using a callback. */
-#define SQLITE_NullCallback   0x00000100  /* Invoke the callback once if the */
+#define SQLITE_NullCallback   0x00002000  /* Invoke the callback once if the */
                                           /*   result set is empty */
-#define SQLITE_SqlTrace       0x00000200  /* Debug print SQL as it executes */
-#define SQLITE_VdbeListing    0x00000400  /* Debug listings of VDBE programs */
-#define SQLITE_WriteSchema    0x00000800  /* OK to update SQLITE_MASTER */
-#define SQLITE_NoReadlock     0x00001000  /* Readlocks are omitted when 
+#define SQLITE_SqlTrace       0x00004000  /* Debug print SQL as it executes */
+#define SQLITE_VdbeListing    0x00008000  /* Debug listings of VDBE programs */
+#define SQLITE_WriteSchema    0x00010000  /* OK to update SQLITE_MASTER */
+#define SQLITE_NoReadlock     0x00020000  /* Readlocks are omitted when 
                                           ** accessing read-only databases */
-#define SQLITE_IgnoreChecks   0x00002000  /* Do not enforce check constraints */
-#define SQLITE_ReadUncommitted 0x0004000  /* For shared-cache mode */
-#define SQLITE_LegacyFileFmt  0x00008000  /* Create new databases in format 1 */
-#define SQLITE_FullFSync      0x00010000  /* Use full fsync on the backend */
-#define SQLITE_LoadExtension  0x00020000  /* Enable load_extension */
-#define SQLITE_RecoveryMode   0x00040000  /* Ignore schema errors */
-#define SQLITE_ReverseOrder   0x00100000  /* Reverse unordered SELECTs */
-#define SQLITE_RecTriggers    0x00200000  /* Enable recursive triggers */
-#define SQLITE_ForeignKeys    0x00400000  /* Enforce foreign key constraints */
-#define SQLITE_OmitFlattener  0x00800000  /* Do not flatten queries */
+#define SQLITE_IgnoreChecks   0x00040000  /* Do not enforce check constraints */
+#define SQLITE_ReadUncommitted 0x0080000  /* For shared-cache mode */
+#define SQLITE_LegacyFileFmt  0x00100000  /* Create new databases in format 1 */
+#define SQLITE_FullFSync      0x00200000  /* Use full fsync on the backend */
+#define SQLITE_LoadExtension  0x00400000  /* Enable load_extension */
+#define SQLITE_RecoveryMode   0x00800000  /* Ignore schema errors */
+#define SQLITE_ReverseOrder   0x01000000  /* Reverse unordered SELECTs */
+#define SQLITE_RecTriggers    0x02000000  /* Enable recursive triggers */
+#define SQLITE_ForeignKeys    0x04000000  /* Enforce foreign key constraints  */
+
+/*
+** Bits of the sqlite3.flags field that are used by the
+** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface.
+** These must be the low-order bits of the flags field.
+*/
+#define SQLITE_QueryFlattener 0x01        /* Disable query flattening */
+#define SQLITE_IndexSort      0x02        /* Disable indexes for sorting */
+#define SQLITE_IndexSearch    0x04        /* Disable indexes for searching */
+#define SQLITE_IndexCover     0x08        /* Disable index covering table */
+#define SQLITE_RegisterReuse  0x10        /* Disable register reuse */
+#define SQLITE_OptMask        0x1f        /* Mask of all disablable opts */
 
 /*
 ** Possible values for the sqlite.magic field.