⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opcode.html

📁 sqlite的帮助文档
💻 HTML
📖 第 1 页 / 共 5 页
字号:
released when all cursors are closed.  If this instruction attemptsto get a read lock but fails, the script terminates with anSQLITE_BUSY error code.</p><p>The P4 value is a pointer to a KeyInfo structure that defines thecontent and collating sequence of indices.  P4 is NULL for cursorsthat are not pointing to indices.</p><p>See also OpenWrite.</td></tr><tr><td valign="top" align="center"><a name="OpenWrite"></a><p>OpenWrite</p><td><p>Open a read/write cursor named P1 on the table or index whose rootpage is P2.  Or if P5!=0 use the content of register P2 to find theroot page.</p><p>The P4 value is a pointer to a KeyInfo structure that defines thecontent and collating sequence of indices.  P4 is NULL for cursorsthat are not pointing to indices.</p><p>This instruction works just like OpenRead except that it opens the cursorin read/write mode.  For a given table, there can be one or more read-onlycursors or a single read/write cursor but not both.</p><p>See also OpenRead.</td></tr><tr><td valign="top" align="center"><a name="Or"></a><p>Or</p><td><p>Take the logical OR of the values in register P1 and P2 andstore the answer in register P3.</p><p>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 NULLsgive a NULL output.</td></tr><tr><td valign="top" align="center"><a name="Pagecount"></a><p>Pagecount</p><td><p>Write the current number of pages in database P1 to memory cell P2.</td></tr><tr><td valign="top" align="center"><a name="ParseSchema"></a><p>ParseSchema</p><td><p>Read and parse all entries from the SQLITE_MASTER table of database P1that match the WHERE clause P4.  P2 is the "force" flag.   Always dothe parsing if P2 is true.  If P2 is false, then this routine is ano-op if the schema is not currently loaded.  In other words, if P2is false, the SQLITE_MASTER table is only parsed if the rest of theschema is already loaded into the symbol table.</p><p>This opcode invokes the parser to create a new virtual machine,then runs the new virtual machine.  It is thus a re-entrant opcode.</td></tr><tr><td valign="top" align="center"><a name="Permutation"></a><p>Permutation</p><td><p>Set the permuation used by the OP_Compare operator to be the arrayof integers in P4.</p><p>The permutation is only valid until the next OP_Permutation, OP_Compare,OP_Halt, or OP_ResultRow.  Typically the OP_Permutation should occurimmediately prior to the OP_Compare.</td></tr><tr><td valign="top" align="center"><a name="Prev"></a><p>Prev</p><td><p>Back up cursor P1 so that it points to the previous key/data pair in itstable or index.  If there is no previous key/value pairs then fall throughto the following instruction.  But if the cursor backup was successful,jump immediately to P2.</p><p>The P1 cursor must be for a real table, not a pseudo-table.</td></tr><tr><td valign="top" align="center"><a name="ReadCookie"></a><p>ReadCookie</p><td><p>Read cookie number P3 from database P1 and write it into register P2.P3==0 is the schema version.  P3==1 is the database format.P3==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>If P1 is negative, then this is a request to read the size of adatabases free-list. P3 must be set to 1 in this case. The actualdatabase accessed is ((P1+1)*-1). For example, a P1 parameter of -1corresponds to database 0 ("main"), a P1 of -2 is database 1 ("temp").</p><p>There must be a read-lock on the database (either a transactionmust be started or there must be an open cursor) beforeexecuting this instruction.</td></tr><tr><td valign="top" align="center"><a name="Real"></a><p>Real</p><td><p>P4 is a pointer to a 64-bit floating point value.Write that value into register P2.</td></tr><tr><td valign="top" align="center"><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 through 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 to the next instruction after the address in register P1.</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&gt;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.</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>This opcode sets the number of columns for the cursor opened by thefollowing instruction to P2.</p><p>An OP_SetNumColumns is only useful if it occurs immediately beforeone of the following opcodes:</p><p>OpenReadOpenWriteOpenPseudo</p><p>If the OP_Column opcode is to be executed on a cursor, thenthis opcode must be present immediately before the opcode thatopens the cursor.</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 largertransaction.  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>If the database connection is currently in autocommit mode (thatis to say, if it is in between BEGIN and COMMIT)and if there are no other active statements on the same databaseconnection, then this operation is a no-op.  No statement transactionis needed since any error can use the normal ROLLBACK process toundo changes.</p><p>If a statement transaction is started, then a statement journal filewill be allocated and initialized.</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  the index of the database in sqlite3.aDb[] of the databaseon which the lock is acquired.  A readlock is obtained if P3==0 ora write lock if P3==1.</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 tex

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -