CollSeq
P4 is a pointer to a CollSeq object.
An example
6 of the 178 statements we compiled against the sample database use CollSeq. This is the one with the shortest program; the rows that use CollSeq are highlighted.
SELECT max(ms) FROM tracks
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 12 | 0 | 0 | |
| 1 | Null | 0 | 1 | 2 | 0 | |
| 2 | OpenRead | 0 | 4 | 0 | 4 | 0 |
| 3 | Rewind | 0 | 8 | 0 | 0 | |
| 4 | Column | 0 | 3 | 3 | 0 | |
| 5 | CollSeq | 0 | 0 | 0 | BINARY-8 | 0 |
| 6 | AggStep | 0 | 3 | 2 | max(1) | 1 |
| 7 | Next | 0 | 4 | 0 | 1 | |
| 8 | AggFinal | 2 | 1 | 0 | max(1) | 0 |
| 9 | Copy | 2 | 4 | 0 | 0 | |
| 10 | ResultRow | 4 | 1 | 0 | 0 | |
| 11 | Halt | 0 | 0 | 0 | 0 | |
| 12 | Transaction | 0 | 0 | 1 | 0 | 1 |
| 13 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: AggFinal, AggStep, Column, Copy, Goto, Halt, Init, Next, Null, OpenRead, ResultRow, Rewind, Transaction.
What the SQLite documentation says
P4 is a pointer to a CollSeq object. If the next call to a user function or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will be returned. This is used by the built-in min(), max() and nullif() functions.
If P1 is not zero, then it is a register that a subsequent min() or max() aggregate will set to 1 if the current row is not the minimum or maximum. The P1 register is initialized to 0 by this instruction.
The interface used by the implementation of the aforementioned functions to retrieve the collation sequence set by this opcode is not available publicly. Only built-in functions have access to this feature.
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.
← ClrSubtype · Column →