SQLite VDBE opcode

SoftNull

Set register P1 to have the value NULL as seen by the MakeRecord instruction, but do not free any string or blob memory associated with the register, so that if the value was a string or blob that was previously copied using SCopy, the copies will continue to be valid.

An example

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

INSERT INTO artists (name) VALUES ('Lower case')
addropcodep1p2p3p4p5
0Init02100
1OpenWrite02030
2OpenWrite170k(2,,)0
3OpenWrite260k(2,,)0
4SoftNull2000
5String8030Lower case0
6NewRowid0100
7HaltIfNull129923artists.name1
8Affinity230DBB0
9SCopy31200
10PureFunc0126lower(1)32
11IntCopy1700
12MakeRecord6250
13SCopy3900
14IntCopy11000
15MakeRecord9280
16MakeRecord23110
17IdxInsert156216
18IdxInsert289216
19Insert0111artists57
20Halt0000
21Transaction01101
22Null0400
23Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Affinity, Goto, Halt, HaltIfNull, IdxInsert, Init, Insert, IntCopy, MakeRecord, NewRowid, Null, OpenWrite, PureFunc, SCopy, String8, Transaction.

What the SQLite documentation says

Set register P1 to have the value NULL as seen by the MakeRecord instruction, but do not free any string or blob memory associated with the register, so that if the value was a string or blob that was previously copied using SCopy, the copies will continue to be valid.

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.

← ShiftRight · Sort →