SQLite VDBE opcode

Affinity

Apply affinities to a range of P2 registers starting with P1.

An example

29 of the 178 statements we compiled against the sample database use Affinity. This is the one with the shortest program; the rows that use Affinity are highlighted.

SELECT * FROM genres WHERE name = ?
addropcodep1p2p3p4p5
0Init01100
1OpenRead190k(1,)2
2Variable1100
3IsNull11000
4Affinity110B0
5SeekGE110110
6IdxGT110110
7Column1020
8Column1130
9ResultRow2200
10Halt0000
11Transaction00101
12Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Column, Goto, Halt, IdxGT, Init, IsNull, OpenRead, ResultRow, SeekGE, Transaction, Variable.

What the SQLite documentation says

Apply affinities to a range of P2 registers starting with P1.

P4 is a string that is P2 characters long. The N-th character of the string indicates the column affinity that should be used for the N-th memory cell in the range.

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.

← AddImm · AggFinal →