SQLite VDBE opcode

Or

Take the logical OR of the values in register P1 and P2 and store the answer in register P3.

An example

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

SELECT (id > 5) AND (ms > 1000), (id > 5) OR (ms > 1000) FROM tracks
addropcodep1p2p3p4p5
0Init02400
1OpenRead04040
2Rewind02300
3Rowid0300
4Integer1100
5Gt47368
6ZeroOrNull3140
7Column0350
8Integer1300
9Gt6115BINARY-868
10ZeroOrNull5360
11And3110
12Rowid0300
13Integer1200
14Gt416368
15ZeroOrNull3240
16Column0350
17Integer1300
18Gt6205BINARY-868
19ZeroOrNull5360
20Or3220
21ResultRow1200
22Next0301
23Halt0000
24Transaction00101
25Integer5400
26Integer1000600
27Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: And, Column, Goto, Gt, Halt, Init, Integer, Next, OpenRead, ResultRow, Rewind, Rowid, Transaction, ZeroOrNull.

What the SQLite documentation says

Take the logical OR of the values in register P1 and P2 and store the answer in register P3.

If either P1 or P2 is nonzero (true) then the result is 1 (true) even if the other input is NULL. A NULL and false or two NULLs give a NULL output.

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.

← OpenWrite · Pagecount →