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')| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 21 | 0 | 0 | |
| 1 | OpenWrite | 0 | 2 | 0 | 3 | 0 |
| 2 | OpenWrite | 1 | 7 | 0 | k(2,,) | 0 |
| 3 | OpenWrite | 2 | 6 | 0 | k(2,,) | 0 |
| 4 | SoftNull | 2 | 0 | 0 | 0 | |
| 5 | String8 | 0 | 3 | 0 | Lower case | 0 |
| 6 | NewRowid | 0 | 1 | 0 | 0 | |
| 7 | HaltIfNull | 1299 | 2 | 3 | artists.name | 1 |
| 8 | Affinity | 2 | 3 | 0 | DBB | 0 |
| 9 | SCopy | 3 | 12 | 0 | 0 | |
| 10 | PureFunc | 0 | 12 | 6 | lower(1) | 32 |
| 11 | IntCopy | 1 | 7 | 0 | 0 | |
| 12 | MakeRecord | 6 | 2 | 5 | 0 | |
| 13 | SCopy | 3 | 9 | 0 | 0 | |
| 14 | IntCopy | 1 | 10 | 0 | 0 | |
| 15 | MakeRecord | 9 | 2 | 8 | 0 | |
| 16 | MakeRecord | 2 | 3 | 11 | 0 | |
| 17 | IdxInsert | 1 | 5 | 6 | 2 | 16 |
| 18 | IdxInsert | 2 | 8 | 9 | 2 | 16 |
| 19 | Insert | 0 | 11 | 1 | artists | 57 |
| 20 | Halt | 0 | 0 | 0 | 0 | |
| 21 | Transaction | 0 | 1 | 1 | 0 | 1 |
| 22 | Null | 0 | 4 | 0 | 0 | |
| 23 | Goto | 0 | 1 | 0 | 0 |
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 →