mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Add support for the sqlite_unsupported_offset() SQL function if and only
if compiled using -DSQLITE_ENABLE_OFFSET_SQL_FUNC. Use that definition when compiling the command-line shell. FossilOrigin-Name: 4f1f1f521ae6da96b899e10bfeff6bc1ab7a45de0705076febaae20b441f48c6
This commit is contained in:
30
src/vdbe.c
30
src/vdbe.c
@@ -2349,6 +2349,36 @@ case OP_IfNullRow: { /* jump */
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
|
||||
/* Opcode: Offset P1 P2 P3 * *
|
||||
** Synopsis: r[P3] = sqlite_offset(P1)
|
||||
**
|
||||
** Store in register r[P3] the byte offset into the database file that is the
|
||||
** start of the payload for the record at which that cursor P1 is currently
|
||||
** pointing.
|
||||
**
|
||||
** P2 is the column number for the argument to the sqlite_offset() function.
|
||||
** This opcode does not use P2 itself, but the P2 value is used by the
|
||||
** code generator. The P1, P2, and P3 operands to this opcode are the
|
||||
** as as for OP_Column.
|
||||
**
|
||||
** This opcode is only available if SQLite is compiled with the
|
||||
** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option.
|
||||
*/
|
||||
case OP_Offset: { /* out3 */
|
||||
VdbeCursor *pC; /* The VDBE cursor */
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
pC = p->apCsr[pOp->p1];
|
||||
pOut = &p->aMem[pOp->p3];
|
||||
if( NEVER(pC==0) || pC->eCurType!=CURTYPE_BTREE ){
|
||||
sqlite3VdbeMemSetNull(pOut);
|
||||
}else{
|
||||
sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor));
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* SQLITE_ENABLE_OFFSET_SQL_FUNC */
|
||||
|
||||
/* Opcode: Column P1 P2 P3 P4 P5
|
||||
** Synopsis: r[P3]=PX
|
||||
**
|
||||
|
Reference in New Issue
Block a user