MustBeInt
Force the value in register P1 to be an integer.
Jumps: P2 is an instruction address. In the listings here, a jump is drawn as an arc and the address is a link.
An example
8 of the 178 statements we compiled against the sample database use MustBeInt. This is the one with the shortest program; the rows that use MustBeInt are highlighted.
SELECT name FROM artists LIMIT ?
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 11 | 0 | 0 | |
| 1 | Variable | 1 | 1 | 0 | 0 | |
| 2 | MustBeInt | 1 | 0 | 0 | 0 | |
| 3 | IfNot | 1 | 10 | 0 | 0 | |
| 4 | OpenRead | 1 | 6 | 0 | k(2,,) | 0 |
| 5 | Rewind | 1 | 10 | 2 | 0 | 0 |
| 6 | Column | 1 | 0 | 2 | 0 | |
| 7 | ResultRow | 2 | 1 | 0 | 0 | |
| 8 | DecrJumpZero | 1 | 10 | 0 | 0 | |
| 9 | Next | 1 | 6 | 0 | 1 | |
| 10 | Halt | 0 | 0 | 0 | 0 | |
| 11 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 12 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, DecrJumpZero, Goto, Halt, IfNot, Init, Next, OpenRead, ResultRow, Rewind, Transaction, Variable.
What the SQLite documentation says
Force the value in register P1 to be an integer. If the value in P1 is not an integer and cannot be converted into an integer without data loss, then jump immediately to P2, or if P2==0 raise an SQLITE_MISMATCH exception.
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.