Param
This opcode is only ever present in sub-programs called via the Program instruction.
An example
3 of the 178 statements we compiled against the sample database use Param. This is the one with the shortest program; the rows that use Param are highlighted.
UPDATE tracks SET price = 1.29 WHERE id = 5
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 25 | 0 | 0 | |
| 1 | Null | 0 | 1 | 2 | 0 | |
| 2 | Noop | 3 | 0 | 1 | 0 | |
| 3 | OpenWrite | 0 | 4 | 0 | 6 | 0 |
| 4 | Integer | 5 | 16 | 0 | 0 | |
| 5 | SeekRowid | 0 | 7 | 16 | 0 | |
| 6 | Rowid | 0 | 2 | 0 | 0 | |
| 7 | IsNull | 2 | 24 | 0 | 0 | |
| 8 | Rowid | 0 | 3 | 0 | 0 | |
| 9 | Null | 0 | 4 | 0 | 0 | |
| 10 | Null | 0 | 5 | 0 | 0 | |
| 11 | Null | 0 | 6 | 0 | 0 | |
| 12 | Null | 0 | 7 | 0 | 0 | |
| 13 | Null | 0 | 8 | 0 | 0 | |
| 14 | Copy | 2 | 9 | 0 | 0 | |
| 15 | Null | 0 | 10 | 0 | 0 | |
| 16 | Column | 0 | 1 | 11 | 0 | |
| 17 | Column | 0 | 2 | 12 | 0 | |
| 18 | Column | 0 | 3 | 13 | 0 | |
| 19 | Column | 0 | 4 | 14 | 0 | |
| 20 | Real | 171798692 | 15 | 1072997335 | 0 | |
| 21 | MakeRecord | 10 | 6 | 1 | DDBDDE | 0 |
| 22 | Insert | 0 | 1 | 9 | tracks | 5 |
| 23 | Program | 2 | 24 | 17 | program | 1 |
| 24 | Halt | 0 | 0 | 0 | 0 | |
| 25 | Transaction | 0 | 1 | 1 | 0 | 1 |
| 26 | Goto | 0 | 1 | 0 | 0 | |
| 0 | Init | 0 | 1 | 0 | -- TRIGGER tracks_touch | 0 |
| 1 | Trace | 2147483647 | 1 | 0 | -- UPDATE albums SET year = year WHERE id = new.album_id | 0 |
| 2 | Null | 0 | 1 | 2 | 0 | |
| 3 | Noop | 1 | 0 | 1 | 0 | |
| 4 | OpenWrite | 0 | 3 | 0 | 4 | 0 |
| 5 | Param | 9 | 7 | 0 | 0 | |
| 6 | SeekRowid | 0 | 8 | 7 | 0 | |
| 7 | Rowid | 0 | 2 | 0 | 0 | |
| 8 | IsNull | 2 | 15 | 0 | 0 | |
| 9 | Null | 0 | 3 | 0 | 0 | |
| 10 | Column | 0 | 1 | 4 | 0 | |
| 11 | Column | 0 | 2 | 5 | 0 | |
| 12 | Column | 0 | 3 | 6 | 0 | |
| 13 | MakeRecord | 3 | 4 | 1 | DDBD | 0 |
| 14 | Insert | 0 | 1 | 2 | albums | 5 |
| 15 | ResetCount | 0 | 0 | 0 | 0 | |
| 16 | Halt | 0 | 0 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, Copy, Goto, Halt, Init, Insert, Integer, IsNull, MakeRecord, Noop, Null, OpenWrite, Program, Real, ResetCount, Rowid, SeekRowid, Trace, Transaction.
What the SQLite documentation says
This opcode is only ever present in sub-programs called via the Program instruction. Copy a value currently stored in a memory cell of the calling (parent) frame to cell P2 in the current frames address space. This is used by trigger programs to access the new.* and old.* values.
The address of the cell in the parent frame is determined by adding the value of the P1 argument to the value of the P1 argument to the calling Program instruction.
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.
← Pagecount · ParseSchema →