Halt
Exit immediately. All open cursors, etc are closed automatically.
An example
178 of the 178 statements we compiled against the sample database use Halt. This is the one with the shortest program; the rows that use Halt are highlighted.
BEGIN
Open it in the EXPLAIN visualizer →
Also in this program: AutoCommit, Goto, Init.
What the SQLite documentation says
Exit immediately. All open cursors, etc are closed automatically.
P1 is the result code returned by sqlite3_exec(), sqlite3_reset(), or sqlite3_finalize(). For a normal halt, this should be SQLITE_OK (0). For errors, it can be some other value. If P1!=0 then P2 will determine whether or not to rollback the current transaction. Do not rollback if P2==OE_Fail. Do the rollback if P2==OE_Rollback. If P2==OE_Abort, then back out all changes that have occurred during this execution of the VDBE, but do not rollback the transaction.
If P3 is not zero and P4 is NULL, then P3 is a register that holds the text of an error message.
If P3 is zero and P4 is not null then the error message string is held in P4.
P5 is a value between 1 and 4, inclusive, then the P4 error message string is modified as follows:
1: NOT NULL constraint failed: P4 2: UNIQUE constraint failed: P4 3: CHECK constraint failed: P4 4: FOREIGN KEY constraint failed: P4
If P3 is zero and P5 is not zero and P4 is NULL, then everything after the ":" is omitted.
There is an implied "Halt 0 0 0" instruction inserted at the very end of every program. So a jump past the last instruction of the program is the same as executing Halt.
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.
← Gt · HaltIfNull →