SQLite VDBE opcode

Clear

Delete all contents of the database table or index whose root page in the database file is given by P1.

An example

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

DELETE FROM notes
addropcodep1p2p3p4p5
0Init0300
1Clear110-1notes0
2Halt0000
3Transaction01101
4Goto0100

Open it in the EXPLAIN visualizer →

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

What the SQLite documentation says

Delete all contents of the database table or index whose root page in the database file is given by P1. But, unlike Destroy, do not remove the table or index from the database file.

The table being cleared is in the main database file if P2==0. If P2==1 then the table to be cleared is in the auxiliary database file that is used to store tables create using CREATE TEMPORARY TABLE.

If the P3 value is non-zero, then the row change count is incremented by the number of rows in the table being cleared. If P3 is greater than zero, then the value stored in register P3 is also incremented by the number of rows in the table being cleared.

See also: Destroy

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.

← Checkpoint · Close →