SQLite VDBE opcode

ReadCookie

Read cookie number P3 from database P1 and write it into register P2.

An example

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

PRAGMA user_version
addropcodep1p2p3p4p5
0Init0600
1Noop1100
2Transaction0000
3ReadCookie0160
4ResultRow1100
5Halt0000
6Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Goto, Halt, Init, Noop, ResultRow, Transaction.

What the SQLite documentation says

Read cookie number P3 from database P1 and write it into register P2. P3==1 is the schema version. P3==2 is the database format. P3==3 is the recommended pager cache size, and so forth. P1==0 is the main database file and P1==1 is the database file used to store temporary tables.

There must be a read-lock on the database (either a transaction must be started or there must be an open cursor) before executing this instruction.

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.

← PureFunc · Real →