aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vdbe.c22
-rw-r--r--src/window.c10
2 files changed, 16 insertions, 16 deletions
diff --git a/src/vdbe.c b/src/vdbe.c
index 9098c07ac..50ec9edd1 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -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;
}
diff --git a/src/window.c b/src/window.c
index 6474de2be..62bfdafb0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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);