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

📄 opcode.html

📁 嵌入式数据库sqlite 3.5.9的文档
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a name="MakeRecord"></a><p>MakeRecord</p><td><p>Convert P2 registers beginning with P1 into a single entrysuitable for use as a data record in a database table or as a keyin an index.  The details of the format are irrelavant as long asthe OP_Column opcode can decode the record later.Refer to source code comments for the details of the recordformat.</p><p>P4 may be a string that is P2 characters long.  The nth character of thestring indicates the column affinity that should be used for the nthfield of the index key.</p><p>The mapping from character to affinity is given by the SQLITE_AFF_macros defined in sqliteInt.h.</p><p>If P4 is NULL then all index fields have the affinity NONE.</td></tr><tr><td valign="top" align="center"><a name="MemMax"></a><p>MemMax</p><td><p>Set the value of register P1 to the maximum of its current valueand the value in register P2.</p><p>This instruction throws an error if the memory cell is not initiallyan integer.</td></tr><tr><td valign="top" align="center"><a name="Move"></a><p>Move</p><td><p>Move the value in register P1 over into register P2.  Register P1is left holding a NULL.  It is an error for P1 and P2 to be thesame register.</td></tr><tr><td valign="top" align="center"><a name="MoveGe"></a><p>MoveGe</p><td><p>If cursor P1 refers to an SQL table (B-Tree that uses integer keys),use the integer value in register P3 as a key. If cursor P1 refersto an SQL index, then P3 is the first in an array of P4 registersthat are used as an unpacked index key.</p><p>Reposition cursor P1 so that  it points to the smallest entry thatis greater than or equal to the key value. If there are no recordsgreater than or equal to the key and P2 is not zero, then jump to P2.</p><p>A special feature of this opcode (and different from therelated OP_MoveGt, OP_MoveLt, and OP_MoveLe) is that if P2 iszero and P1 is an SQL table (a b-tree with integer keys) thenthe seek is deferred until it is actually needed.  It might bethe case that the cursor is never accessed.  By deferring theseek, we avoid unnecessary seeks.</p><p>See also: Found, NotFound, Distinct, MoveLt, MoveGt, MoveLe</td></tr><tr><td valign="top" align="center"><a name="MoveGt"></a><p>MoveGt</p><td><p>If cursor P1 refers to an SQL table (B-Tree that uses integer keys),use the integer value in register P3 as a key. If cursor P1 refersto an SQL index, then P3 is the first in an array of P4 registersthat are used as an unpacked index key.</p><p>Reposition cursor P1 so that  it points to the smallest entry thatis greater than the key value. If there are no records greater thanthe key and P2 is not zero, then jump to P2.</p><p>See also: Found, NotFound, Distinct, MoveLt, MoveGe, MoveLe</td></tr><tr><td valign="top" align="center"><a name="MoveLe"></a><p>MoveLe</p><td><p>If cursor P1 refers to an SQL table (B-Tree that uses integer keys),use the integer value in register P3 as a key. If cursor P1 refersto an SQL index, then P3 is the first in an array of P4 registersthat are used as an unpacked index key.</p><p>Reposition cursor P1 so that it points to the largest entry thatis less than or equal to the key value. If there are no recordsless than or equal to the key and P2 is not zero, then jump to P2.</p><p>See also: Found, NotFound, Distinct, MoveGt, MoveGe, MoveLt</td></tr><tr><td valign="top" align="center"><a name="MoveLt"></a><p>MoveLt</p><td><p>If cursor P1 refers to an SQL table (B-Tree that uses integer keys),use the integer value in register P3 as a key. If cursor P1 refersto an SQL index, then P3 is the first in an array of P4 registersthat are used as an unpacked index key.</p><p>Reposition cursor P1 so that  it points to the largest entry thatis less than the key value. If there are no records less thanthe key and P2 is not zero, then jump to P2.</p><p>See also: Found, NotFound, Distinct, MoveGt, MoveGe, MoveLe</td></tr><tr><td valign="top" align="center"><a name="Multiply"></a><p>Multiply</p><td><p>Multiply the value in regiser P1 by the value in regiser 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="MustBeInt"></a><p>MustBeInt</p><td><p>Force the value in register P1 to be an integer.  If the valuein P1 is not an integer and cannot be converted into an integerwithout data loss, then jump immediately to P2, or if P2==0raise an SQLITE_MISMATCH exception.</td></tr><tr><td valign="top" align="center"><a name="Ne"></a><p>Ne</p><td><p>This works just like the Lt opcode except that the jump is taken ifthe operands in registers P1 and P3 are not equal.  See the Lt opcode foradditional information.</td></tr><tr><td valign="top" align="center"><a name="NewRowid"></a><p>NewRowid</p><td><p>Get a new integer record number (a.k.a "rowid") used as the key to a table.The record number is not previously used as a key in the databasetable that cursor P1 points to.  The new record number is writtenwritten to register P2.</p><p>If P3&gt;0 then P3 is a register that holds the largest previouslygenerated record number.  No new record numbers are allowed to be lessthan this value.  When this value reaches its maximum, a SQLITE_FULLerror is generated.  The P3 register is updated with the generatedrecord number.  This P3 mechanism is used to help implement theAUTOINCREMENT feature.</td></tr><tr><td valign="top" align="center"><a name="Next"></a><p>Next</p><td><p>Advance cursor P1 so that it points to the next key/data pair in itstable or index.  If there are no more key/value pairs then fall throughto the following instruction.  But if the cursor advance was successful,jump immediately to P2.</p><p>The P1 cursor must be for a real table, not a pseudo-table.</p><p>See also: Prev</td></tr><tr><td valign="top" align="center"><a name="Noop"></a><p>Noop</p><td><p>Do nothing.  This instruction is often useful as a jumpdestination.</td></tr><tr><td valign="top" align="center"><a name="Not"></a><p>Not</p><td><p>Interpret the value in register P1 as a boolean value.  Replace itwith its complement.  If the value in register P1 is NULL its valueis unchanged.</td></tr><tr><td valign="top" align="center"><a name="NotExists"></a><p>NotExists</p><td><p>Use the content of register P3 as a integer key.  If a recordwith that key does not exist in table of P1, then jump to P2.If the record does exist, then fall thru.  The cursor is leftpointing to the record if it exists.</p><p>The difference between this operation and NotFound is that thisoperation assumes the key is an integer and that P1 is a table whereasNotFound assumes key is a blob constructed from MakeRecord andP1 is an index.</p><p>See also: Found, MoveTo, NotFound, IsUnique</td></tr><tr><td valign="top" align="center"><a name="NotFound"></a><p>NotFound</p><td><p>Register P3 holds a blob constructed by MakeRecord.  P1 isan index.  If no entry exists in P1 that matches the blob then jumpto P2.  If an entry does existing, fall through.  The cursor is leftpointing to the entry that matches.</p><p>See also: Found, MoveTo, NotExists, IsUnique</td></tr><tr><td valign="top" align="center"><a name="NotNull"></a><p>NotNull</p><td><p>Jump to P2 if the value in register P1 is not NULL.</td></tr><tr><td valign="top" align="center"><a name="Null"></a><p>Null</p><td><p>Write a NULL into register P2.</td></tr><tr><td valign="top" align="center"><a name="NullRow"></a><p>NullRow</p><td><p>Move the cursor P1 to a null row.  Any OP_Column operationsthat occur while the cursor is on the null row will alwayswrite a NULL.</td></tr><tr><td valign="top" align="center"><a name="OpenEphemeral"></a><p>OpenEphemeral</p><td><p>Open a new cursor P1 to a transient table.The cursor is always opened read/write even ifthe main database is read-only.  The transient or virtualtable is deleted automatically when the cursor is closed.</p><p>P2 is the number of columns in the virtual table.The cursor points to a BTree table if P4==0 and to a BTree indexif P4 is not 0.  If P4 is not NULL, it points to a KeyInfo structurethat defines the format of keys in the index.</p><p>This opcode was once called OpenTemp.  But that createdconfusion because the term "temp table", might refer eitherto a TEMP table at the SQL level, or to a table opened bythis opcode.  Then this opcode was call OpenVirtual.  Butthat created confusion with the whole virtual-table idea.</td></tr><tr><td valign="top" align="center"><a name="OpenPseudo"></a><p>OpenPseudo</p><td><p>Open a new cursor that points to a fake table that contains a singlerow of data.  Any attempt to write a second row of data causes thefirst row to be deleted.  All data is deleted when the cursor isclosed.</p><p>A pseudo-table created by this opcode is useful for holding theNEW or OLD tables in a trigger.  Also used to hold the a singlerow output from the sorter so that the row can be decomposed intoindividual columns using the OP_Column opcode.</p><p>When OP_Insert is executed to insert a row in to the pseudo table,the pseudo-table cursor may or may not make it's own copy of theoriginal row data. If P2 is 0, then the pseudo-table will copy theoriginal row data. Otherwise, a pointer to the original memory cellis stored. In this case, the vdbe program must ensure that thememory cell containing the row data is not overwritten until thepseudo table is closed (or a new row is inserted into it).</td></tr><tr><td valign="top" align="center"><a name="OpenRead"></a><p>OpenRead</p><td><p>Open a read-only cursor for the database table whose root page isP2 in a database file.  The database file is determined by P3.P3==0 means the main database, P3==1 means the database used fortemporary tables, and P3&gt;1 means used the corresponding attacheddatabase.  Give the new cursor an identifier of P1.  The P1values need not be contiguous but all P1 values should be small integers.It is an error for P1 to be negative.</p><p>If P5!=0 then use the content of register P2 as the root page, notthe value of P2 itself.</p><p>There will be a read lock on the database whenever there is anopen cursor.  If the database was unlocked prior to this instructionthen a read lock is acquired as part of this instruction.  A readlock allows other processes to read the database but prohibitsany other process from modifying the database.  The read lock isreleased 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="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,

⌨️ 快捷键说明

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