AddImm
Add the constant P2 to the value in register P1.
An example
9 of the 178 statements we compiled against the sample database use AddImm. This is the one with the shortest program; the rows that use AddImm are highlighted.
PRAGMA incremental_vacuum
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 8 | 0 | 0 | |
| 1 | Expire | 1 | 1 | 0 | 0 | |
| 2 | Integer | 2147483647 | 1 | 0 | 0 | |
| 3 | IncrVacuum | 0 | 7 | 0 | 0 | |
| 4 | ResultRow | 1 | 0 | 0 | 0 | |
| 5 | AddImm | 1 | -1 | 0 | 0 | |
| 6 | IfPos | 1 | 3 | 0 | 0 | |
| 7 | Halt | 0 | 0 | 0 | 0 | |
| 8 | Transaction | 0 | 1 | 1 | 0 | 1 |
| 9 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Expire, Goto, Halt, IfPos, IncrVacuum, Init, Integer, ResultRow, Transaction.
What the SQLite documentation says
Add the constant P2 to the value in register P1. The result is always an integer.
To force any register to be an integer, just add 0.
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.