Lines Matching refs:rowid
2008 ** CAPI3REF: Last Insert Rowid
2011 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available
2012 ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
2015 ** is another alias for the rowid.
2017 ** ^This routine returns the [rowid] of the most recent
2022 ** ^(If an [INSERT] occurs within a trigger, then the [rowid] of the inserted
2045 ** function is running and thus changes the last insert [rowid],
2048 ** last insert [rowid].
2575 ** select random [ROWID | ROWIDs] when inserting new records into a table that
2576 ** already uses the largest possible [ROWID]. The PRNG is also used for
4702 ** ^The final callback parameter is the [rowid] of the row.
4703 ** ^In the case of an update, this is the [rowid] after the update takes place.
4882 ** ^If the specified column is "rowid", "oid" or "_rowid_" and an
5311 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
5374 ** by the rowid value passed as the second argument. Only the row can be
8901 ** The sqlite.lastRowid records the last insert rowid generated by an
8941 i64 lastRowid; /* ROWID of most recent insert (see above) */
9374 ** be set. An INTEGER PRIMARY KEY is used as the rowid for each row of
9375 ** the table. If a table has no INTEGER PRIMARY KEY, then a random rowid
9552 i64 rowid; /* Used by UNPACKED_PREFIX_SEARCH */
9561 #define UNPACKED_IGNORE_ROWID 0x0004 /* Ignore trailing rowid on key1 */
9788 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
10198 #define SRT_Table 8 /* Store result as data with an automatic rowid */
10228 int regCtr; /* Memory register holding the rowid counter */
10322 int regRowid; /* Register holding rowid of CREATE TABLE entry */
12009 ** the rowid is in VdbeCursor.iKey.
12014 i64 lastRowid; /* Last rowid from a Next or NextIdx operation */
12088 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
21361 /* 61 */ "Rowid",
34282 ** can be intermixed with tests to see if a given rowid has been
34345 i64 v; /* ROWID value for this entry */
34431 SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
34448 pEntry->v = rowid;
34452 if( p->isSorted && rowid<=pLast->v ){
44859 sqlite3_int64 cachedRowid; /* Next rowid cache. 0 means not valid */
45822 ** rowid iRow is being replaced or deleted. In this case invalidate
45827 i64 iRow, /* The rowid that might be changing */
48873 ** Set the cached rowid value of every cursor in the same database file
48877 ** Only positive rowid values are considered valid for this cache.
48893 ** Return the cached rowid for the given cursor. A negative or zero
48894 ** return value indicates that the rowid cache is invalid and should be
48895 ** ignored. If the rowid cache has never before been set, then a
52258 ** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
52995 "Rowid %lld out of order (previous was %lld)", info.nKey, nMaxKey);
53052 "Rowid %lld out of order (max larger than parent min of %lld)",
53058 "Rowid %lld out of order (min less than parent min of %lld)",
53063 "Rowid %lld out of order (max larger than parent max of %lld)",
53072 "Rowid %lld out of order (min less than parent max of %lld)",
58162 ** an index key, and thus ends with a rowid value. The last byte
58163 ** of the header will therefore be the serial type of the rowid:
58165 ** The serial type of the final rowid will always be a single byte.
58167 ** to ignore the rowid at the end of key1.
58228 ** rowid field were equal, then clear the PREFIX_SEARCH flag and set
58229 ** pPKey2->rowid to the value of the rowid field in (pKey1, nKey1).
58236 pPKey2->rowid = mem1.u.i;
58272 ** Read the rowid (the last field in the record) and store it in *rowid.
58278 SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
58282 u32 typeRowid; /* Serial type of the rowid */
58283 u32 lenRowid; /* Size of the rowid */
58313 /* The last field of the index should be an integer - the ROWID.
58335 *rowid = v.u.i;
58353 ** pUnpacked is either created without a rowid or is truncated so that it
58354 ** omits the rowid at the end. The rowid at the end of the index entry
58356 ** of the keys prior to the final rowid, not the entire key.
60745 i64 iKey; /* The rowid we are to seek to */
60765 i64 R; /* Rowid stored in register P3 */
60774 i64 v; /* The new rowid */
60775 VdbeCursor *pC; /* Cursor of table to get the new rowid */
60778 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
60784 i64 iKey; /* The integer ROWID or key for the record to be inserted */
60841 i64 rowid;
60965 sqlite_int64 rowid;
63689 i64 iKey; /* The rowid we are to seek to */
63835 ** P1 is an open table cursor and P2 is a rowid integer. Arrange
63836 ** for P1 to move so that it points to the rowid given by P2.
63952 ** the list field being the integer ROWID of the entry that the index
63958 ** The value of N can be inferred from the cursor. N includes the rowid
63959 rowid value may
63966 ** where the first (N-1) fields match but the rowid value at the end
63968 ** to instruction P2. Otherwise, the rowid of the conflicting index
63982 i64 R; /* Rowid stored in register P3 */
64025 ** to P2. Otherwise, copy the rowid of the conflicting record to
64028 if( (u.bc.r.flags & UNPACKED_PREFIX_SEARCH) || u.bc.r.rowid==u.bc.R ){
64031 pIn3->u.i = u.bc.r.rowid;
64109 ** Get a new integer record number (a.k.a "rowid") used as the key to a table.
64123 i64 v; /* The new rowid */
64124 VdbeCursor *pC; /* Cursor of table to get the new rowid */
64127 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
64139 /* The next rowid or record number (different terms for the same
64142 ** First we attempt to find the largest existing rowid and add one
64143 ** to that. But if the largest existing rowid is already the maximum
64147 ** The second algorithm is to select a rowid at random and see if
64149 ** succeeded. If the random rowid does exist, we select a new one
64220 /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the
64224 assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is
64235 /* collision - try another random rowid */
64269 ** then rowid is stored for subsequent return by the
64308 i64 iKey; /* The integer ROWID or key for the record to be inserted */
64405 /* If the update-hook will be invoked, set u.bg.iKey to the rowid of the
64535 /* Opcode: Rowid P1 P2 * * *
64608 ** The next use of the Rowid or Column or Next instruction for P1
64663 ** The next use of the Rowid or Column or Next instruction for P1
64842 ** the rowid of the table entry to which this index entry points.
64844 ** See also: Rowid, MakeRecord.
64850 i64 rowid;
64864 rc = sqlite3VdbeIdxRowid(db, u.bp.pCrsr, &u.bp.rowid);
64868 pOut->u.i = u.bp.rowid;
64878 ** key that omits the ROWID. Compare this key value against the index
64879 ** that P1 is currently pointing to, ignoring the ROWID on the P1 index.
64892 ** key that omits the ROWID. Compare this key value against the index
64893 ** that P1 is currently pointing to, ignoring the ROWID on the P1 index.
65137 "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",
66260 ** is the rowid of a row to delete. If argv[0] is NULL then no
66261 ** deletion occurs. The argv[1] element is the rowid of the new
66263 ** rowid for itself. The subsequent elements in the array are
66266 ** If P2==1 then no insert is performed. argv[0] is the rowid of
66271 ** is set to the value of the rowid for the row just inserted.
66279 sqlite_int64 rowid;
66298 rc = u.cl.pModule->xUpdate(u.cl.pVtab, u.cl.nArg, u.cl.apArg, &u.cl.rowid);
66302 db->lastRowid = u.cl.rowid;
66583 zErr = sqlite3MPrintf(p->db, "no such rowid: %lld", iRow);
66636 {OP_Variable, 1, 1, 1}, /* 5: Push the rowid to the stack */
67792 /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
67874 ** Perhaps the name is a reference to the ROWID
68056 /* The special operator TK_ROW means use the rowid for the first
68707 ** Expr.iColumn The column index in X.Y. -1 for the rowid.
70128 if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
70353 ** to be of the form "<rowid> IN (?, ?, ?)", where <rowid> is a reference
70378 int isRowid /* If true, LHS of IN operator is a rowid */
70643 /* In this case, the RHS is the ROWID of table b-tree
70954 ** is called. If iColumn<0 then code is generated that extracts the rowid.
71492 ** read the rowid field.
71495 ** parameter is set to 0 for an old.rowid reference, or to (i+1)
71497 ** i is the index of the column. For a new.rowid reference, p1 is
71508 ** p1==0 -> old.rowid p1==3 -> new.rowid
71523 (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName),
73492 int regRowid = iMem++; /* Rowid for the inserted record */
74776 zCol = "ROWID";
75712 ** The rowid for the new entry is left in register pParse->regRowid.
75714 ** The rowid and root page number values are needed by the code that
75946 ** then we will try to use that column as the rowid. Set the Table.iPKey
76411 "WHERE rowid=#%d",
79129 Expr *pWhereRowid = NULL; /* WHERE rowid .. */
79130 Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */
79131 Expr *pSelectRowid = NULL; /* SELECT rowid ... */
79133 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
79157 ** DELETE FROM table_a WHERE rowid IN (
79158 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
79180 /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */
79357 int iRowid = ++pParse->nMem; /* Used for storing rowid values. */
79415 ** maximum rowid counter values recorded while inserting into
79471 int iRowid, /* Memory cell that contains the rowid to delete */
79496 ** avoid copying the contents of the rowid register. */
81752 ** row being deleted from the scan by adding ($rowid != rowid) to the WHERE
81753 ** clause, where $rowid is the rowid of the row being deleted. */
81899 ** rowid of the row being deleted, followed by each of the column values
82090 ** UPDATE statement modifies the rowid fields of the table.
82100 int chngRowid /* True for UPDATE that affects rowid */
82472 ** rowid that appears as the last column in every index.
82595 ** that holds the maximum rowid.
82606 ** (2) Register to hold the maximum ROWID of pTab.
82607 ** (3) Register to hold the rowid in sqlite_sequence of pTab
82617 int memId = 0; /* Register holding maximum rowid */
82632 pInfo->regCtr = ++pToplevel->nMem; /* Max rowid register */
82633 pToplevel->nMem++; /* Rowid in sqlite_sequence */
82648 int memId; /* Register holding max rowid */
82678 ** Update the maximum rowid for an autoincrement calculation.
82681 ** new rowid that is about to be inserted. If that new rowid is
82682 ** larger than the maximum rowid in the memId memory cell, then the
82693 ** maximum rowid values back into the sqlite_sequence register.
82886 int regIns; /* Block of regs holding rowid+data being inserted */
82887 int regRowid; /* registers holding insert rowid */
83066 int regTempRowid; /* Register to hold temp table ROWID */
83215 /* Allocate registers for holding the rowid of the new row,
83237 ** not happened yet) so we substitute a rowid of -1
83443 ** maximum rowid counter values recorded while inserting into
83488 ** 1. The rowid of the row after the update.
83499 ** the address of a register containing the rowid before the update takes
83502 ** indicates that the rowid was explicitly specified as part of the
83503 ** INSERT statement. If rowidChng is false, it means that the rowid is
83504 ** computed automatically in an insert or that the rowid value is not
83564 int rowidChng, /* True if the rowid might collide with existing entry */
83697 ** REPLACE INTO t(rowid) VALUES($newrowid)
83839 ** rowid and the content to be inserted.
84048 int regData, regRowid; /* Registers holding data and rowid */
86647 sqlite3VdbeChangeP4(v, addr+1, "rowid ", P4_STATIC);
87297 "SELECT name, rootpage, sql FROM '%q'.%s ORDER BY rowid",
88800 ** declaration type for a ROWID field is INTEGER. Exactly when an expression
88878 ** rowid of the sub-select or view. This expression is legal (see
88895 zOriginCol = "rowid";
89021 zCol = "rowid";
89093 iCol>=0 ? pTab->aCol[iCol].zName : "rowid");
90317 ** entry in pEList. (But leave references to the ROWID column
93448 ** reg+0 OLD.rowid
93452 ** reg+N+1 NEW.rowid
93521 ** It is not possible to determine if the old.rowid or new.rowid column is
93588 Expr *pRowidExpr, /* Expression used to recompute the rowid */
93690 int regOldRowid; /* The old rowid */
93691 int regNewRowid; /* The new rowid */
93883 /* Remember the rowid of every item to be updated.
94102 ** maximum rowid counter values recorded while inserting into
94146 ** (A) The original rowid of that row.
94147 ** (B) The revised rowid for the row. (note1)
94164 Expr *pRowid, /* Expression used to recompute the rowid */
94930 ** The VM register number pParse->regRowid holds the rowid of an
94938 "WHERE rowid=#%d",
95748 #define WHERE_ROWID_EQ 0x00001000 /* rowid=EXPR or rowid IN (...) */
95749 #define WHERE_ROWID_RANGE 0x00002000 /* rowid<EXPR and/or rowid>EXPR */
96911 ** represent the rowid index that is part of every table. */
96918 ** one additional column containing the rowid. The rowid column
96926 int iColumn; /* The i-th column of the index. -1 for rowid */
96960 /* Index column i is the rowid. All other terms match. */
97988 ** selected plan may still take advantage of the tables built-in rowid
98112 ** for the rowid index. For other indexes, it is true unless all the
98775 zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid=?)", zMsg);
98777 zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid>? AND rowid<?)", zMsg);
98779 zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid>?)", zMsg);
98781 zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid<?)", zMsg);
98829 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
98911 ** equality comparison against the ROWID field. Or
98912 ** we reference multiple rows using a "rowid IN (...)"
98930 /* Case 2: We have an inequality comparison against the ROWID field.
99255 ** RowSetTest are such that the rowid of the current row is inserted
99260 ** RowSetTest # Insert rowid into rowset
99283 int regRowid = 0; /* Register holding rowid */
99781 ** SELECT * FROM t2, t1 WHERE t2.rowid = t1.a;
105394 ** Return the ROWID of the most recent insert
107069 ** 1. The specified column name was rowid", "oid" or "_rowid_"
108508 #define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */
109248 ** 1. Direct lookup by rowid or docid.
109267 /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */
109280 ** rowid/docid lookup, prefer the MATCH strategy. This is done even
109281 ** though the rowid/docid lookup is faster than a MATCH query, selecting
111317 ** retrieve the rowid for the current row of the result set. fts3
111318 ** exposes %_content.docid as the rowid for the virtual table. The
111319 ** rowid should be written to *pRowid.
111327 ** (not using the full-text index). In this case grab the rowid from the
111354 ** alias for "rowid", use the xRowid() method to obtain the value.
111383 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
114644 sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */
114645 sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */
114646 sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */
114763 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
114764 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
114770 /* 7 */ "SELECT * FROM %Q.'%q_content' WHERE rowid=?",
115209 ** apVal[1] rowid
115214 ** apVal[p->nColumn+3] Hidden "docid" column (alias for rowid)
115238 ** a value for the "rowid" field, for the "docid" field, or for both.
115239 ** Which is a problem, since "rowid" and "docid" are aliases for the
115242 ** INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2);
115245 ** for both docid and some other rowid alias.
115251 /* A rowid/docid conflict. */
117352 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
117357 sqlite3_int64 iRemove = 0; /* Rowid removed by UPDATE or DELETE */
119116 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER)
119122 ** table that maps from the entries rowid to the id of the node that it
119139 ** of 4-byte coordinates. For leaf nodes the integer is the rowid
119285 ** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates).
119746 ** node pNode. If pNode is a leaf node, this is a rowid. If it is
120181 /* This "scan" is a direct lookup by rowid. There is no next entry. */
120250 ** rowid iRowid. If successful, set *ppLeaf to point to the node and
120336 /* Special case - lookup by rowid. */
120412 ** 1 Unused Direct lookup by rowid.
120453 /* We have an equality constraint on the rowid. Use strategy 1. */
120463 /* This strategy involves a two rowid lookups on an B-Tree structures
120465 ** considered almost as quick as a direct rowid lookup (for which
121418 ** rowid of the row to delete, which can be used to find the leaf on which
121730 ** Select a currently unused rowid for a new r-tree record.
121758 /* If azData[0] is not an SQL NULL value, it is the rowid of a
121763 i64 iDelete; /* The rowid to delete */
121873 /* Figure out the rowid of the new row. */
121968 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1",
121970 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1",
121985 "CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);"
122198 ** list, containing the 8-byte rowid/pageno followed by the