📄 opcode.html
字号:
<a name="RealAffinity"></a><p>RealAffinity</p><td><p>If register P1 holds an integer convert it to a real value.</p><p>This opcode is used when extracting information from a column thathas REAL affinity. Such column values may still be stored asintegers, for space efficiency, but after extraction we want themto have only a real value.</td></tr><tr><td valign="top" align="center"><a name="Remainder"></a><p>Remainder</p><td><p>Compute the remainder after integer division of the value inregister P1 by the value in register P2 and store the result in P3.If the value in register P2 is zero the result is NULL.If either operand is NULL, the result is NULL.</td></tr><tr><td valign="top" align="center"><a name="ResetCount"></a><p>ResetCount</p><td><p>This opcode resets the VMs internal change counter to 0. If P1 is true,then the value of the change counter is copied to the database handlechange counter (returned by subsequent calls to sqlite3_changes())before it is reset. This is used by trigger programs.</td></tr><tr><td valign="top" align="center"><a name="ResultRow"></a><p>ResultRow</p><td><p>The registers P1 throught P1+P2-1 contain a single row ofresults. This opcode causes the sqlite3_step() call to terminatewith an SQLITE_ROW return code and it sets up the sqlite3_stmtstructure to provide access to the top P1 values as the resultrow.</td></tr><tr><td valign="top" align="center"><a name="Return"></a><p>Return</p><td><p>Jump immediately to the next instruction after the last unreturnedOP_Gosub. If an OP_Return has occurred for all OP_Gosubs, thenprocessing aborts with a fatal error.</td></tr><tr><td valign="top" align="center"><a name="Rewind"></a><p>Rewind</p><td><p>The next use of the Rowid or Column or Next instruction for P1will refer to the first 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="RowData"></a><p>RowData</p><td><p>Write into register P2 the complete row data for cursor P1.There is no interpretation of the data.It is just copied onto the P2 register exactly asit is found in the database file.</p><p>If the P1 cursor must be pointing to a valid row (not a NULL row)of a real table, not a pseudo-table.</td></tr><tr><td valign="top" align="center"><a name="Rowid"></a><p>Rowid</p><td><p>Store in register P2 an integer which is the key of the table entry thatP1 is currently point to. If p2==0 then push the integer.</td></tr><tr><td valign="top" align="center"><a name="RowKey"></a><p>RowKey</p><td><p>Write into register P2 the complete row key for cursor P1.There is no interpretation of the data.The key is copied onto the P3 register exactly asit is found in the database file.</p><p>If the P1 cursor must be pointing to a valid row (not a NULL row)of a real table, not a pseudo-table.</td></tr><tr><td valign="top" align="center"><a name="SCopy"></a><p>SCopy</p><td><p>Make a shallow copy of register P1 into register P2.</p><p>This instruction makes a shallow copy of the value. If the valueis a string or blob, then the copy is only a pointer to theoriginal and hence if the original changes so will the copy.Worse, if the original is deallocated, the copy becomes invalid.Thus the program must guarantee that the original will not changeduring the lifetime of the copy. Use OP_Copy to make a completecopy.</td></tr><tr><td valign="top" align="center"><a name="Sequence"></a><p>Sequence</p><td><p>Find the next available sequence number for cursor P1.Write the sequence number into register P2.The sequence number on the cursor is incremented after thisinstruction.</td></tr><tr><td valign="top" align="center"><a name="SetCookie"></a><p>SetCookie</p><td><p>Write the content of register P3 (interpreted as an integer)into cookie number P2 of database P1.P2==0 is the schema version. P2==1 is the database format.P2==2 is the recommended pager cache size, and so forth. P1==0 isthe main database file and P1==1 is the database file used to storetemporary tables.</p><p>A transaction must be started before executing this opcode.</td></tr><tr><td valign="top" align="center"><a name="SetNumColumns"></a><p>SetNumColumns</p><td><p>Before the OP_Column opcode can be executed on a cursor, thisopcode must be called to set the number of fields in the table.</p><p>This opcode sets the number of columns for cursor P1 to P2.</p><p>If OP_KeyAsData is to be applied to cursor P1, it must be executedbefore this op-code.</td></tr><tr><td valign="top" align="center"><a name="ShiftLeft"></a><p>ShiftLeft</p><td><p>Shift the integer value in register P2 to the left by thenumber of bits specified by the integer in regiser P1.Store the result in register P3.If either input is NULL, the result is NULL.</td></tr><tr><td valign="top" align="center"><a name="ShiftRight"></a><p>ShiftRight</p><td><p>Shift the integer value in register P2 to the right by thenumber of bits specified by the integer in register P1.Store the result in register P3.If either input is NULL, the result is NULL.</td></tr><tr><td valign="top" align="center"><a name="Sort"></a><p>Sort</p><td><p>This opcode does exactly the same thing as OP_Rewind except thatit increments an undocumented global variable used for testing.</p><p>Sorting is accomplished by writing records into a sorting index,then rewinding that index and playing it back from beginning toend. We use the OP_Sort opcode instead of OP_Rewind to do therewinding so that the global variable will be incremented andregression tests can determine whether or not the optimizer iscorrectly optimizing out sorts.</td></tr><tr><td valign="top" align="center"><a name="Statement"></a><p>Statement</p><td><p>Begin an individual statement transaction which is part of a largerBEGIN..COMMIT transaction. This is needed so that the statementcan be rolled back after an error without having to roll back theentire transaction. The statement transaction will automaticallycommit when the VDBE halts.</p><p>The statement is begun on the database file with index P1. The maindatabase file has an index of 0 and the file used for temporary tableshas an index of 1.</td></tr><tr><td valign="top" align="center"><a name="String"></a><p>String</p><td><p>The string value P4 of length P1 (bytes) is stored in register P2.</td></tr><tr><td valign="top" align="center"><a name="String8"></a><p>String8</p><td><p>P4 points to a nul terminated UTF-8 string. This opcode is transformedinto an OP_String before it is executed for the first time.</td></tr><tr><td valign="top" align="center"><a name="Subtract"></a><p>Subtract</p><td><p>Subtract the value in register P1 from the value in register P2and store the result in register P3.If either input is NULL, the result is NULL.</td></tr><tr><td valign="top" align="center"><a name="TableLock"></a><p>TableLock</p><td><p>Obtain a lock on a particular table. This instruction is only used whenthe shared-cache feature is enabled.</p><p>If P1 is not negative, then it is the index of the databasein sqlite3.aDb[] and a read-lock is required. If P1 is negative, awrite-lock is required. In this case the index of the database is theabsolute value of P1 minus one (iDb = abs(P1) - 1;) and a write-lock isrequired.</p><p>P2 contains the root-page of the table to lock.</p><p>P4 contains a pointer to the name of the table being locked. This is onlyused to generate an error message if the lock cannot be obtained.</td></tr><tr><td valign="top" align="center"><a name="ToBlob"></a><p>ToBlob</p><td><p>Force the value in register P1 to be a BLOB.If the value is numeric, convert it to a string first.Strings are simply reinterpreted as blobs with no changeto the underlying data.</p><p>A NULL value is not changed by this routine. It remains NULL.</td></tr><tr><td valign="top" align="center"><a name="ToInt"></a><p>ToInt</p><td><p>Force the value in register P1 be an integer. IfThe value is currently a real number, drop its fractional part.If the value is text or blob, try to convert it to an integer using theequivalent of atoi() and store 0 if no such conversion is possible.</p><p>A NULL value is not changed by this routine. It remains NULL.</td></tr><tr><td valign="top" align="center"><a name="ToNumeric"></a><p>ToNumeric</p><td><p>Force the value in register P1 to be numeric (either aninteger or a floating-point number.)If the value is text or blob, try to convert it to an using theequivalent of atoi() or atof() and store 0 if no such conversionis possible.</p><p>A NULL value is not changed by this routine. It remains NULL.</td></tr><tr><td valign="top" align="center"><a name="ToReal"></a><p>ToReal</p><td><p>Force the value in register P1 to be a floating point number.If The value is currently an integer, convert it.If the value is text or blob, try to convert it to an integer using theequivalent of atoi() and store 0.0 if no such conversion is possible.</p><p>A NULL value is not changed by this routine. It remains NULL.</td></tr><tr><td valign="top" align="center"><a name="ToText"></a><p>ToText</p><td><p>Force the value in register P1 to be text.If the value is numeric, convert it to a string using theequivalent of printf(). Blob values are unchanged andare afterwards simply interpreted as text.</p><p>A NULL value is not changed by this routine. It remains NULL.</td></tr><tr><td valign="top" align="center"><a name="Trace"></a><p>Trace</p><td><p>If tracing is enabled (by the sqlite3_trace()) interface, thenthe UTF-8 string contained in P4 is emitted on the trace callback.</td></tr><tr><td valign="top" align="center"><a name="Transaction"></a><p>Transaction</p><td><p>Begin a transaction. The transaction ends when a Commit or Rollbackopcode is encountered. Depending on the ON CONFLICT setting, thetransaction might also be rolled back if an error is encountered.</p><p>P1 is the index of the database file on which the transaction isstarted. Index 0 is the main database file and index 1 is thefile used for temporary tables. Indices of 2 or more are used forattached databases.</p><p>If P2 is non-zero, then a write-transaction is started. A RESERVED lock isobtained on the database file when a write-transaction is started. Noother process can start another write transaction while this transaction isunderway. Starting a write transaction also creates a rollback journal. Awrite transaction must be started before any changes can be made to thedatabase. If P2 is 2 or greater then an EXCLUSIVE lock is also obtainedon the file.</p><p>If P2 is zero, then a read-lock is obtained on the database file.</td></tr><tr><td valign="top" align="center"><a name="Vacuum"></a><p>Vacuum</p><td><p>Vacuum the entire database. This opcode will cause other virtualmachines to be created and run. It may not be called from withina transaction.</td></tr><tr><td valign="top" align="center"><a name="Variable"></a><p>Variable</p><td><p>The value of variable P1 is written into register P2. A variable isan unknown in the original SQL string as handed to sqlite3_compile().Any occurance of the '?' character in the original SQL is considereda variable. Variables in the SQL string are number from left toright beginning with 1. The values of variables are set using thesqlite3_bind() API.</td></tr><tr><td valign="top" align="center"><a name="VBegin"></a><p>VBegin</p><td><p>P4 a pointer to an sqlite3_vtab structure. Call the xBegin methodfor that table.</td></tr><tr><td valign="top" align="center"><a name="VColumn"></a><p>VColumn</p><td><p>Store the value of the P2-th column ofthe row of the virtual-table that theP1 cursor is pointing to into register P3.</td></tr><tr><td valign="top" align="center"><a name="VCreate"></a><p>VCreate</p><td><p>P4 is the name of a virtual table in database P1. Call the xCreate methodfor that table.</td></tr><tr><td valign="top" align="center"><a name="VDestroy"></a><p>VDestroy</p><td><p>P4 is the name of a virtual table in database P1. Call the xDestroy methodof that table.</td></tr><tr><td valign="top" align="center"><a name="VerifyCookie"></a><p>VerifyCookie</p><td><p>Check the value of gl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -