mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Add the OP_ZeroOrNull opcode and use it to compute boolean values for
scalar comparisons, rather than the SQLITE_STOREP2 parameter to the comparison opcode. FossilOrigin-Name: 93781b6f10a94fb273204b95156a8b90e07071f28c89e7966c659a0f44f60e98
This commit is contained in:
18
src/vdbe.c
18
src/vdbe.c
@@ -2502,6 +2502,24 @@ case OP_IsNull: { /* same as TK_ISNULL, jump, in1 */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: ZeroOrNull P1 P2 P3 * *
|
||||
** Synopsis: r[P2] = (P1,P3 NOT NULL) ? 0 : NULL;
|
||||
**
|
||||
** If both registers P1 and P3 are NOT NULL, then store a zero in
|
||||
** register P2. If either register P1 or register P3 or both contain
|
||||
** a NULL then store a NULL in register P2.
|
||||
*/
|
||||
case OP_ZeroOrNull: { /* in1, out2, in3 */
|
||||
if( (aMem[pOp->p1].flags & MEM_Null)!=0
|
||||
|| (aMem[pOp->p3].flags & MEM_Null)!=0
|
||||
){
|
||||
sqlite3VdbeMemSetNull(aMem + pOp->p2);
|
||||
}else{
|
||||
sqlite3VdbeMemSetInt64(aMem + pOp->p2, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: NotNull P1 P2 * * *
|
||||
** Synopsis: if r[P1]!=NULL goto P2
|
||||
**
|
||||
|
Reference in New Issue
Block a user