VUpdate
P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
An example
2 of the 178 statements we compiled against the sample database use VUpdate. This is the one with the shortest program; the rows that use VUpdate are highlighted.
INSERT INTO lyrics VALUES (1, 'la la la')
| addr | opcode | p1 | p2 | p3 | p4 | p5 |
|---|---|---|---|---|---|---|
| 0 | Init | 0 | 7 | 0 | 0 | |
| 1 | Integer | 1 | 3 | 0 | 0 | |
| 2 | String8 | 0 | 4 | 0 | la la la | 0 |
| 3 | Null | 0 | 1 | 0 | 0 | |
| 4 | Null | 0 | 2 | 0 | 0 | |
| 5 | VUpdate | 1 | 7 | 1 | vtab:52B150 | 2 |
| 6 | Halt | 0 | 0 | 0 | 0 | |
| 7 | Transaction | 0 | 1 | 1 | 0 | 1 |
| 8 | VBegin | 0 | 0 | 0 | vtab:52B150 | 0 |
| 9 | Null | 0 | 5 | 0 | 0 | |
| 10 | Null | 0 | 6 | 0 | 0 | |
| 11 | Null | 0 | 7 | 0 | 0 | |
| 12 | Goto | 0 | 1 | 0 | 0 |
Open it in the EXPLAIN visualizer →
Also in this program: Goto, Halt, Init, Integer, Null, String8, Transaction, VBegin.
What the SQLite documentation says
P4 is a pointer to a virtual table object, an sqlite3_vtab structure. This opcode invokes the corresponding xUpdate method. P2 values are contiguous memory cells starting at P3 to pass to the xUpdate invocation. The value in register (P3+P2-1) corresponds to the p2th element of the argv array passed to xUpdate.
The xUpdate method will do a DELETE or an INSERT or both. The argv[0] element (which corresponds to memory cell P3) is the rowid of a row to delete. If argv[0] is NULL then no deletion occurs. The argv[1] element is the rowid of the new row. This can be NULL to have the virtual table select the new rowid for itself. The subsequent elements in the array are the values of columns in the new row.
If P2==1 then no insert is performed. argv[0] is the rowid of a row to delete.
P1 is a boolean flag. If it is set to true and the xUpdate call is successful, then the value returned by sqlite3_last_insert_rowid() is set to the value of the rowid for the row just inserted.
P5 is the error actions (OE_Replace, OE_Fail, OE_Ignore, etc) to apply in the case of a constraint failure on an insert or update.
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.