📄 opcode.html
字号:
<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="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 serialized values exactly match the N serialized 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, 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.Register P3 must not be one of the function inputs.</p><p>P1 is a 32-bit bitmask indicating whether or not each argument to thefunction was determined to be constant at compile time. If the firstargument was constant then bit 0 of P1 is set. This is used to determinewhether meta data associated with a user function argument using thesqlite3_set_auxdata() API may be safely retained until the nextinvocation of this opcode.</p><p>See also: AggStep and AggFinal</td></tr><tr><td valign="top" align="center"><a name="Ge"></a><p>Ge</p><td><p>This works just like the Lt opcode except that the jump is taken ifthe content of register P3 is greater than or equal to the content ofregister P1. See the Lt opcode for additional information.</td></tr><tr><td valign="top" align="center"><a name="Gosub"></a><p>Gosub</p><td><p>Write the current address onto register P1and then jump to address P2.</td></tr><tr><td valign="top" align="center"><a name="Goto"></a><p>Goto</p><td><p>An unconditional jump to address P2.The next instruction executed will bethe one at index P2 from the beginning ofthe program.</td></tr><tr><td valign="top" align="center"><a name="Gt"></a><p>Gt</p><td><p>This works just like the Lt opcode except that the jump is taken ifthe content of register P3 is greater than the content ofregister P1. See the Lt opcode for additional information.</td></tr><tr><td valign="top" align="center"><a name="Halt"></a><p>Halt</p><td><p>Exit immediately. All open cursors, etc are closedautomatically.</p><p>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 determinewhether or not to rollback the current transaction. Do not rollbackif 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 theVDBE, but do not rollback the transaction.</p><p>If P4 is not null then it is an error message string.</p><p>There is an implied "Halt 0 0 0" instruction inserted at the very end ofevery program. So a jump past the last instruction of the programis the same as executing Halt.</td></tr><tr><td valign="top" align="center"><a name="IdxDelete"></a><p>IdxDelete</p><td><p>The content of P3 registers starting at register P2 forman unpacked index key. This opcode removes that entry from theindex opened by cursor P1.</td></tr><tr><td valign="top" align="center"><a name="IdxGE"></a><p>IdxGE</p><td><p>The P4 register values beginning with P3 form an unpacked indexkey that omits the ROWID. Compare this key value against the indexthat P1 is currently pointing to, ignoring the ROWID on the P1 index.</p><p>If the P1 index entry is greater than or equal to the key valuethen jump to P2. Otherwise fall through to the next instruction.</p><p>If P5 is non-zero then the key value is increased by an epsilonprior to the comparison. This make the opcode work like IdxGT exceptthat if the key from register P3 is a prefix of the key in the cursor,the result is false whereas it would be true with IdxGT.</td></tr><tr><td valign="top" align="center"><a name="IdxInsert"></a><p>IdxInsert</p><td><p>Register P2 holds a SQL index key made using theMakeIdxRec instructions. This opcode writes that keyinto the index P1. Data for the entry is nil.</p><p>P3 is a flag that provides a hint to the b-tree layer that thisinsert is likely to be an append.</p><p>This instruction only works for indices. The equivalent instructionfor tables is OP_Insert.</td></tr><tr><td valign="top" align="center"><a name="IdxLT"></a><p>IdxLT</p><td><p>The P4 register values beginning with P3 form an unpacked indexkey that omits the ROWID. Compare this key value against the indexthat P1 is currently pointing to, ignoring the ROWID on the P1 index.</p><p>If the P1 index entry is less than the key value then jump to P2.Otherwise fall through to the next instruction.</p><p>If P5 is non-zero then the key value is increased by an epsilon priorto the comparison. This makes the opcode work like IdxLE.</td></tr><tr><td valign="top" align="center"><a name="IdxRowid"></a><p>IdxRowid</p><td><p>Write into register P2 an integer which is the last entry in the record atthe end of the index key pointed to by cursor P1. This integer should bethe rowid of the table entry to which this index entry points.</p><p>See also: Rowid, MakeIdxRec.</td></tr><tr><td valign="top" align="center"><a name="If"></a><p>If</p><td><p>Jump to P2 if the value in register P1 is true. The value isis considered true if it is numeric and non-zero. If the valuein P1 is NULL then take the jump if P3 is true.</td></tr><tr><td valign="top" align="center"><a name="IfNeg"></a><p>IfNeg</p><td><p>If the value of register P1 is less than zero, jump to P2.</p><p>It is illegal to use this instruction on a register that doesnot contain an integer. An assertion fault will result if you try.</td></tr><tr><td valign="top" align="center"><a name="IfNot"></a><p>IfNot</p><td><p>Jump to P2 if the value in register P1 is False. The value isis considered true if it has a numeric value of zero. If the valuein P1 is NULL then take the jump if P3 is true.</td></tr><tr><td valign="top" align="center"><a name="IfPos"></a><p>IfPos</p><td><p>If the value of register P1 is 1 or greater, jump to P2.</p><p>It is illegal to use this instruction on a register that doesnot contain an integer. An assertion fault will result if you try.</td></tr><tr><td valign="top" align="center"><a name="IfZero"></a><p>IfZero</p><td><p>If the value of register P1 is exactly 0, jump to P2.</p><p>It is illegal to use this instruction on a register that doesnot contain an integer. An assertion fault will result if you try.</td></tr><tr><td valign="top" align="center"><a name="IncrVacuum"></a><p>IncrVacuum</p><td><p>Perform a single step of the incremental vacuum procedure onthe P1 database. If the vacuum has finished, jump to instructionP2. Otherwise, fall through to the next instruction.</td></tr><tr><td valign="top" align="center"><a name="Insert"></a><p>Insert</p><td><p>Write an entry into the table of cursor P1. A new entry iscreated if it doesn't already exist or the data for an existingentry is overwritten. The data is the value stored registernumber P2. The key is stored in register P3. The key mustbe an integer.</p><p>If the OPFLAG_NCHANGE flag of P5 is set, then the row change count isincremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set,then rowid is stored for subsequent return by thesqlite3_last_insert_rowid() function (otherwise it is unmodified).</p><p>Parameter P4 may point to a string containing the table-name, ormay be NULL. If it is not NULL, then the update-hook(sqlite3.xUpdateCallback) is invoked following a successful insert.</p><p>(WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamicallyallocated, then ownership of P2 is transferred to the pseudo-cursorand register P2 becomes ephemeral. If the cursor is changed, thevalue of register P2 will then change. Make sure this does notcause any problems.)</p><p>This instruction only works on tables. The equivalent instructionfor indices is OP_IdxInsert.</td></tr><tr><td valign="top" align="center"><a name="Int64"></a><p>Int64</p><td><p>P4 is a pointer to a 64-bit integer value.Write that value into register P2.</td></tr><tr><td valign="top" align="center"><a name="Integer"></a><p>Integer</p><td><p>The 32-bit integer value P1 is written into register P2.</td></tr><tr><td valign="top" align="center"><a name="IntegrityCk"></a><p>IntegrityCk</p><td><p>Do an analysis of the currently open database. Store inregister P1 the text of an error message describing any problems.If no problems are found, store a NULL in register P1.</p><p>The register P3 contains the maximum number of allowed errors.At most reg(P3) errors will be reported.In other words, the analysis stops as soon as reg(P1) errors areseen. Reg(P1) is updated with the number of errors remaining.</p><p>The root page numbers of all tables in the database are integerstored in reg(P1), reg(P1+1), reg(P1+2), .... There are P2 tablestotal.</p><p>If P5 is not zero, the check is done on the auxiliary databasefile, not the main database file.</p><p>This opcode is used to implement the integrity_check pragma.</td></tr><tr><td valign="top" align="center"><a name="IsNull"></a><p>IsNull</p><td><p>Jump to P2 if the value in register P1 is NULL. If P3 is greaterthan zero, then check all values reg(P1), reg(P1+1),reg(P1+2), ..., reg(P1+P3-1).</td></tr><tr><td valign="top" align="center"><a name="IsUnique"></a><p>IsUnique</p><td><p>The P3 register contains an integer record number. Call thisrecord number R. The P4 register contains an index key createdusing MakeRecord. Call it K.</p><p>P1 is an index. So it has no data and its key consists of arecord generated by OP_MakeRecord where the last field is therowid of the entry that the index refers to.</p><p>This instruction asks if there is an entry in P1 where thefields matches K but the rowid is different from R.If there is no such entry, then there is an immediatejump to P2. If any entry does exist where the index stringmatches K but the record number is not R, then the recordnumber for that entry is written into P3 and controlfalls through to the next instruction.</p><p>See also: NotFound, NotExists, Found</td></tr><tr><td valign="top" align="center"><a name="Jump"></a><p>Jump</p><td><p>Jump to the instruction at address P1, P2, or P3 depending on whetherin the most recent OP_Compare instruction the P1 vector was less thanequal to, or greater than the P2 vector, respectively.</td></tr><tr><td valign="top" align="center"><a name="Last"></a><p>Last</p><td><p>The next use of the Rowid or Column or Next instruction for P1will refer to the last entry in the database table or index.If the table or index is empty and P2>0, then jump immediately to P2.If P2 is 0 or if the table or index is not empty, fall throughto the following instruction.</td></tr><tr><td valign="top" align="center"><a name="Le"></a><p>Le</p><td><p>This works just like the Lt opcode except that the jump is taken ifthe content of register P3 is less than or equal to the content ofregister P1. See the Lt opcode for additional information.</td></tr><tr><td valign="top" align="center"><a name="LoadAnalysis"></a><p>LoadAnalysis</p><td><p>Read the sqlite_stat1 table for database P1 and load the contentof that table into the internal index hash table. This will causethe analysis to be used when preparing all subsequent queries.</td></tr><tr><td valign="top" align="center"><a name="Lt"></a><p>Lt</p><td><p>Compare the values in register P1 and P3. If reg(P3)<reg(P1) thenjump to address P2.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -