SQLite VDBE opcode

Found

If P4==0 then register P3 holds a blob constructed by MakeRecord.

Jumps: P2 is an instruction address. In the listings here, a jump is drawn as an arc and the address is a link.

An example

7 of the 178 statements we compiled against the sample database use Found. This is the one with the shortest program; the rows that use Found are highlighted.

SELECT DISTINCT country FROM artists
addropcodep1p2p3p4p5
0Init01100
1OpenEphemeral100k(1,B)8
2OpenRead02030
3Rewind01000
4Column0210
5Found19110
6MakeRecord1120
7IdxInsert121116
8ResultRow1100
9Next0401
10Halt0000
11Transaction00101
12Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Column, Goto, Halt, IdxInsert, Init, MakeRecord, Next, OpenEphemeral, OpenRead, ResultRow, Rewind, Transaction.

What the SQLite documentation says

If P4==0 then register P3 holds a blob constructed by MakeRecord. If P4>0 then register P3 is the first of P4 registers that form an unpacked record.

Cursor P1 is on an index btree. If the record identified by P3 and P4 is a prefix of any entry in P1 then a jump is made to P2 and P1 is left pointing at the matching entry.

This operation leaves the cursor in a state where it can be advanced in the forward direction. The Next instruction will work, but not the Prev instruction.

See also: NotFound, NoConflict, NotExists. SeekGe

From sqlite.org's list of opcodes for SQLite 3.54.1, in the public domain. Opcodes are not a stable interface and change between releases.

← FkIfZero · Function →