sqlite_opcode/
constant.rs

1//! https://sqlite.org/opcode.html
2
3use strum_macros::EnumString;
4
5#[derive(Debug, EnumString)]
6pub enum Opcode {
7    Savepoint,
8    AutoCommit,
9    Transaction,
10    SorterNext, /* jump                                       */
11    Prev,       /* jump                                       */
12    Next,       /* jump                                       */
13    Checkpoint,
14    JournalMode,
15    Vacuum,
16    VFilter,       /* jump, synopsis: iplan=r[P3] zplan='P4'     */
17    VUpdate,       /* synopsis: data=r[P3@P2]                    */
18    Goto,          /* jump                                       */
19    Gosub,         /* jump                                       */
20    InitCoroutine, /* jump                                       */
21    Yield,         /* jump                                       */
22    MustBeInt,     /* jump                                       */
23    Jump,          /* jump                                       */
24    Once,          /* jump                                       */
25    If,            /* jump                                       */
26    Not,           /* same as TK_NOT, synopsis: r[P2]= !r[P1]    */
27    IfNot,         /* jump                                       */
28    IsNullOrType,  /* jump, synopsis: if typeof(r[P1]) IN (P3,5) goto P2 */
29    IfNullRow,     /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
30    SeekLT,        /* jump, synopsis: key=r[P3@P4]               */
31    SeekLE,        /* jump, synopsis: key=r[P3@P4]               */
32    SeekGE,        /* jump, synopsis: key=r[P3@P4]               */
33    SeekGT,        /* jump, synopsis: key=r[P3@P4]               */
34    IfNotOpen,     /* jump, synopsis: if( !csr[P1] ) goto P2     */
35    IfNoHope,      /* jump, synopsis: key=r[P3@P4]               */
36    NoConflict,    /* jump, synopsis: key=r[P3@P4]               */
37    NotFound,      /* jump, synopsis: key=r[P3@P4]               */
38    Found,         /* jump, synopsis: key=r[P3@P4]               */
39    SeekRowid,     /* jump, synopsis: intkey=r[P3]               */
40    NotExists,     /* jump, synopsis: intkey=r[P3]               */
41    Last,          /* jump                                       */
42    IfSmaller,     /* jump                                       */
43    SorterSort,    /* jump                                       */
44    Sort,          /* jump                                       */
45    Rewind,        /* jump                                       */
46    IdxLE,         /* jump, synopsis: key=r[P3@P4]               */
47    IdxGT,         /* jump, synopsis: key=r[P3@P4]               */
48    IdxLT,         /* jump, synopsis: key=r[P3@P4]               */
49    IdxGE,         /* jump, synopsis: key=r[P3@P4]               */
50    Or,            /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
51    And,           /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
52    RowSetRead,    /* jump, synopsis: r[P3]=rowset(P1)           */
53    RowSetTest,    /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
54    Program,       /* jump                                       */
55    FkIfZero,      /* jump, synopsis: if fkctr[P1]==0 goto P2    */
56    IfPos,         /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
57    IsNull,        /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
58    NotNull,       /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
59    Ne,            /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
60    Eq,            /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
61    Gt,            /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
62    Le,            /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
63    Lt,            /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
64    Ge,            /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
65    ElseEq,        /* jump, same as TK_ESCAPE                    */
66    IfNotZero,     /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
67    DecrJumpZero,  /* jump, synopsis: if (--r[P1])==0 goto P2    */
68    IncrVacuum,    /* jump                                       */
69    VNext,         /* jump                                       */
70    Filter,        /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
71    Init,          /* jump, synopsis: Start at P2                */
72    PureFunc,      /* synopsis: r[P3]=func(r[P2@NP])             */
73    Function,      /* synopsis: r[P3]=func(r[P2@NP])             */
74    Return,
75    EndCoroutine,
76    HaltIfNull, /* synopsis: if r[P3]=null halt               */
77    Halt,
78    Integer,  /* synopsis: r[P2]=P1                         */
79    Int64,    /* synopsis: r[P2]=P4                         */
80    String,   /* synopsis: r[P2]='P4' (len=P1)              */
81    Null,     /* synopsis: r[P2..P3]=NULL                   */
82    SoftNull, /* synopsis: r[P1]=NULL                       */
83    Blob,     /* synopsis: r[P2]=P4 (len=P1)                */
84    Variable, /* synopsis: r[P2]=parameter(P1,P4)           */
85    Move,     /* synopsis: r[P2@P3]=r[P1@P3]                */
86    Copy,     /* synopsis: r[P2@P3+1]=r[P1@P3+1]            */
87    SCopy,    /* synopsis: r[P2]=r[P1]                      */
88    IntCopy,  /* synopsis: r[P2]=r[P1]                      */
89    FkCheck,
90    ResultRow, /* synopsis: output=r[P1@P2]                  */
91    CollSeq,
92    AddImm, /* synopsis: r[P1]=r[P1]+P2                   */
93    RealAffinity,
94    Cast, /* synopsis: affinity(r[P1])                  */
95    Permutation,
96    Compare,    /* synopsis: r[P1@P3] <-> r[P2@P3]            */
97    IsTrue,     /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
98    ZeroOrNull, /* synopsis: r[P2] = 0 OR NULL                */
99    Offset,     /* synopsis: r[P3] = sqlite_offset(P1)        */
100    Column,     /* synopsis: r[P3]=PX                         */
101    TypeCheck,  /* synopsis: typecheck(r[P1@P2])              */
102    Affinity,   /* synopsis: affinity(r[P1@P2])               */
103    MakeRecord, /* synopsis: r[P3]=mkrec(r[P1@P2])            */
104    Count,      /* synopsis: r[P2]=count()                    */
105    ReadCookie,
106    SetCookie,
107    ReopenIdx,  /* synopsis: root=P2 iDb=P3                   */
108    OpenRead,   /* synopsis: root=P2 iDb=P3                   */
109    BitAnd,     /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
110    BitOr,      /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
111    ShiftLeft,  /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
112    ShiftRight, /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
113    Add,        /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
114    Subtract,   /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
115    Multiply,   /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
116    Divide,     /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
117    Remainder,  /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
118    Concat,     /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
119    OpenWrite,  /* synopsis: root=P2 iDb=P3                   */
120    OpenDup,
121    BitNot,        /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
122    OpenAutoindex, /* synopsis: nColumn=P2                       */
123    OpenEphemeral, /* synopsis: nColumn=P2                       */
124    String8,       /* same as TK_STRING, synopsis: r[P2]='P4'    */
125    SorterOpen,
126    SequenceTest, /* synopsis: if( cursor[P1].ctr++ ) pc = P2   */
127    OpenPseudo,   /* synopsis: P3 columns in r[P2]              */
128    Close,
129    ColumnsUsed,
130    SeekScan, /* synopsis: Scan-ahead up to P1 rows         */
131    SeekHit,  /* synopsis: set P2<=seekHit<=P3              */
132    Sequence, /* synopsis: r[P2]=cursor[P1].ctr++           */
133    NewRowid, /* synopsis: r[P2]=rowid                      */
134    Insert,   /* synopsis: intkey=r[P3] data=r[P2]          */
135    RowCell,
136    Delete,
137    ResetCount,
138    SorterCompare, /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
139    SorterData,    /* synopsis: r[P2]=data                       */
140    RowData,       /* synopsis: r[P2]=data                       */
141    Rowid,         /* synopsis: r[P2]=rowid                      */
142    NullRow,
143    SeekEnd,
144    IdxInsert,    /* synopsis: key=r[P2]                        */
145    SorterInsert, /* synopsis: key=r[P2]                        */
146    IdxDelete,    /* synopsis: key=r[P2@P3]                     */
147    DeferredSeek, /* synopsis: Move P3 to P1.rowid if needed    */
148    IdxRowid,     /* synopsis: r[P2]=rowid                      */
149    FinishSeek,
150    Destroy,
151    Clear,
152    ResetSorter,
153    CreateBtree, /* synopsis: r[P2]=root iDb=P1 flags=P3       */
154    SqlExec,
155    ParseSchema,
156    LoadAnalysis,
157    DropTable,
158    DropIndex,
159    DropTrigger,
160    Real, /* same as TK_FLOAT, synopsis: r[P2]=P4       */
161    IntegrityCk,
162    RowSetAdd, /* synopsis: rowset(P1)=r[P2]                 */
163    Param,
164    FkCounter,   /* synopsis: fkctr[P1]+=P2                    */
165    MemMax,      /* synopsis: r[P1]=max(r[P1],r[P2])           */
166    OffsetLimit, /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
167    AggInverse,  /* synopsis: accum=r[P3] inverse(r[P2@P5])    */
168    AggStep,     /* synopsis: accum=r[P3] step(r[P2@P5])       */
169    AggStep1,    /* synopsis: accum=r[P3] step(r[P2@P5])       */
170    AggValue,    /* synopsis: r[P3]=value N=P2                 */
171    AggFinal,    /* synopsis: accum=r[P1] N=P2                 */
172    Expire,
173    CursorLock,
174    CursorUnlock,
175    TableLock, /* synopsis: iDb=P1 root=P2 write=P3          */
176    VBegin,
177    VCreate,
178    VDestroy,
179    VOpen,
180    VInitIn, /* synopsis: r[P2]=ValueList(P1,P3)           */
181    VColumn, /* synopsis: r[P3]=vcolumn(P2)                */
182    VRename,
183    Pagecount,
184    MaxPgcnt,
185    FilterAdd, /* synopsis: filter(P1) += key(P3@P4)         */
186    Trace,
187    CursorHint,
188    ReleaseReg, /* synopsis: release r[P1@P2] mask P3         */
189    Noop,
190    Explain,
191    Abortable,
192}