mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Add an experimental location(X) SQL function that attempt to return the
location of the payload within the database for the record that contains column X. location(X) returns NULL if X is not an ordinary table column or if SQLite cannot figure out the location because it is using a covering index. FossilOrigin-Name: 51be9558164301c5dd4df23ab8b3e67de0b522f8d36f79f3d84d45d3dc2a83a4
This commit is contained in:
20
src/vdbe.c
20
src/vdbe.c
@@ -2349,6 +2349,26 @@ case OP_IfNullRow: { /* jump */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: Location P1 P2 * * *
|
||||
** Synopsis: r[P2] = location(P1)
|
||||
**
|
||||
** Store in register r[P2] the location in the database file that is the
|
||||
** start of the payload for the record at which that cursor P1 is currently
|
||||
** pointing.
|
||||
*/
|
||||
case OP_Location: { /* out2 */
|
||||
VdbeCursor *pC; /* The VDBE cursor */
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
pC = p->apCsr[pOp->p1];
|
||||
pOut = out2Prerelease(p, pOp);
|
||||
if( pC==0 || pC->eCurType!=CURTYPE_BTREE ){
|
||||
pOut->flags = MEM_Null;
|
||||
}else{
|
||||
pOut->u.i = sqlite3BtreeLocation(pC->uc.pCursor);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: Column P1 P2 P3 P4 P5
|
||||
** Synopsis: r[P3]=PX
|
||||
**
|
||||
|
Reference in New Issue
Block a user