Revert the OP_MustBeInt opcode implementation on this branch so that it again matches trunk. The extra functionality is no longer required.

FossilOrigin-Name: c02f77b1b4d025d4243f883d6f3a2b3abcaf4944e0209f641b62c576415343dc
This commit is contained in:
dan
2019-03-19 11:56:39 +00:00
parent d430c2eb46
commit e5166e070a
5 changed files with 57 additions and 25 deletions
+8 -14
View File
@@ -1723,25 +1723,19 @@ case OP_AddImm: { /* in1 */
break;
}
/* Opcode: MustBeInt P1 P2 * * P5
/* Opcode: MustBeInt P1 P2 * * *
**
** If P5 is 0, force the value in register P1 to be an integer. If
** the value in P1 is not an integer and cannot be converted into an
** integer without data loss, then jump immediately to P2, or if P2==0
** Force the value in register P1 to be an integer. If the value
** in P1 is not an integer and cannot be converted into an integer
** without data loss, then jump immediately to P2, or if P2==0
** raise an SQLITE_MISMATCH exception.
**
** Or, if P5 is non-zero, then force the register in P1 to be a number
** (real or integer). Jump to P2 if this cannot be accomplished without
** data loss. P2 must be non-zero in this case.
*/
case OP_MustBeInt: { /* jump, in1 */
u8 f;
f = (pOp->p5 ? (MEM_Int|MEM_Real) : MEM_Int);
pIn1 = &aMem[pOp->p1];
if( (pIn1->flags & f)==0 ){
if( (pIn1->flags & MEM_Int)==0 ){
applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);
VdbeBranchTaken((pIn1->flags&f)==0, 2);
if( (pIn1->flags & f)==0 ){
VdbeBranchTaken((pIn1->flags&MEM_Int)==0, 2);
if( (pIn1->flags & MEM_Int)==0 ){
if( pOp->p2==0 ){
rc = SQLITE_MISMATCH;
goto abort_due_to_error;
@@ -1750,7 +1744,7 @@ case OP_MustBeInt: { /* jump, in1 */
}
}
}
if( f==MEM_Int ) MemSetTypeFlag(pIn1, MEM_Int);
MemSetTypeFlag(pIn1, MEM_Int);
break;
}
+8 -2
View File
@@ -1302,8 +1302,14 @@ static void windowCheckValue(Parse *pParse, int reg, int eCond){
int regZero = sqlite3GetTempReg(pParse);
assert( eCond>=0 && eCond<ArraySize(azErr) );
sqlite3VdbeAddOp2(v, OP_Integer, 0, regZero);
sqlite3VdbeAddOp2(v, OP_MustBeInt, reg, sqlite3VdbeCurrentAddr(v)+2);
if( eCond>=WINDOW_STARTING_NUM ) sqlite3VdbeChangeP5(v, 1);
if( eCond>=WINDOW_STARTING_NUM ){
int regString = sqlite3GetTempReg(pParse);
sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC);
sqlite3VdbeAddOp3(v, OP_Ge, regString, sqlite3VdbeCurrentAddr(v)+2, reg);
sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC);
}else{
sqlite3VdbeAddOp2(v, OP_MustBeInt, reg, sqlite3VdbeCurrentAddr(v)+2);
}
VdbeCoverageIf(v, eCond==0);
VdbeCoverageIf(v, eCond==1);
VdbeCoverageIf(v, eCond==2);