SQLite VDBE opcode

MakeRecord

Convert P2 registers beginning with P1 into the record format use as a data record in a database table or as a key in an index.

An example

68 of the 178 statements we compiled against the sample database use MakeRecord. This is the one with the shortest program; the rows that use MakeRecord 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, Found, Goto, Halt, IdxInsert, Init, Next, OpenEphemeral, OpenRead, ResultRow, Rewind, Transaction.

What the SQLite documentation says

Convert P2 registers beginning with P1 into the record format use as a data record in a database table or as a key in an index. The Column opcode can decode the record later.

P4 may be a string that is P2 characters long. The N-th character of the string indicates the column affinity that should be used for the N-th field of the index key.

The mapping from character to affinity is given by the SQLITE_AFF_ macros defined in sqliteInt.h.

If P4 is NULL then all index fields have the affinity BLOB.

The meaning of P5 depends on whether or not the SQLITE_ENABLE_NULL_TRIM compile-time option is enabled:

* If SQLITE_ENABLE_NULL_TRIM is enabled, then the P5 is the index of the right-most table that can be null-trimmed.

* If SQLITE_ENABLE_NULL_TRIM is omitted, then P5 has the value OPFLAG_NOCHNG_MAGIC if the MakeRecord opcode is allowed to accept no-change records with serial_type 10. This value is only used inside an assert() and does not affect the end result.

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.

← Lt · MaxPgcnt →