📄 opcode.html
字号:
<p>P2 is the number of arguments that the step function takes andP4 is a pointer to the FuncDef for this function. The P2argument is not used by this opcode. It is only there to disambiguatefunctions that can take varying numbers of arguments. TheP4 argument is only needed for the degenerate case wherethe step function was not previously called.</td></tr><tr><td valign="top" align="center"><a name="AggStep"></a><p>AggStep</p><td><p>Execute the step function for an aggregate. Thefunction has P5 arguments. P4 is a pointer to the FuncDefstructure that specifies the function. Use registerP3 as the accumulator.</p><p>The P5 arguments are taken from register P2 and itssuccessors.</td></tr><tr><td valign="top" align="center"><a name="And"></a><p>And</p><td><p>Take the logical AND of the values in registers P1 and P2 andwrite the result into register P3.</p><p>If either P1 or P2 is 0 (false) then the result is 0 even ifthe other input is NULL. A NULL and true or two NULLs givea NULL output.</td></tr><tr><td valign="top" align="center"><a name="AutoCommit"></a><p>AutoCommit</p><td><p>Set the database auto-commit flag to P1 (1 or 0). If P2 is true, rollback any currently active btree transactions. If there are any activeVMs (apart from this one), then the COMMIT or ROLLBACK statement fails.</p><p>This instruction causes the VM to halt.</td></tr><tr><td valign="top" align="center"><a name="BitAnd"></a><p>BitAnd</p><td><p>Take the bit-wise AND of the values in register P1 and P2 andstore the result in register P3.If either input is NULL, the result is NULL.</td></tr><tr><td valign="top" align="center"><a name="BitNot"></a><p>BitNot</p><td><p>Interpret the content of register P1 as an integer. Replace itwith its ones-complement. If the value is originally NULL, leaveit unchanged.</td></tr><tr><td valign="top" align="center"><a name="BitOr"></a><p>BitOr</p><td><p>Take the bit-wise OR of the values in register P1 and P2 andstore the result in register P3.If either input is NULL, the result is NULL.</td></tr><tr><td valign="top" align="center"><a name="Blob"></a><p>Blob</p><td><p>P4 points to a blob of data P1 bytes long. Store thisblob in register P2. This instruction is not coded directlyby the compiler. Instead, the compiler layer specifiesan OP_HexBlob opcode, with the hex string representation ofthe blob as P4. This opcode is transformed to an OP_Blobthe first time it is executed.</td></tr><tr><td valign="top" align="center"><a name="Clear"></a><p>Clear</p><td><p>Delete all contents of the database table or index whose root pagein the database file is given by P1. But, unlike Destroy, do notremove the table or index from the database file.</p><p>The table being clear is in the main database file if P2==0. IfP2==1 then the table to be clear is in the auxiliary database filethat is used to store tables create using CREATE TEMPORARY TABLE.</p><p>See also: Destroy</td></tr><tr><td valign="top" align="center"><a name="Close"></a><p>Close</p><td><p>Close a cursor previously opened as P1. If P1 is notcurrently open, this instruction is a no-op.</td></tr><tr><td valign="top" align="center"><a name="CollSeq"></a><p>CollSeq</p><td><p>P4 is a pointer to a CollSeq struct. If the next call to a user functionor aggregate calls sqlite3GetFuncCollSeq(), this collation sequence willbe returned. This is used by the built-in min(), max() and nullif()functions.</p><p>The interface used by the implementation of the aforementioned functionsto retrieve the collation sequence set by this opcode is not availablepublicly, only to user functions defined in func.c.</td></tr><tr><td valign="top" align="center"><a name="Column"></a><p>Column</p><td><p>Interpret the data that cursor P1 points to as a structure built usingthe MakeRecord instruction. (See the MakeRecord opcode for additionalinformation about the format of the data.) Extract the P2-th columnfrom this record. If there are less that (P2+1)values in the record, extract a NULL.</p><p>The value extracted is stored in register P3.</p><p>If the KeyAsData opcode has previously executed on this cursor, then thefield might be extracted from the key rather than the data.</p><p>If the column contains fewer than P2 fields, then extract a NULL. Or,if the P4 argument is a P4_MEM use the value of the P4 argument asthe result.</td></tr><tr><td valign="top" align="center"><a name="Concat"></a><p>Concat</p><td><p>Add the text in register P1 onto the end of the text inregister P2 and store the result in register P3.If either the P1 or P2 text are NULL then store NULL in P3.</p><p>P3 = P2 || P1</p><p>It is illegal for P1 and P3 to be the same register. Sometimes,if P3 is the same register as P2, the implementation is ableto avoid a memcpy().</td></tr><tr><td valign="top" align="center"><a name="ContextPop"></a><p>ContextPop</p><td><p>Restore the Vdbe context to the state it was in when contextPush was lastexecuted. The context stores the last insert row id, the last statementchange count, and the current statement change count.</td></tr><tr><td valign="top" align="center"><a name="ContextPush"></a><p>ContextPush</p><td><p>Save the current Vdbe context such that it can be restored by a ContextPopopcode. The context stores the last insert row id, the last statement changecount, and the current statement change count.</td></tr><tr><td valign="top" align="center"><a name="Copy"></a><p>Copy</p><td><p>Make a copy of register P1 into register P2.</p><p>This instruction makes a deep copy of the value. A duplicateis made of any string or blob constant. See also OP_SCopy.</td></tr><tr><td valign="top" align="center"><a name="CreateIndex"></a><p>CreateIndex</p><td><p>Allocate a new index in the main database file if P1==0 or in theauxiliary database file if P1==1 or in an attached database ifP1>1. Write the root page number of the new table intoregister P2.</p><p>See documentation on OP_CreateTable for additional information.</td></tr><tr><td valign="top" align="center"><a name="CreateTable"></a><p>CreateTable</p><td><p>Allocate a new table in the main database file if P1==0 or in theauxiliary database file if P1==1 or in an attached database ifP1>1. Write the root page number of the new table intoregister P2</p><p>The difference between a table and an index is this: A table musthave a 4-byte integer key and can have arbitrary data. An indexhas an arbitrary key but no data.</p><p>See also: CreateIndex</td></tr><tr><td valign="top" align="center"><a name="Delete"></a><p>Delete</p><td><p>Delete the record at which the P1 cursor is currently pointing.</p><p>The cursor will be left pointing at either the next or the previousrecord in the table. If it is left pointing at the next record, thenthe next Next instruction will be a no-op. Hence it is OK to deletea record from within an Next loop.</p><p>If the OPFLAG_NCHANGE flag of P2 is set, then the row change count isincremented (otherwise not).</p><p>P1 must not be pseudo-table. It has to be a real table withmultiple rows.</p><p>If P4 is not NULL, then it is the name of the table that P1 ispointing to. The update hook will be invoked, if it exists.If P4 is not NULL then the P1 cursor must have been positionedusing OP_NotFound prior to invoking this opcode.</td></tr><tr><td valign="top" align="center"><a name="Destroy"></a><p>Destroy</p><td><p>Delete an entire database table or index whose root page in the databasefile is given by P1.</p><p>The table being destroyed is in the main database file if P3==0. IfP3==1 then the table to be clear is in the auxiliary database filethat is used to store tables create using CREATE TEMPORARY TABLE.</p><p>If AUTOVACUUM is enabled then it is possible that another root pagemight be moved into the newly deleted root page in order to keep allroot pages contiguous at the beginning of the database. The formervalue of the root page that moved - its value before the move occurred -is stored in register P2. If no pagemovement was required (because the table being dropped was alreadythe last one in the database) then a zero is stored in register P2.If AUTOVACUUM is disabled then a zero is stored in register P2.</p><p>See also: Clear</td></tr><tr><td valign="top" align="center"><a name="Divide"></a><p>Divide</p><td><p>Divide the value in register P1 by the value in register P2and store the result in register P3. If the value in register P2is zero, then the result is NULL.If either input is NULL, the result is NULL.</td></tr><tr><td valign="top" align="center"><a name="DropIndex"></a><p>DropIndex</p><td><p>Remove the internal (in-memory) data structures that describethe index named P4 in database P1. This is called after an indexis dropped in order to keep the internal representation of theschema consistent with what is on disk.</td></tr><tr><td valign="top" align="center"><a name="DropTable"></a><p>DropTable</p><td><p>Remove the internal (in-memory) data structures that describethe table named P4 in database P1. This is called after a tableis dropped in order to keep the internal representation of theschema consistent with what is on disk.</td></tr><tr><td valign="top" align="center"><a name="DropTrigger"></a><p>DropTrigger</p><td><p>Remove the internal (in-memory) data structures that describethe trigger named P4 in database P1. This is called after a triggeris dropped in order to keep the internal representation of theschema consistent with what is on disk.</td></tr><tr><td valign="top" align="center"><a name="Eq"></a><p>Eq</p><td><p>This works just like the Lt opcode except that the jump is taken ifthe operands in registers P1 and P3 are equal.See the Lt opcode for additional information.</td></tr><tr><td valign="top" align="center"><a name="Expire"></a><p>Expire</p><td><p>Cause precompiled statements to become expired. An expired statementfails with an error code of SQLITE_SCHEMA if it is ever executed(via sqlite3_step()).</p><p>If P1 is 0, then all SQL statements become expired. If P1 is non-zero,then only the currently executing statement is affected.</td></tr><tr><td valign="top" align="center"><a name="FifoRead"></a><p>FifoRead</p><td><p>Attempt to read a single integer from the Fifo. Store thatinteger in register P1.</p><p>If the Fifo is empty jump to P2.</td></tr><tr><td valign="top" align="center"><a name="FifoWrite"></a><p>FifoWrite</p><td><p>Write the integer from register P1 into the Fifo.</td></tr><tr><td valign="top" align="center"><a name="ForceInt"></a><p>ForceInt</p><td><p>Convert value in register P1 into an integer. If the valuein P1 is not numeric (meaning that is is a NULL or a string thatdoes not look like an integer or floating point number) thenjump to P2. If the value in P1 is numeric thenconvert it into the least integer that is greater than or equal to itscurrent value if P3==0, or to the least integer that is strictlygreater than its current value if P3==1.</td></tr><tr><td valign="top" align="center"><a name="Found"></a><p>Found</p><td><p>Register P3 holds a blob constructed by MakeRecord. P1 is an index.If an entry that matches the value in register p3 exists in P1 thenjump to P2. If the P3 value does not match any entry in P1then fall thru. The P1 cursor is left pointing at the matching entryif it exists.</p><p>This instruction is used to implement the IN operator where theleft-hand side is a SELECT statement. P1 may be a true index, or itmay be a temporary index that holds the results of the SELECTstatement. This instruction is also used to implement theDISTINCT keyword in SELECT statements.</p><p>This instruction checks if index P1 contains a record for whichthe first N serialised values exactly match the N serialised valuesin the record in register P3, where N is the total number of values inthe P3 record (the P3 record is a prefix of the P1 record).</p><p>See also: NotFound, MoveTo, IsUnique, NotExists</td></tr><tr><td valign="top" align="center"><a name="Function"></a><p>Function</p><td><p>Invoke a user function (P4 is a pointer to a Function structure thatdefines the function) with P5 arguments taken from register P2 andsuccessors. The result of the function is stored in register P3.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -