SQLite VDBE opcode

Program

Execute the trigger program passed as P4 (type P4_SUBPROGRAM).

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

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

UPDATE tracks SET price = 1.29 WHERE id = 5
addropcodep1p2p3p4p5
0Init02500
1Null0120
2Noop3010
3OpenWrite04060
4Integer51600
5SeekRowid07160
6Rowid0200
7IsNull22400
8Rowid0300
9Null0400
10Null0500
11Null0600
12Null0700
13Null0800
14Copy2900
15Null01000
16Column01110
17Column02120
18Column03130
19Column04140
20Real1717986921510729973350
21MakeRecord1061DDBDDE0
22Insert019tracks5
23Program22417program1
24Halt0000
25Transaction01101
26Goto0100
0Init010-- TRIGGER tracks_touch0
1Trace214748364710-- UPDATE albums SET year = year WHERE id = new.album_id0
2Null0120
3Noop1010
4OpenWrite03040
5Param9700
6SeekRowid0870
7Rowid0200
8IsNull21500
9Null0300
10Column0140
11Column0250
12Column0360
13MakeRecord341DDBD0
14Insert012albums5
15ResetCount0000
16Halt0000

Open it in the EXPLAIN visualizer →

Also in this program: Column, Copy, Goto, Halt, Init, Insert, Integer, IsNull, MakeRecord, Noop, Null, OpenWrite, Param, Real, ResetCount, Rowid, SeekRowid, Trace, Transaction.

What the SQLite documentation says

Execute the trigger program passed as P4 (type P4_SUBPROGRAM).

P1 contains the address of the memory cell that contains the first memory cell in an array of values used as arguments to the sub-program. P2 contains the address to jump to if the sub-program throws an IGNORE exception using the RAISE() function. P2 might be zero, if there is no possibility that an IGNORE exception will be raised. Register P3 contains the address of a memory cell in this (the parent) VM that is used to allocate the memory required by the sub-vdbe at runtime.

P4 is a pointer to the VM containing the trigger program.

If P5 is non-zero, then recursive program invocation is enabled.

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.

← Prev · PureFunc →