mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Change the code generator for the IN operator so that it avoids creating
OP_Eq and OP_Ne opcode with the same P1 and P3 arguments. This enables us to back out check-in [ddb17d92df194337] and also fix ticket [188f912b51cd802]. FossilOrigin-Name: 9ab985a9c8160b905730678f40ed440a246cdec549c798bafefaed5abbc0437f
This commit is contained in:
16
src/expr.c
16
src/expr.c
@@ -3187,15 +3187,21 @@ static void sqlite3ExprCodeIN(
|
||||
sqlite3VdbeAddOp3(v, OP_BitAnd, regCkNull, r2, regCkNull);
|
||||
}
|
||||
if( ii<pList->nExpr-1 || destIfNull!=destIfFalse ){
|
||||
sqlite3VdbeAddOp4(v, OP_Eq, rLhs, labelOk, r2,
|
||||
int op = rLhs!=r2 ? OP_Eq : OP_NotNull;
|
||||
sqlite3VdbeAddOp4(v, op, rLhs, labelOk, r2,
|
||||
(void*)pColl, P4_COLLSEQ);
|
||||
VdbeCoverageIf(v, ii<pList->nExpr-1);
|
||||
VdbeCoverageIf(v, ii==pList->nExpr-1);
|
||||
VdbeCoverageIf(v, ii<pList->nExpr-1 && op==OP_Eq);
|
||||
VdbeCoverageIf(v, ii==pList->nExpr-1 && op==OP_Eq);
|
||||
VdbeCoverageIf(v, ii<pList->nExpr-1 && op==OP_NotNull);
|
||||
VdbeCoverageIf(v, ii==pList->nExpr-1 && op==OP_NotNull);
|
||||
sqlite3VdbeChangeP5(v, zAff[0]);
|
||||
}else{
|
||||
int op = rLhs!=r2 ? OP_Ne : OP_IsNull;
|
||||
assert( destIfNull==destIfFalse );
|
||||
sqlite3VdbeAddOp4(v, OP_Ne, rLhs, destIfFalse, r2,
|
||||
(void*)pColl, P4_COLLSEQ); VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp4(v, op, rLhs, destIfFalse, r2,
|
||||
(void*)pColl, P4_COLLSEQ);
|
||||
VdbeCoverageIf(v, op==OP_Ne);
|
||||
VdbeCoverageIf(v, op==OP_IsNull);
|
||||
sqlite3VdbeChangeP5(v, zAff[0] | SQLITE_JUMPIFNULL);
|
||||
}
|
||||
sqlite3ReleaseTempReg(pParse, regToFree);
|
||||
|
||||
Reference in New Issue
Block a user