diff options
author | drh <drh@noemail.net> | 2012-09-17 17:16:53 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2012-09-17 17:16:53 +0000 |
commit | e1a022e48be1e7f40a8310e0f917fac8593c66a4 (patch) | |
tree | 3e0b1ed603721516ca3782e3a08f80dffd754200 /src/expr.c | |
parent | 56690b3d4935766cbe6a2d936e6371b03232ac04 (diff) | |
download | sqlite-e1a022e48be1e7f40a8310e0f917fac8593c66a4.tar.gz sqlite-e1a022e48be1e7f40a8310e0f917fac8593c66a4.zip |
Make sure the KeyInfo.aSortOrder array is always allocated so that we never
have to test for KeyInfo.aSortOrder==0 in performance-critical loops.
FossilOrigin-Name: 45793f0b844fee7445bc9269b403f89a58f77150
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c index 89172f94b..3fb51cf11 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1662,6 +1662,7 @@ int sqlite3CodeSubselect( case TK_IN: { char affinity; /* Affinity of the LHS of the IN */ KeyInfo keyInfo; /* Keyinfo for the generated table */ + static u8 sortOrder = 0; /* Fake aSortOrder for keyInfo */ int addr; /* Address of OP_OpenEphemeral instruction */ Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */ @@ -1689,6 +1690,7 @@ int sqlite3CodeSubselect( if( rMayHaveNull==0 ) sqlite3VdbeChangeP5(v, BTREE_UNORDERED); memset(&keyInfo, 0, sizeof(keyInfo)); keyInfo.nField = 1; + keyInfo.aSortOrder = &sortOrder; if( ExprHasProperty(pExpr, EP_xIsSelect) ){ /* Case 1: expr IN (SELECT ...) @@ -1729,6 +1731,7 @@ int sqlite3CodeSubselect( affinity = SQLITE_AFF_NONE; } keyInfo.aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft); + keyInfo.aSortOrder = &sortOrder; /* Loop through each expression in <exprlist>. */ r1 = sqlite3GetTempReg(pParse); |