mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Alternative implementation of exprCompareVariable(). Need to run tests on
both this branch and the original to see which one to go with. FossilOrigin-Name: b959c6297c151150ea2dca24aa1f68f3bd76dd6620eb6c03f8dfa59fdd5c13b2
This commit is contained in:
15
manifest
15
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Make\sthe\squery\splanners\suse\sof\spartial\sindexes\sbased\son\sbound\svariables\nresponsive\sto\sthe\sSQLITE_DBCONFIG_ENABLE_QPSG\ssetting.
|
C Alternative\simplementation\sof\sexprCompareVariable().\s\sNeed\sto\srun\stests\son\nboth\sthis\sbranch\sand\sthe\soriginal\sto\ssee\swhich\sone\sto\sgo\swith.
|
||||||
D 2017-06-28T18:25:03.706
|
D 2017-06-28T21:47:16.657
|
||||||
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
||||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||||
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
|
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
|
||||||
@@ -359,7 +359,7 @@ F src/ctime.c e9a6db1321c2353fe922533f202b85abb3084cdf569450abcabf55e21e104550
|
|||||||
F src/date.c cc42a41c7422389860d40419a5e3bce5eaf6e7835c3ba2677751dc653550a5c7
|
F src/date.c cc42a41c7422389860d40419a5e3bce5eaf6e7835c3ba2677751dc653550a5c7
|
||||||
F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d
|
F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d
|
||||||
F src/delete.c 3213547e97b676c6fa79948b7a9ede4801ea04a01a2043241deafedf132ecf5d
|
F src/delete.c 3213547e97b676c6fa79948b7a9ede4801ea04a01a2043241deafedf132ecf5d
|
||||||
F src/expr.c 9aea9dbac1169c5cda3ee5d288b9e6c25de597a38023f8104406e0312145ca8d
|
F src/expr.c 8281b9e5b88862176862c614acda20fdeb85c20143c5125cee4efd2893c1a64e
|
||||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||||
F src/fkey.c 5ff2c895fe087756d8085dc1a9bc229b5670e2a65c3929dd87c71e43649af333
|
F src/fkey.c 5ff2c895fe087756d8085dc1a9bc229b5670e2a65c3929dd87c71e43649af333
|
||||||
F src/func.c 9d52522cc8ae7f5cdadfe14594262f1618bc1f86083c4cd6da861b4cf5af6174
|
F src/func.c 9d52522cc8ae7f5cdadfe14594262f1618bc1f86083c4cd6da861b4cf5af6174
|
||||||
@@ -1585,7 +1585,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 8f63c5863231eba7f853f9587b58a81102c31708402fa9962a6e91aa622fad13
|
P a934dd14ac55177ac541423f4a077484bb3b461b60c9c2e88d067cca922fa2bc
|
||||||
R c0bca5815e0b14a60d8900b0ad5f06a7
|
R d8af740d34bab1193c95ada6cd028712
|
||||||
|
T *branch * partial-index-variables-v2
|
||||||
|
T *sym-partial-index-variables-v2 *
|
||||||
|
T -sym-partial-index-variables *
|
||||||
U drh
|
U drh
|
||||||
Z afcf7a655c64b8f5d4a7cb72e9e49496
|
Z 929717708efb4b9fc1714d496de51de5
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
a934dd14ac55177ac541423f4a077484bb3b461b60c9c2e88d067cca922fa2bc
|
b959c6297c151150ea2dca24aa1f68f3bd76dd6620eb6c03f8dfa59fdd5c13b2
|
||||||
40
src/expr.c
40
src/expr.c
@@ -4675,29 +4675,19 @@ void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,int jumpIfNull){
|
|||||||
*/
|
*/
|
||||||
static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){
|
static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){
|
||||||
int res = 0;
|
int res = 0;
|
||||||
int iVar = pVar->iColumn;
|
int iVar;
|
||||||
Expr *p = pExpr;
|
sqlite3_value *pL, *pR = 0;
|
||||||
|
|
||||||
while( p->op==TK_UMINUS ) p = p->pLeft;
|
|
||||||
if( p->op==TK_NULL || p->op==TK_INTEGER
|
|
||||||
|| p->op==TK_FLOAT || p->op==TK_STRING
|
|
||||||
|| p->op==TK_BLOB
|
|
||||||
){
|
|
||||||
sqlite3VdbeSetVarmask(pParse->pVdbe, iVar);
|
|
||||||
sqlite3_value *pL;
|
|
||||||
pL = sqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB);
|
|
||||||
if( pL ){
|
|
||||||
sqlite3_value *pR = 0;
|
|
||||||
sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR);
|
sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR);
|
||||||
assert( pR || pParse->db->mallocFailed );
|
if( pR ){
|
||||||
if( pR && 0==sqlite3MemCompare(pL, pR, 0) ){
|
iVar = pVar->iColumn;
|
||||||
|
sqlite3VdbeSetVarmask(pParse->pVdbe, iVar);
|
||||||
|
pL = sqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB);
|
||||||
|
if( pL && 0==sqlite3MemCompare(pL, pR, 0) ){
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
sqlite3ValueFree(pR);
|
sqlite3ValueFree(pR);
|
||||||
sqlite3ValueFree(pL);
|
sqlite3ValueFree(pL);
|
||||||
}else if( p->op==TK_NULL ){
|
|
||||||
res = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -4725,11 +4715,12 @@ static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){
|
|||||||
** just might result in some slightly slower code. But returning
|
** just might result in some slightly slower code. But returning
|
||||||
** an incorrect 0 or 1 could lead to a malfunction.
|
** an incorrect 0 or 1 could lead to a malfunction.
|
||||||
**
|
**
|
||||||
** Argument pParse should normally be NULL. If it is not NULL and
|
** If pParse is not NULL then TK_VARIABLE terms in pA with bindings in
|
||||||
** expression pA contains SQL variable references, then the values
|
** pParse->pReprepare can be matched against literals in pB. The
|
||||||
** currently bound to those variable references may be compared to
|
** pParse->pVdbe->expmask bitmask is updated for each variable referenced.
|
||||||
** simple SQL values in pB. See comments above function exprCompareVariable()
|
** If pParse is NULL (the normal case) then any TK_VARIABLE term in
|
||||||
** for details.
|
** Argument pParse should normally be NULL. If it is not NULL and pA or
|
||||||
|
** pB causes a return value of 2.
|
||||||
*/
|
*/
|
||||||
int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){
|
int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){
|
||||||
u32 combinedFlags;
|
u32 combinedFlags;
|
||||||
@@ -4833,6 +4824,11 @@ int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
|
|||||||
** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has
|
** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has
|
||||||
** Expr.iTable<0 then assume a table number given by iTab.
|
** Expr.iTable<0 then assume a table number given by iTab.
|
||||||
**
|
**
|
||||||
|
** If pParse is not NULL, then the values of bound variables in pE1 are
|
||||||
|
** compared against literal values in pE2 and pParse->pVdbe->expmask is
|
||||||
|
** modified to record which bound variables are referenced. If pParse
|
||||||
|
** is NULL, then false will be returned if pE1 contains any bound variables.
|
||||||
|
**
|
||||||
** When in doubt, return false. Returning true might give a performance
|
** When in doubt, return false. Returning true might give a performance
|
||||||
** improvement. Returning false might cause a performance reduction, but
|
** improvement. Returning false might cause a performance reduction, but
|
||||||
** it will always give the correct answer and is hence always safe.
|
** it will always give the correct answer and is hence always safe.
|
||||||
|
|||||||
Reference in New Issue
Block a user