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
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 6 | 0 | 0 | |
| 1 | Noop | 1 | 1 | 0 | 0 | |
| 2 | Transaction | 0 | 0 | 0 | 0 | |
| 3 | ReadCookie | 0 | 1 | 6 | 0 | |
| 4 | ResultRow | 1 | 1 | 0 | 0 | |
| 5 | Halt | 0 | 0 | 0 | 0 | |
| 6 | Goto | 0 | 1 | 0 | 0 |
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.