SQLite VDBE opcode

InitCoroutine

Set up register P1 so that it will Yield to the coroutine located at address P3.

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

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

WITH RECURSIVE n(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM n WHERE i < 10) SELECT i FROM n
addropcodep1p2p3p4p5
0Init02900
1InitCoroutine12320
2OpenPseudo1210
3OpenEphemeral2100
4Integer1300
5MakeRecord3140
6NewRowid2500
7Insert2458
8Rewind22200
9NullRow1000
10RowData2200
11Delete2000
12Column1060
13Yield1000
14Column1040
15Ge7214BINARY-880
16Column1040
17Add8430
18MakeRecord3140
19NewRowid2500
20Insert2458
21Goto0800
22EndCoroutine1000
23InitCoroutine1020
24Yield12800
25Copy6902
26ResultRow9100
27Goto02400
28Halt0000
29Integer10700
30Integer1800
31Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Add, Column, Copy, Delete, EndCoroutine, Ge, Goto, Halt, Init, Insert, Integer, MakeRecord, NewRowid, NullRow, OpenEphemeral, OpenPseudo, ResultRow, Rewind, RowData, Yield.

What the SQLite documentation says

Set up register P1 so that it will Yield to the coroutine located at address P3.

If P2!=0 then the coroutine implementation immediately follows this opcode. So jump over the coroutine implementation to address P2.

See also: EndCoroutine

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.

← Init · Insert →