SQLite VDBE opcode

IsTrue

This opcode implements the IS TRUE, IS FALSE, IS NOT TRUE, and IS NOT FALSE operators.

An example

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

SELECT id IS TRUE FROM tracks
addropcodep1p2p3p4p5
0Init0800
1OpenRead1190k(2,,)0
2Rewind17100
3IdxRowid1200
4IsTrue21000
5ResultRow1100
6Next1301
7Halt0000
8Transaction00101
9Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Goto, Halt, IdxRowid, Init, Next, OpenRead, ResultRow, Rewind, Transaction.

What the SQLite documentation says

This opcode implements the IS TRUE, IS FALSE, IS NOT TRUE, and IS NOT FALSE operators.

Interpret the value in register P1 as a boolean value. Store that boolean (a 0 or 1) in register P2. Or if the value in register P1 is NULL, then the P3 is stored in register P2. Invert the answer if P4 is 1.

The logic is summarized like this:

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.

← IsNull · IsType →