diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pragma.c | 3 | ||||
-rw-r--r-- | src/select.c | 11 | ||||
-rw-r--r-- | src/sqliteInt.h | 6 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/pragma.c b/src/pragma.c index 0afce9706..9aa43148b 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -185,6 +185,9 @@ 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 }, diff --git a/src/select.c b/src/select.c index 80c236686..00d26b7b0 100644 --- a/src/select.c +++ b/src/select.c @@ -957,7 +957,7 @@ static const char *columnType( ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if( ALWAYS(iCol>=0 && iCol<pS->pEList->nExpr) ){ + if( iCol>=0 && ALWAYS(iCol<pS->pEList->nExpr) ){ /* If iCol is less than zero, then the expression requests the ** rowid of the sub-select or view. This expression is legal (see ** test case misc2.2.2) - it always evaluates to NULL. @@ -2518,7 +2518,7 @@ static void substSelect( ** ** (11) The subquery and the outer query do not both have ORDER BY clauses. ** -** (12) Not implemented. Subsumed into restriction (3). Was previously +** (**) Not implemented. Subsumed into restriction (3). Was previously ** a separate restriction deriving from ticket #350. ** ** (13) The subquery and outer query do not both use LIMIT @@ -2592,6 +2592,13 @@ 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; + pSrc = p->pSrc; assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc ); pSubitem = &pSrc->a[iFrom]; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 1e15dbd16..29cad1378 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -920,15 +920,15 @@ struct sqlite3 { #define SQLITE_NoReadlock 0x00001000 /* Readlocks are omitted when ** accessing read-only databases */ #define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */ -#define SQLITE_ReadUncommitted 0x00004000 /* For shared-cache mode */ +#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_ForeignKeys 0x00400000 /* Enforce foreign key constraints */ +#define SQLITE_OmitFlattener 0x00800000 /* Do not flatten queries */ /* ** Possible values for the sqlite.magic field. |