ElseEq
This opcode must follow an Lt or Gt comparison operator.
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
2 of the 178 statements we compiled against the sample database use ElseEq. This is the one with the shortest program; the rows that use ElseEq are highlighted.
SELECT * FROM tracks WHERE (album_id, id) > (5, 10)
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 27 | 0 | 0 | |
| 1 | OpenRead | 0 | 4 | 0 | 6 | 0 |
| 2 | OpenRead | 1 | 5 | 0 | k(2,,) | 0 |
| 3 | Integer | 5 | 1 | 0 | 0 | |
| 4 | IsNull | 1 | 26 | 0 | 0 | |
| 5 | SeekGE | 1 | 26 | 1 | 1 | 0 |
| 6 | DeferredSeek | 1 | 0 | 0 | 0 | |
| 7 | Integer | 1 | 2 | 0 | 0 | |
| 8 | Column | 1 | 0 | 3 | 0 | |
| 9 | Gt | 4 | 16 | 3 | BINARY-8 | 68 |
| 10 | ElseEq | 0 | 13 | 0 | 0 | |
| 11 | ZeroOrNull | 3 | 2 | 4 | 0 | |
| 12 | Goto | 0 | 16 | 0 | 0 | |
| 13 | IdxRowid | 1 | 3 | 0 | 0 | |
| 14 | Gt | 5 | 16 | 3 | 68 | |
| 15 | ZeroOrNull | 3 | 2 | 5 | 0 | |
| 16 | IfNot | 2 | 25 | 1 | 0 | |
| 17 | IdxRowid | 1 | 6 | 0 | 0 | |
| 18 | Column | 1 | 0 | 7 | 0 | |
| 19 | Column | 0 | 2 | 8 | 0 | |
| 20 | Column | 0 | 3 | 9 | 0 | |
| 21 | Column | 0 | 4 | 10 | 0 | |
| 22 | Column | 0 | 5 | 11 | 0 | |
| 23 | RealAffinity | 11 | 0 | 0 | 0 | |
| 24 | ResultRow | 6 | 6 | 0 | 0 | |
| 25 | Next | 1 | 6 | 0 | 0 | |
| 26 | Halt | 0 | 0 | 0 | 0 | |
| 27 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 28 | Integer | 5 | 4 | 0 | 0 | |
| 29 | Integer | 10 | 5 | 0 | 0 | |
| 30 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Column, DeferredSeek, Goto, Gt, Halt, IdxRowid, IfNot, Init, Integer, IsNull, Next, OpenRead, RealAffinity, ResultRow, SeekGE, Transaction, ZeroOrNull.
What the SQLite documentation says
This opcode must follow an Lt or Gt comparison operator. There can be zero or more OP_ReleaseReg opcodes intervening, but no other opcodes are allowed to occur between this instruction and the previous Lt or Gt.
If the result of an Eq comparison on the same two operands as the prior Lt or Gt would have been true, then jump to P2. If the result of an Eq comparison on the two previous operands would have been false or NULL, then fall through.
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.
← DropTrigger · EndCoroutine →