Lines Matching full:rowid
2117 ** CAPI3REF: Last Insert Rowid
2120 ** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
2122 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available
2123 ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
2126 ** is another alias for the rowid.
2128 ** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the
2129 ** most recent successful [INSERT] into a rowid table or [virtual table]
2131 ** ^Inserts into [WITHOUT ROWID] tables are not recorded.
2132 ** ^If no successful [INSERT]s into rowid tables
2137 ** method, then this routine will return the [rowid] of the inserted
2161 ** function is running and thus changes the last insert [rowid],
2164 ** last insert [rowid].
2722 ** select random [ROWID | ROWIDs] when inserting new records into a table that
2723 ** already uses the largest possible [ROWID]. The PRNG is also used for
5353 ** a rowid table.
5358 ** row is updated, inserted or deleted in a rowid table.
5366 ** ^The final callback parameter is the [rowid] of the row.
5367 ** ^In the case of an update, this is the [rowid] after the update takes place.
5371 ** ^The update hook is not invoked when [WITHOUT ROWID
5579 ** ^If the specified column is "rowid", "oid" or "_rowid_" and the table
5580 ** is not a [WITHOUT ROWID] table and an
5584 ** for the [rowid] are set as follows:
6077 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
6100 ** <li> ^(Table zTable is a WITHOUT ROWID table)^,
6156 ** by the rowid value passed as the second argument. Only the row can be
8115 sqlite3_int64 iRowid; /* Rowid for current entry */
8253 ** Returns the rowid of the current row.
8262 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
10510 #define OP_NewRowid 75 /* synopsis: r[P2]=rowid */
10539 #define OP_Rowid 104 /* synopsis: r[P2]=rowid */
10548 #define OP_IdxRowid 113 /* synopsis: r[P2]=rowid */
11690 i64 lastRowid; /* ROWID of most recent insert (see above) */
12194 i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
12231 #define TF_WithoutRowid 0x20 /* No rowid. PRIMARY KEY is the key */
12232 #define TF_NoVisibleRowid 0x40 /* No user-visible "rowid" column */
12249 /* Does the table have a rowid */
12345 ** for the rowid at the end.
12468 #define XN_ROWID (-1) /* Indexed column is the rowid */
12653 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
13093 #define SRT_Fifo 5 /* Store result as data with an automatic rowid */
13106 #define SRT_Table 14 /* Store result as data with an automatic rowid */
13134 int regCtr; /* Memory register holding the rowid counter */
13247 int regRowid; /* Register holding rowid of CREATE TABLE entry */
14400 #define IN_INDEX_ROWID 1 /* Search the rowid of the table */
15389 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
23558 ** read the rowid field.
26332 /* 75 */ "NewRowid" OpHelp("r[P2]=rowid"),
26361 /* 104 */ "Rowid" OpHelp("r[P2]=rowid"),
26370 /* 113 */ "IdxRowid" OpHelp("r[P2]=rowid"),
42391 ** can be intermixed with tests to see if a given rowid has been
42460 i64 v; /* ROWID value for this entry */
42577 SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
42586 pEntry->v = rowid;
42590 if( (p->rsFlags & ROWSET_SORTED)!=0 && rowid<=pLast->v ){
55005 ** rowid iRow is being replaced or deleted. In this case invalidate
55010 i64 iRow, /* The rowid that might be changing */
55123 ** (the rowid) is stored in pCur->nKey and pCur->pKey is left set to
62743 ** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
63646 checkAppendMsg(pCheck, "Rowid %lld out of order", info.nKey);
66099 int nCol = pIdx->nColumn; /* Number of index columns including rowid */
70756 ** Read the rowid (the last field in the record) and store it in *rowid.
70762 SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
70766 u32 typeRowid; /* Serial type of the rowid */
70767 u32 lenRowid; /* Size of the rowid */
70795 /* The last field of the index should be an integer - the ROWID.
70817 *rowid = v.u.i;
70835 ** pUnpacked is either created without a rowid or is truncated so that it
70836 ** omits the rowid at the end. The rowid at the end of the index entry
70838 ** of the keys prior to the final rowid, not the entire key.
73478 i64 lastRowid = db->lastRowid; /* Saved value of the last insert ROWID */
74556 lastRowid = db->lastRowid; /* Remember rowid changes made by xFunc */
76571 i64 iKey; /* The rowid we are to seek to */
76719 ** P1 is an open table cursor and P2 is a rowid integer. Arrange
76720 ** for P1 to move so that it points to the rowid given by P2.
76887 ** keys). P3 is an integer rowid. If P1 does not contain a record with
76888 ** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an
76889 ** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then
76959 ** Synopsis: r[P2]=rowid
76961 ** Get a new integer record number (a.k.a "rowid") used as the key to a table.
76974 i64 v; /* The new rowid */
76975 VdbeCursor *pC; /* Cursor of table to get the new rowid */
76978 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
76989 /* The next rowid or record number (different terms for the same
76992 ** First we attempt to find the largest existing rowid and add one
76993 ** to that. But if the largest existing rowid is already the maximum
76997 ** The second algorithm is to select a rowid at random and see if
76999 ** succeeded. If the random rowid does exist, we select a new one
77064 /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the
77068 assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is
77102 ** then rowid is stored for subsequent return by the
77141 i64 iKey; /* The integer ROWID or key for the record to be inserted */
77241 ** have also set the pC->movetoTarget field to the rowid of the row that
77422 /* Opcode: Rowid P1 P2 * * *
77423 ** Synopsis: r[P2]=rowid
77493 ** The next use of the Rowid or Column or Prev instruction for P1
77553 ** The next use of the Rowid or Column or Next instruction for P1
77801 ** Synopsis: r[P2]=rowid
77805 ** the rowid of the table entry to which this index entry points.
77807 ** See also: Rowid, MakeRecord.
77812 i64 rowid;
77832 rowid = 0; /* Not needed. Only used to silence a warning. */
77833 rc = sqlite3VdbeIdxRowid(db, pCrsr, &rowid);
77837 pOut->u.i = rowid;
77848 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
77859 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
77869 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
77871 ** ROWID on the P1 index.
77880 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
77882 ** ROWID on the P1 index.
78122 "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",
79341 ** is the rowid of a row to delete. If argv[0] is NULL then no
79342 ** deletion occurs. The argv[1] element is the rowid of the new
79344 ** rowid for itself. The subsequent elements in the array are
79347 ** If P2==1 then no insert is performed. argv[0] is the rowid of
79352 ** is set to the value of the rowid for the row just inserted.
79362 sqlite_int64 rowid;
79389 rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);
79394 db->lastRowid = lastRowid = rowid;
79707 zErr = sqlite3MPrintf(p->db, "no such rowid: %lld", iRow);
79758 {OP_Variable, 1, 1, 1}, /* 4: Push the rowid to the stack */
79807 sqlite3ErrorMsg(pParse, "cannot open table without rowid: %s", zTable);
82776 ** the comparison, ignore the rowid field at the end of each record.
83785 /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
83859 ** Perhaps the name is a reference to the ROWID
84094 /* The special operator TK_ROW means use the rowid for the first
84854 ** Expr.iColumn The column index in X.Y. -1 for the rowid.
86534 if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
86833 ** to be of the form "<rowid> IN (?, ?, ?)", where <rowid> is a reference
86852 int isRowid /* If true, LHS of IN operator is a rowid */
87172 /* In this case, the RHS is the ROWID of table b-tree
87463 int iTabCur, /* The table cursor. Or the PK cursor for WITHOUT ROWID */
87489 ** is called. If iColumn<0 then code is generated that extracts the rowid.
88041 ** read the rowid field.
88044 ** parameter is set to 0 for an old.rowid reference, or to (i+1)
88046 ** i is the index of the column. For a new.rowid reference, p1 is
88057 ** p1==0 -> old.rowid p1==3 -> new.rowid
88072 (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName),
90311 i64 iRowid; /* Rowid in main table of the key */
90312 u8 *aRowid; /* Key for WITHOUT ROWID tables */
90323 int nCol; /* Number of columns in index + pk/rowid */
90324 int nKeyCol; /* Number of index columns w/o the pk/rowid */
90348 /* Initialize the BLOB value of a ROWID
90364 /* Initialize the INTEGER value of a ROWID.
90412 ** N: The number of columns in the index including the rowid/pk (note 1)
90413 ** K: The number of columns in the index excluding the rowid/pk.
90417 ** WITHOUT ROWID table, N is the number of PRIMARY KEY columns, not the
90422 ** For indexes on ordinary rowid tables, N==K+1. But for indexes on
90423 ** WITHOUT ROWID tables, N=K+P where P is the number of columns in the
90425 ** original WITHOUT ROWID table as N==K as a special case.
90641 /* The "rows less-than" for the rowid column must be greater than that
90736 ** R Rowid for the current row. Might be a key record for
90737 ** WITHOUT ROWID tables.
90829 #define STAT_GET_ROWID 1 /* "rowid" column of stat[34] entry */
91010 int regNewRowid = iMem++; /* Rowid for the inserted record */
91014 int regRowid = iMem++; /* Rowid argument passed to stat_push() */
91104 ** regRowid = idx(rowid)
91113 ** the regPrev array and a trailing rowid (the rowid slot is required
91126 ** (1) the number of columns in the index including the rowid
91127 ** (or for a WITHOUT ROWID table, the number of PK columns),
91128 ** (2) the number of columns in the key without the rowid/pk
91212 ** regRowid = idx(rowid) // STAT34 only
91672 ** Look up an index by name. Or, if the name of a WITHOUT ROWID table
92703 zCol = "ROWID";
93804 ** The rowid for the new entry is left in register pParse->regRowid.
93806 ** The rowid and root page number values are needed by the code that
94090 ** then we will try to use that column as the rowid. Set the Table.iPKey
94473 ** has a WITHOUT ROWID clause. The job of this routine is to convert both
94475 ** are appropriate for a WITHOUT ROWID table instead of a rowid table.
94479 ** no rowid btree for a WITHOUT ROWID. Instead, the canonical
94491 ** (6) Replace the rowid tail on all automatically generated UNIQUE
94571 ** the final rowid column into one or more columns of the PRIMARY KEY.
94666 /* Special processing for WITHOUT ROWID Tables */
94670 "AUTOINCREMENT not allowed on WITHOUT ROWID tables");
94748 int regRowid; /* Rowid of the next row to insert */
94805 "WHERE rowid=#%d",
95709 Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */
95986 /* Append the table key to the end of the index. For WITHOUT ROWID
95988 ** normal tables (when pPk==0) this will be the rowid.
96099 ** of a WITHOUT ROWID table.
96119 ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In
96956 ** Code an OP_Halt due to non-unique rowid.
96961 Table *pTab /* The table with the non-unique rowid */
96970 zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName);
97829 Expr *pWhereRowid = NULL; /* WHERE rowid .. */
97830 Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */
97831 Expr *pSelectRowid = NULL; /* SELECT rowid ... */
97833 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
97856 ** DELETE FROM table_a WHERE rowid IN (
97857 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
97879 /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */
98080 /* For a rowid table, initialize the RowSet to an empty set */
98086 /* For a WITHOUT ROWID table, create an ephemeral table used to
98098 /* Construct a query to find the rowid or primary key for every row
98117 /* Extract the rowid or primary key for the current row */
98132 /* For ONEPASS, no need to store the rowid/primary-key. There is only
98155 /* Add the rowid of the row to be deleted to the RowSet */
98156 nKey = 1; /* OP_Seek always uses a single rowid */
98253 ** maximum rowid counter values recorded while inserting into
98296 ** in the case of a rowid table, or the PRIMARY KEY index in the case
98297 ** of a WITHOUT ROWID table.)
98368 ** avoid copying the contents of the rowid register. */
98450 ** for rowid tables or to the primary key index for WITHOUT ROWID
98474 Index *pPk; /* PRIMARY KEY index, or NULL for rowid tables */
98497 ** the entry that needs indexing. If pTab is a WITHOUT ROWID table, then
98521 ** on a table with multiple indices, and especially with the ROWID or
100847 ** for pTab. regBase itself holds the rowid. regBase+1 holds the first
100986 ** $current_rowid!=rowid
100989 ** The first form is used for rowid tables. The second form is used
100990 ** for WITHOUT ROWID tables. In the second form, the primary key is
101149 ** is set to -1). If the rowid column is modified by the UPDATE statement
101159 int bChngRowid /* True if rowid is modified by this update */
101176 ** is set to -1). If the rowid column is modified by the UPDATE statement
101231 ** rowid of the row being deleted, followed by each of the column values
101250 int bChngRowid /* True if rowid is UPDATEd */
101478 ** UPDATE statement modifies the rowid fields of the table.
101488 int chngRowid /* True for UPDATE that affects rowid */
101737 int bChngRowid /* True if rowid is UPDATEd */
101825 ** If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index
101868 ** rowid that appears as the last column in every index.
102005 ** that holds the maximum rowid.
102016 ** (2) Register to hold the maximum ROWID of pTab.
102017 ** (3) Register to hold the rowid in sqlite_sequence of pTab
102027 int memId = 0; /* Register holding maximum rowid */
102042 pInfo->regCtr = ++pToplevel->nMem; /* Max rowid register */
102043 pToplevel->nMem++; /* Rowid in sqlite_sequence */
102058 int memId; /* Register holding max rowid */
102090 ** Update the maximum rowid for an autoincrement calculation.
102093 ** new rowid that is about to be inserted. If that new rowid is
102094 ** larger than the maximum rowid in the memId memory cell, then the
102105 ** maximum rowid values back into the sqlite_sequence register.
102279 u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
102287 int regIns; /* Block of regs holding rowid+data being inserted */
102288 int regRowid; /* registers holding insert rowid */
102392 /* Allocate registers for holding the rowid of the new row,
102495 int regTempRowid; /* Register to hold temp table ROWID */
102614 ** not happened yet) so we substitute a rowid of -1
102730 ** Whenever this column is read, the rowid will be substituted
102821 ** maximum rowid counter values recorded while inserting into
102867 ** that regNewData points to) will contain the new rowid, or NULL in the
102868 ** case of a WITHOUT ROWID table. The second register in the range will
102878 ** rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table)
102882 ** For an INSERT, the pkChng boolean indicates whether or not the rowid
102884 ** is zero, it means that the either rowid is computed automatically or
102885 ** that the table is a WITHOUT ROWID table and has no rowid. On an INSERT,
102887 ** value for either the rowid column or its INTEGER PRIMARY KEY alias.
102898 ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY
102899 ** index when operating on a WITHOUT ROWID table. iIdxCur is the cursor
102951 u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */
102966 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
102967 int ipkTop = 0; /* Top of the rowid change constraint check */
102968 int ipkBottom = 0; /* Bottom of the rowid change constraint check */
102971 int regRowid = -1; /* Register holding ROWID value */
102980 /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
102981 ** normal rowid tables. nPkField is the number of key fields in the
102982 ** pPk index or 1 for a rowid table. In other words, nPkField is the
103069 /* If rowid is changing, make sure the new rowid does not previously
103075 /* Figure out what action to take in case of a rowid collision */
103084 /* pkChng!=0 does not mean that the rowid has change, only that
103085 ** it might have changed. Skip the conflict logic below if the rowid
103092 /* If the response to a rowid conflict is REPLACE but the response
103094 ** to defer the running of the rowid conflict checking until after
103106 /* Check to see if the new rowid already exists in the table. Skip
103111 /* Generate code that deals with a rowid collision */
103141 ** REPLACE INTO t(rowid) VALUES($newrowid)
103182 ** WITHOUT ROWID table.
103221 if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */
103228 VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
103236 ** of a WITHOUT ROWID table and there has been no change the
103266 /* Conflict only if the rowid of the existing index entry
103267 ** is different from old-rowid */
103287 /* If currently processing the PRIMARY KEY of a WITHOUT ROWID
103362 ** rowid and the content to be inserted.
103381 int regData; /* Content registers (after the rowid) */
103436 ** ROWID table) is returned in *piDataCur. The first index cursor is
103439 ** Use iBase as the first cursor (either the *piDataCur for rowid tables
103440 ** or the first index for WITHOUT ROWID tables) if it is non-negative.
103443 ** For a rowid table, *piDataCur will be exactly one less than *piIdxCur.
103444 ** For a WITHOUT ROWID table, *piDataCur will be somewhere in the range
103621 int regData, regRowid; /* Registers holding data and rowid */
103695 return 0; /* source and destination must both be WITHOUT ROWID or not */
103794 ** (If the destination is not initially empty, the rowid fields
107058 static const char *azCol[] = { "table", "rowid", "parent", "fkid" };
108086 "SELECT name, rootpage, sql FROM '%q'.%s ORDER BY rowid",
109959 ** declaration type for a ROWID field is INTEGER. Exactly when an expression
110051 ** rowid of the sub-select or view. This expression is legal (see
110072 zOrigCol = "rowid";
110210 zCol = "rowid";
110292 iCol>=0 ? pTab->aCol[iCol].zName : "rowid");
111745 ** entry in pEList. (But leave references to the ROWID column
115482 ** reg+0 OLD.rowid
115486 ** reg+N+1 NEW.rowid
115555 ** It is not possible to determine if the old.rowid or new.rowid column is
115623 Expr *pRowidExpr, /* Expression used to recompute the rowid */
115701 Index *pPk; /* The PRIMARY KEY index for WITHOUT ROWID tables */
115712 u8 chngPk; /* PRIMARY KEY changed in a WITHOUT ROWID table */
115713 u8 chngRowid; /* Rowid changed in a normal table */
115731 int nKey = 0; /* Number of elements in regKey for WITHOUT ROWID */
115736 int regOldRowid = 0; /* The old rowid */
115737 int regNewRowid = 0; /* The new rowid */
115850 j<0 ? "ROWID" : pTab->aCol[j].zName,
115957 /* Remember the rowid of every item to be updated.
116246 ** maximum rowid counter values recorded while inserting into
116293 ** (A) The original rowid of that row.
116294 ** (B) The revised rowid for the row.
116309 Expr *pRowid, /* Expression used to recompute the rowid */
116323 int regRowid; /* Register for ephem table rowid */
117187 ** The VM register number pParse->regRowid holds the rowid of an
117195 "WHERE rowid=#%d",
118586 if( i==XN_ROWID ) return "rowid";
118712 zRangeOp = ">? AND rowid<";
118719 sqlite3XPrintf(&str, 0, " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp);
119154 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
119251 ** equality comparison against the ROWID field. Or
119252 ** we reference multiple rows using a "rowid IN (...)"
119275 /* Case 3: We have an inequality comparison against the ROWID field.
119663 ** RowSetTest are such that the rowid of the current row is inserted
119668 ** RowSetTest # Insert rowid into rowset
119684 ** Added 2014-05-26: If the table is a WITHOUT ROWID table, then
119696 int regRowid = 0; /* Register holding rowid */
119737 ** capable of holding primary keys in the case of a WITHOUT ROWID.
119824 ** rowid (or PRIMARY KEY) for the current row so that the same
123978 ** variable sPk to represent the rowid primary key index. Make this
124010 && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
124572 ** Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row.
124584 ** The rowid for a table is always UNIQUE and NOT NULL so whenever the
124585 ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is
125248 /* TUNING: Cost of a rowid lookup is 10 */
125726 ** WITHOUT ROWID table. No need for a separate index */
128239 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
131687 ** Return the ROWID of the most recent insert
134098 ** 1. The specified column name was rowid", "oid" or "_rowid_"
135883 #define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */
136730 fts3Appendf(pRc, &zRet, "rowid");
137408 ** 1. Direct lookup by rowid or docid.
137448 /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */
137459 ** rowid/docid lookup, prefer the MATCH strategy. This is done even
137460 ** though the rowid/docid lookup is faster than a MATCH query, selecting
137494 /* If using a docid=? or rowid=? strategy, set the UNIQUE flag. */
137515 /* Regardless of the strategy selected, FTS can deliver rows in rowid (or
137575 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
137587 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
139042 sqlite3_value *pCons = 0; /* The MATCH or rowid constraint, if any */
139116 "SELECT %s WHERE rowid BETWEEN %lld AND %lld ORDER BY rowid %s",
139121 zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s",
139152 ** retrieve the rowid for the current row of the result set. fts3
139153 ** exposes %_content.docid as the rowid for the virtual table. The
139154 ** rowid should be written to *pRowid.
139187 ** alias for "rowid", use the xRowid() method to obtain the value.
139227 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
141846 sqlite3_int64 iRowid; /* Current rowid */
142082 /* Increment our pretend rowid value. */
142313 ** xRowid - Return the current rowid for the cursor.
142317 sqlite_int64 *pRowid /* OUT: Rowid value */
145526 int iRowid; /* Current 'rowid' value */
145867 ** xRowid - Return the current rowid for the cursor.
145871 sqlite_int64 *pRowid /* OUT: Rowid value */
146059 sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */
146060 sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */
146061 sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */
146211 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
146212 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
146218 /* 7 */ "SELECT %s WHERE rowid=?",
146859 ** apVal[1] rowid
146864 ** apVal[p->nColumn+3] Hidden "docid" column (alias for rowid)
146905 ** a value for the "rowid" field, for the "docid" field, or for both.
146906 ** Which is a problem, since "rowid" and "docid" are aliases for the
146909 ** INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2);
146912 ** for both docid and some other rowid alias.
146918 /* A rowid/docid conflict. */
150635 ** exists, is stored in the rowid==1 row of the %_stat table.
151377 ** SQLite value pRowid contains the rowid of a row that may or may not be
151434 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
151483 /* If this is an INSERT operation, or an UPDATE that modifies the rowid
151493 /* Find the value object that holds the new rowid value. */
151503 /* The new rowid is not NULL (in this case the rowid will be
151506 ** rowid column. So if the conflict mode is REPLACE, then delete any
151507 ** existing row with rowid=pNewRowid.
151510 ** the %_content table. If we hit the duplicate rowid constraint (or any
154096 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER)
154102 ** table that maps from the entries rowid to the id of the node that it
154119 ** of 4-byte coordinates. For leaf nodes the integer is the rowid
154273 ** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates).
154771 ** node pNode. If pNode is a leaf node, this is a rowid. If it is
155513 ** rowid iRowid. If successful, set *ppLeaf to point to the node and
155520 i64 iRowid, /* The rowid searching for */
155612 /* Special case - lookup by rowid. */
155711 ** 1 Unused Direct lookup by rowid.
155750 ** is, do not consider the lookup-by-rowid plan as using such a plan would
155766 /* We have an equality constraint on the rowid. Use strategy 1. */
155776 /* This strategy involves a two rowid lookups on an B-Tree structures
155778 ** considered almost as quick as a direct rowid lookup (for which
156437 ** rowid of the row to delete, which can be used to find the leaf on which
156747 ** Select a currently unused rowid for a new r-tree record.
156760 ** Remove the entry with rowid=iDelete from the r-tree structure.
156885 int bHaveRowid = 0; /* Set to 1 after new rowid is determined */
156895 ** 1. A duplicate rowid value, or
156939 /* If a rowid value was supplied, check if it is already present in
156963 /* If azData[0] is not an SQL NULL value, it is the rowid of a
156979 /* Figure out the rowid of the new row. */
157105 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1",
157107 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1",
157122 "CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);"
157347 ** list, containing the 8-byte rowid/pageno followed by the
158514 ** has no PRIMARY KEY, affected rows must be identified by rowid.
158562 ** key column - "rowid". Virtual tables for which the "rowid" column does
158656 ** UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
158660 ** table in "rowid" order is roughly the same as reading them sorted by
159081 ** 1: Table has an implicit rowid.
159084 ** 4: Table is WITHOUT ROWID.
159837 ** RBU_PK_NONE: Table has an implicit rowid.
159840 ** RBU_PK_WITHOUT_ROWID: Table is WITHOUT ROWID.
160421 ** CREATE TABLE t1(a, b, c, PRIMARY KEY(b, a DESC)) WITHOUT ROWID
160475 ** function creates a WITHOUT ROWID imposter table named "rbu_imposter2"
160483 ** CREATE TABLE rbu_imposter2(c1 TEXT, c2 REAL, id INTEGER) WITHOUT ROWID;
160533 "CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID",
160599 (pIter->eType==RBU_PK_WITHOUT_ROWID ? " WITHOUT ROWID" : "")
160697 "CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID",
165107 u32 iRowid; /* The rowid */
165379 /* Return the current rowid value */
165767 ** Returns the rowid of the current row.
165776 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
166230 /* Name of rank and rowid columns */
166232 #define FTS5_ROWID_NAME "rowid"
166291 ** the string "rowid" otherwise. This text is not quoted - if it is
166478 #define FTS5INDEX_QUERY_DESC 0x0002 /* Docs in descending rowid order */
166667 i64 iRowid, /* Rowid for this entry */
166708 #define FTS5_STMT_SCAN_ASC 0 /* SELECT rowid, * FROM ... ORDER BY 1 ASC */
166709 #define FTS5_STMT_SCAN_DESC 1 /* SELECT rowid, * FROM ... ORDER BY 1 DESC */
166710 #define FTS5_STMT_LOOKUP 2 /* SELECT rowid, * FROM ... WHERE rowid=? */
166781 ** // The document with rowid iRowid matches the expression!
169486 pRet->zContentRowid = sqlite3Fts5Strndup(&rc, "rowid", -1);
169839 int bDesc; /* Iterate in descending rowid order */
169859 i64 iRowid; /* Current rowid */
170070 ** Argument pTerm must be a synonym iterator. Return the current rowid
170180 ** pointing to the same rowid when this function is called. This function
170181 ** checks if the current rowid really is a match, and if so populates
170186 ** otherwise. It is not considered an error code if the current rowid is
170438 /* Find the firstest rowid any synonym points to. */
170442 ** is valid - each iterator that points to a rowid before iFrom. */
170494 int bDesc, /* True if iterator is "rowid DESC" */
170495 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
170520 int bDesc, /* True if iterator is "rowid DESC" */
170521 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
170610 ** point to the same rowid, and if not, advances them until they do.
170625 i64 iLast; /* Lastest rowid any iterator points to */
170627 int bMatch; /* True if all terms are at the same rowid */
170636 /* Initialize iLast, the "lastest" rowid any iterator points to. If the
170638 ** the maximum rowid. Or, if the iterator is "ORDER BY rowid DESC", then it
170639 ** means the minimum rowid. */
170814 ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the
170815 ** new lastest rowid seen so far. */
170866 ** rowid value iFrom. Whether "past" means "less than" or "greater than"
170941 ** c) the node is now at or past rowid iFrom.
170967 /* Advance the iterators until they all point to the same rowid */
171056 ** parameter is passed a non-zero value, iteration is in descending rowid
171059 ** If iterating in ascending rowid order (bDesc==0), the first document
171060 ** visited is that with the smallest rowid that is larger than or equal
171062 ** then the first document visited must have a rowid smaller than or
171076 /* If not at EOF but the current rowid occurs earlier than iFirst in
172076 ** * Rowid, as a varint
172078 ** * Size of previous position list and rowid, as a 4 byte
172082 ** Offset of last rowid written to data area. Relative to first byte of
172099 i64 iRowid; /* Rowid of last value written */
172238 i64 iRowid, /* Rowid for this entry */
172293 ** + 9 bytes for a new rowid,
172313 /* If this is a new rowid, append the 4-byte size field for the previous
172314 ** entry, and the new rowid for this entry. */
172539 ** records that contain a copy of the first rowid on each page spanned by
172623 ** varint: first rowid
172626 ** varint: rowid delta (always > 0)
172653 ** * The byte offset of the first rowid on the page, if it exists
172671 ** + if the first rowid on a page occurs before the first term, it
172674 ** varint: first rowid
172693 ** * First rowid on page indicated by previous field. As a varint.
172696 ** positive delta if the termless page contains at least one rowid,
172706 ** * Copy of first rowid on page indicated by previous field. As a varint.
172708 ** * A list of delta-encoded varints - the first rowid on each subsequent
172716 #define FTS5_AVERAGES_ROWID 1 /* Rowid used for the averages record */
172726 ** The rowid for each segment leaf is found by passing the segment id and
172796 i64 iWriteRowid; /* Rowid for current doc being written */
172858 i64 iPrev; /* Previous rowid value written to page */
172864 i64 iPrevRowid; /* Previous rowid written to current leaf */
172865 u8 bFirstRowidInDoclist; /* True if next rowid is first in doclist */
172866 u8 bFirstRowidInPage; /* True if next rowid is first in page */
172882 ** visiting each term/rowid pair in the merged data.
172893 ** points to the smaller term/rowid combination. Iterators at EOF are
172907 ** Object for iterating through a single segment, visiting each term/rowid
172919 ** rowid field of the current entry. Usually this is the size field of the
172920 ** position list data. The exception is if the rowid for the current entry
172939 ** it is set, iterate through rowid in descending order instead of the
172945 ** For each rowid on the page corresponding to the current term, the
172961 ** is the offset of the first rowid in the current doclist. */
172971 int *aRowidOffset; /* Array of offset to rowid fields */
172977 i64 iRowid; /* Current rowid */
173021 i64 iSwitchRowid; /* Firstest rowid of other than aFirst[1] */
173048 i64 iRowid; /* First rowid on leaf iLeafPgno */
173734 ** points to the first rowid in the doclist-index.
174022 ** Fts5SegIter.rowid
174098 ** the position-list size field for the first relevant rowid on the page.
174099 ** Fts5SegIter.rowid is set, but nPos and bDel are not.
174102 ** relevant rowid on the page and, if necessary, initializes the
174105 ** byte of the position list content associated with said rowid.
174164 ** thing on the page - i.e. the first rowid is on the following page.
174344 ** Iterator pIter currently points to the first rowid in a doclist. This
174361 ** position-list content for the current rowid. Back it up so that it
174365 /* If this condition is true then the largest rowid for the current
174367 ** see where said rowid really is. */
174372 /* The last rowid in the doclist may not be on the current page. Search
174373 ** forward to find the page containing the last rowid. */
174392 /* If pLast is NULL at this point, then the last rowid for this doclist
174395 ** field associated with the first relevant rowid on the page.
174398 ** rowid. In this case configure the iterator so that it points to the
174399 ** first rowid on this page.
174422 ** Iterator pIter currently points to the first rowid of a doclist.
174877 ** Move the seg-iter so that it points to the first rowid on page iLeafPgno.
174915 ** past rowid iFrom. Regardless of the value of iFrom, the iterator is
175002 ** points to the same term though - just a different rowid. This function
175126 ** The iterator initially points to the first term/rowid entry in the
175224 int bDesc, /* True for descending rowid order */
175269 ** Return the rowid of the entry that the iterator currently points
175551 ** Rowid iRowid has just been appended to the current leaf page. It is the
175569 ** a copy of iRowid (which will become the first rowid on the next
175572 ** also push its first rowid upwards. */
175583 /* This was the root node. Push its first rowid up to the new root. */
175737 ** Append a rowid and position-list size field to the writers output.
175752 /* If this is to be the first rowid written to the page, set the
175753 ** rowid-pointer in the page-header. Also append a value to the dlidx
175760 /* Write the rowid. */
176031 /* Append the rowid to the output */
176288 fts5PutU16(&pBuf->p[0], pBuf->n); /* first rowid on page */
176703 i64 *piLastRowid, /* IN/OUT: Previous rowid written (if any) */
176704 i64 iRowid /* Rowid to append */
176811 int bDesc, /* True for "ORDER BY rowid DESC" */
176887 ** to the document with rowid iRowid.
177085 ** Open a new iterator to iterate though all rowid that match the
177159 ** Move to the next matching rowid.
177168 ** Move to the next matching term/rowid. Used by the fts5vocab module.
177189 ** Move to the next matching rowid that occurs at or after iMatch. The
177191 ** in ascending or descending rowid order.
177199 ** Return the current rowid.
177249 i64 *piRowid /* OUT: Current rowid */
177412 ** Instead, it tests that the same set of pgno/rowid combinations are
177468 i64 rowid = sqlite3Fts5IterRowid(pIdxIter);
177478 cksum ^= fts5IndexEntryCksum(rowid, iCol, iOff, iIdx, z, n);
177659 i64 iRow; /* Rowid for this leaf */
177676 ** is also a rowid pointer within the leaf page header, it points to a
177682 int iRowidOff; /* Offset of first rowid on leaf */
177723 /* Check any rowid-less pages that occur before the current leaf. */
177735 ** contain the rowid suggested by the same. */
177889 ** Decode a segment-data rowid from the %_data table. This function is
177893 i64 iRowid, /* Rowid from %_data table */
177912 int iSegid, iHeight, iPgno, bDlidx; /* Rowid compenents */
178056 i64 iRowid; /* Rowid for record being decoded */
178057 int iSegid,iHeight,iPgno,bDlidx;/* Rowid components */
178373 ** SELECT rowid, <fts> FROM <fts> ORDER BY +rank;
178382 i64 iRowid; /* Current rowid */
178402 ** <tbl> MATCH <expr> AND rowid BETWEEN $iFirstRowid AND $iLastRowid
178404 ** If the cursor iterates in descending order of rowid, iFirstRowid
178405 ** is the upper limit (i.e. the "first" rowid visited) and iLastRowid
178416 int bDesc; /* True for "ORDER BY rowid DESC" queries */
178450 #define FTS5_BI_ROWID_EQ 0x0004 /* rowid == ? */
178451 #define FTS5_BI_ROWID_LE 0x0008 /* rowid <= ? */
178452 rowid >= ? */
178679 #define FTS5_PLAN_ROWID 6 /* (rowid = ?) */
178700 ** 3. An == constraint against the rowid column.
178701 ** 4. A < or <= constraint against the rowid column.
178702 ** 5. A > or >= constraint against the rowid column.
178707 ** 6. ORDER BY rowid [ASC|DESC]
178718 ** * One rowid range constraint: cost=750.0
178719 ** * Both rowid range constraints: cost=500.0
178720 ** * An == rowid constraint: cost=100.0
178725 ** * One rowid range constraint: cost=750000.0
178726 ** * Both rowid range constraints: cost=250000.0
178727 ** * An == rowid constraint: cost=10.0
178742 int iCol; /* 0==rowid, 1==tbl, 2==rank */
178984 ** is using. Then attempt to move the cursor to a rowid equal to or laster
178985 ** (in the cursors sort order - ASC or DESC) than the current rowid.
178987 ** If the new rowid is not equal to the old, set output parameter *pbSkip
179092 "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s",
179289 ** 2. A by-rowid lookup.
179304 int bDesc; /* True if ORDER BY [rank|rowid] DESC */
179308 sqlite3_value *pRowidEq = 0; /* rowid = ? expression (or NULL) */
179309 sqlite3_value *pRowidLe = 0; /* rowid <= ? expression (or NULL) */
179310 sqlite3_value *pRowidGe = 0; /* rowid >= ? expression (or NULL) */
179342 /* Set the cursor upper and lower rowid limits. Only some strategies
179345 ** on the rowid field. */
179403 ** by rowid (ePlan==FTS5_PLAN_ROWID). */
179433 ** Return the rowid that the cursor currently points to.
179449 ** retrieve the rowid for the current row of the result set. fts5
179450 ** exposes %_content.rowid as the rowid for the virtual table. The
179451 ** rowid should be written to *pRowid.
179629 ** A delete specifies a single argument - the rowid of the row to remove.
179633 ** 1. The "old" rowid, or NULL.
179634 ** 2. The "new" rowid.
179642 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
179679 ** any conflict on the rowid value must be detected before any
179683 ** 2) UPDATE (rowid not modified)
179684 ** 3) UPDATE (rowid modified)
179687 ** Cases 3 and 4 may violate the rowid constraint.
179706 i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */
179716 i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */
179724 i64 iOld = sqlite3_value_int64(apVal[0]); /* Old rowid */
179725 i64 iNew = sqlite3_value_int64(apVal[1]); /* New rowid */
180980 int bWithout, /* True for without rowid */
180987 pConfig->zDb, pConfig->zName, zPost, zDefn, bWithout?" WITHOUT ROWID":""
181115 ** If a row with rowid iDel is present in the %_content table, add the
181419 ** Allocate a new rowid. This is used for "external content" tables when
181420 ** a NULL value is inserted into the rowid column. The new rowid is allocated
181425 ** this case the user is required to provide a rowid explicitly.
181747 ** specified rowid and populates aCol[] with the results.
183843 Fts5IndexIter *pIter; /* Term/rowid iterator object */
183852 i64 rowid; /* This table's current rowid value */
184083 pCsr->rowid = 0;
184110 pCsr->rowid++;
184232 ** retrieve the rowid for the current row of the result set. The
184233 ** rowid should be written to *pRowid.
184240 *pRowid = pCsr->rowid;