Home | History | Annotate | Download | only in orig

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"),
42373 ** can be intermixed with tests to see if a given rowid has been
42442 i64 v; /* ROWID value for this entry */
42559 SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
42568 pEntry->v = rowid;
42572 if( (p->rsFlags & ROWSET_SORTED)!=0 && rowid<=pLast->v ){
54987 ** rowid iRow is being replaced or deleted. In this case invalidate
54992 i64 iRow, /* The rowid that might be changing */
55105 ** (the rowid) is stored in pCur->nKey and pCur->pKey is left set to
62725 ** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
63628 checkAppendMsg(pCheck, "Rowid %lld out of order", info.nKey);
66081 int nCol = pIdx->nColumn; /* Number of index columns including rowid */
70738 ** Read the rowid (the last field in the record) and store it in *rowid.
70744 SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
70748 u32 typeRowid; /* Serial type of the rowid */
70749 u32 lenRowid; /* Size of the rowid */
70777 /* The last field of the index should be an integer - the ROWID.
70799 *rowid = v.u.i;
70817 ** pUnpacked is either created without a rowid or is truncated so that it
70818 ** omits the rowid at the end. The rowid at the end of the index entry
70820 ** of the keys prior to the final rowid, not the entire key.
73460 i64 lastRowid = db->lastRowid; /* Saved value of the last insert ROWID */
74538 lastRowid = db->lastRowid; /* Remember rowid changes made by xFunc */
76553 i64 iKey; /* The rowid we are to seek to */
76701 ** P1 is an open table cursor and P2 is a rowid integer. Arrange
76702 ** for P1 to move so that it points to the rowid given by P2.
76869 ** keys). P3 is an integer rowid. If P1 does not contain a record with
76870 ** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an
76871 ** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then
76941 ** Synopsis: r[P2]=rowid
76943 ** Get a new integer record number (a.k.a "rowid") used as the key to a table.
76956 i64 v; /* The new rowid */
76957 VdbeCursor *pC; /* Cursor of table to get the new rowid */
76960 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
76971 /* The next rowid or record number (different terms for the same
76974 ** First we attempt to find the largest existing rowid and add one
76975 ** to that. But if the largest existing rowid is already the maximum
76979 ** The second algorithm is to select a rowid at random and see if
76981 ** succeeded. If the random rowid does exist, we select a new one
77046 /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the
77050 assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is
77084 ** then rowid is stored for subsequent return by the
77123 i64 iKey; /* The integer ROWID or key for the record to be inserted */
77223 ** have also set the pC->movetoTarget field to the rowid of the row that
77404 /* Opcode: Rowid P1 P2 * * *
77405 ** Synopsis: r[P2]=rowid
77475 ** The next use of the Rowid or Column or Prev instruction for P1
77535 ** The next use of the Rowid or Column or Next instruction for P1
77783 ** Synopsis: r[P2]=rowid
77787 ** the rowid of the table entry to which this index entry points.
77789 ** See also: Rowid, MakeRecord.
77794 i64 rowid;
77814 rowid = 0; /* Not needed. Only used to silence a warning. */
77815 rc = sqlite3VdbeIdxRowid(db, pCrsr, &rowid);
77819 pOut->u.i = rowid;
77830 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
77841 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
77851 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
77853 ** ROWID on the P1 index.
77862 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
77864 ** ROWID on the P1 index.
78104 "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",
79323 ** is the rowid of a row to delete. If argv[0] is NULL then no
79324 ** deletion occurs. The argv[1] element is the rowid of the new
79326 ** rowid for itself. The subsequent elements in the array are
79329 ** If P2==1 then no insert is performed. argv[0] is the rowid of
79334 ** is set to the value of the rowid for the row just inserted.
79344 sqlite_int64 rowid;
79371 rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);
79376 db->lastRowid = lastRowid = rowid;
79689 zErr = sqlite3MPrintf(p->db, "no such rowid: %lld", iRow);
79740 {OP_Variable, 1, 1, 1}, /* 4: Push the rowid to the stack */
79789 sqlite3ErrorMsg(pParse, "cannot open table without rowid: %s", zTable);
82758 ** the comparison, ignore the rowid field at the end of each record.
83767 /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
83841 ** Perhaps the name is a reference to the ROWID
84076 /* The special operator TK_ROW means use the rowid for the first
84836 ** Expr.iColumn The column index in X.Y. -1 for the rowid.
86516 if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
86815 ** to be of the form "<rowid> IN (?, ?, ?)", where <rowid> is a reference
86834 int isRowid /* If true, LHS of IN operator is a rowid */
87154 /* In this case, the RHS is the ROWID of table b-tree
87445 int iTabCur, /* The table cursor. Or the PK cursor for WITHOUT ROWID */
87471 ** is called. If iColumn<0 then code is generated that extracts the rowid.
88023 ** read the rowid field.
88026 ** parameter is set to 0 for an old.rowid reference, or to (i+1)
88028 ** i is the index of the column. For a new.rowid reference, p1 is
88039 ** p1==0 -> old.rowid p1==3 -> new.rowid
88054 (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName),
90293 i64 iRowid; /* Rowid in main table of the key */
90294 u8 *aRowid; /* Key for WITHOUT ROWID tables */
90305 int nCol; /* Number of columns in index + pk/rowid */
90306 int nKeyCol; /* Number of index columns w/o the pk/rowid */
90330 /* Initialize the BLOB value of a ROWID
90346 /* Initialize the INTEGER value of a ROWID.
90394 ** N: The number of columns in the index including the rowid/pk (note 1)
90395 ** K: The number of columns in the index excluding the rowid/pk.
90399 ** WITHOUT ROWID table, N is the number of PRIMARY KEY columns, not the
90404 ** For indexes on ordinary rowid tables, N==K+1. But for indexes on
90405 ** WITHOUT ROWID tables, N=K+P where P is the number of columns in the
90407 ** original WITHOUT ROWID table as N==K as a special case.
90623 /* The "rows less-than" for the rowid column must be greater than that
90718 ** R Rowid for the current row. Might be a key record for
90719 ** WITHOUT ROWID tables.
90811 #define STAT_GET_ROWID 1 /* "rowid" column of stat[34] entry */
90992 int regNewRowid = iMem++; /* Rowid for the inserted record */
90996 int regRowid = iMem++; /* Rowid argument passed to stat_push() */
91086 ** regRowid = idx(rowid)
91095 ** the regPrev array and a trailing rowid (the rowid slot is required
91108 ** (1) the number of columns in the index including the rowid
91109 ** (or for a WITHOUT ROWID table, the number of PK columns),
91110 ** (2) the number of columns in the key without the rowid/pk
91194 ** regRowid = idx(rowid) // STAT34 only
91654 ** Look up an index by name. Or, if the name of a WITHOUT ROWID table
92685 zCol = "ROWID";
93786 ** The rowid for the new entry is left in register pParse->regRowid.
93788 ** The rowid and root page number values are needed by the code that
94072 ** then we will try to use that column as the rowid. Set the Table.iPKey
94455 ** has a WITHOUT ROWID clause. The job of this routine is to convert both
94457 ** are appropriate for a WITHOUT ROWID table instead of a rowid table.
94461 ** no rowid btree for a WITHOUT ROWID. Instead, the canonical
94473 ** (6) Replace the rowid tail on all automatically generated UNIQUE
94553 ** the final rowid column into one or more columns of the PRIMARY KEY.
94648 /* Special processing for WITHOUT ROWID Tables */
94652 "AUTOINCREMENT not allowed on WITHOUT ROWID tables");
94730 int regRowid; /* Rowid of the next row to insert */
94787 "WHERE rowid=#%d",
95691 Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */
95968 /* Append the table key to the end of the index. For WITHOUT ROWID
95970 ** normal tables (when pPk==0) this will be the rowid.
96081 ** of a WITHOUT ROWID table.
96101 ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In
96938 ** Code an OP_Halt due to non-unique rowid.
96943 Table *pTab /* The table with the non-unique rowid */
96952 zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName);
97811 Expr *pWhereRowid = NULL; /* WHERE rowid .. */
97812 Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */
97813 Expr *pSelectRowid = NULL; /* SELECT rowid ... */
97815 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
97838 ** DELETE FROM table_a WHERE rowid IN (
97839 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
97861 /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */
98062 /* For a rowid table, initialize the RowSet to an empty set */
98068 /* For a WITHOUT ROWID table, create an ephemeral table used to
98080 /* Construct a query to find the rowid or primary key for every row
98099 /* Extract the rowid or primary key for the current row */
98114 /* For ONEPASS, no need to store the rowid/primary-key. There is only
98137 /* Add the rowid of the row to be deleted to the RowSet */
98138 nKey = 1; /* OP_Seek always uses a single rowid */
98235 ** maximum rowid counter values recorded while inserting into
98278 ** in the case of a rowid table, or the PRIMARY KEY index in the case
98279 ** of a WITHOUT ROWID table.)
98350 ** avoid copying the contents of the rowid register. */
98432 ** for rowid tables or to the primary key index for WITHOUT ROWID
98456 Index *pPk; /* PRIMARY KEY index, or NULL for rowid tables */
98479 ** the entry that needs indexing. If pTab is a WITHOUT ROWID table, then
98503 ** on a table with multiple indices, and especially with the ROWID or
100829 ** for pTab. regBase itself holds the rowid. regBase+1 holds the first
100968 ** $current_rowid!=rowid
100971 ** The first form is used for rowid tables. The second form is used
100972 ** for WITHOUT ROWID tables. In the second form, the primary key is
101131 ** is set to -1). If the rowid column is modified by the UPDATE statement
101141 int bChngRowid /* True if rowid is modified by this update */
101158 ** is set to -1). If the rowid column is modified by the UPDATE statement
101213 ** rowid of the row being deleted, followed by each of the column values
101232 int bChngRowid /* True if rowid is UPDATEd */
101460 ** UPDATE statement modifies the rowid fields of the table.
101470 int chngRowid /* True for UPDATE that affects rowid */
101719 int bChngRowid /* True if rowid is UPDATEd */
101807 ** If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index
101850 ** rowid that appears as the last column in every index.
101987 ** that holds the maximum rowid.
101998 ** (2) Register to hold the maximum ROWID of pTab.
101999 ** (3) Register to hold the rowid in sqlite_sequence of pTab
102009 int memId = 0; /* Register holding maximum rowid */
102024 pInfo->regCtr = ++pToplevel->nMem; /* Max rowid register */
102025 pToplevel->nMem++; /* Rowid in sqlite_sequence */
102040 int memId; /* Register holding max rowid */
102072 ** Update the maximum rowid for an autoincrement calculation.
102075 ** new rowid that is about to be inserted. If that new rowid is
102076 ** larger than the maximum rowid in the memId memory cell, then the
102087 ** maximum rowid values back into the sqlite_sequence register.
102261 u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
102269 int regIns; /* Block of regs holding rowid+data being inserted */
102270 int regRowid; /* registers holding insert rowid */
102374 /* Allocate registers for holding the rowid of the new row,
102477 int regTempRowid; /* Register to hold temp table ROWID */
102596 ** not happened yet) so we substitute a rowid of -1
102712 ** Whenever this column is read, the rowid will be substituted
102803 ** maximum rowid counter values recorded while inserting into
102849 ** that regNewData points to) will contain the new rowid, or NULL in the
102850 ** case of a WITHOUT ROWID table. The second register in the range will
102860 ** rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table)
102864 ** For an INSERT, the pkChng boolean indicates whether or not the rowid
102866 ** is zero, it means that the either rowid is computed automatically or
102867 ** that the table is a WITHOUT ROWID table and has no rowid. On an INSERT,
102869 ** value for either the rowid column or its INTEGER PRIMARY KEY alias.
102880 ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY
102881 ** index when operating on a WITHOUT ROWID table. iIdxCur is the cursor
102933 u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */
102948 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
102949 int ipkTop = 0; /* Top of the rowid change constraint check */
102950 int ipkBottom = 0; /* Bottom of the rowid change constraint check */
102953 int regRowid = -1; /* Register holding ROWID value */
102962 /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
102963 ** normal rowid tables. nPkField is the number of key fields in the
102964 ** pPk index or 1 for a rowid table. In other words, nPkField is the
103051 /* If rowid is changing, make sure the new rowid does not previously
103057 /* Figure out what action to take in case of a rowid
103066 /* pkChng!=0 does not mean that the rowid has change, only that
103067 ** it might have changed. Skip the conflict logic below if the rowid
103074 /* If the response to a rowid conflict is REPLACE but the response
103076 ** to defer the running of the rowid conflict checking until after
103088 /* Check to see if the new rowid already exists in the table. Skip
103093 /* Generate code that deals with a rowid collision */
103123 ** REPLACE INTO t(rowid) VALUES($newrowid)
103164 ** WITHOUT ROWID table.
103203 if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */
103210 VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
103218 ** of a WITHOUT ROWID table and there has been no change the
103248 /* Conflict only if the rowid of the existing index entry
103249 ** is different from old-rowid */
103269 /* If currently processing the PRIMARY KEY of a WITHOUT ROWID
103344 ** rowid and the content to be inserted.
103363 int regData; /* Content registers (after the rowid) */
103418 ** ROWID table) is returned in *piDataCur. The first index cursor is
103421 ** Use iBase as the first cursor (either the *piDataCur for rowid tables
103422 ** or the first index for WITHOUT ROWID tables) if it is non-negative.
103425 ** For a rowid table, *piDataCur will be exactly one less than *piIdxCur.
103426 ** For a WITHOUT ROWID table, *piDataCur will be somewhere in the range
103603 int regData, regRowid; /* Registers holding data and rowid */
103677 return 0; /* source and destination must both be WITHOUT ROWID or not */
103776 ** (If the destination is not initially empty, the rowid fields
107040 static const char *azCol[] = { "table", "rowid", "parent", "fkid" };
108068 "SELECT name, rootpage, sql FROM '%q'.%s ORDER BY rowid",
109941 ** declaration type for a ROWID field is INTEGER. Exactly when an expression
110033 ** rowid of the sub-select or view. This expression is legal (see
110054 zOrigCol = "rowid";
110192 zCol = "rowid";
110274 iCol>=0 ? pTab->aCol[iCol].zName : "rowid");
111727 ** entry in pEList. (But leave references to the ROWID column
115464 ** reg+0 OLD.rowid
115468 ** reg+N+1 NEW.rowid
115537 ** It is not possible to determine if the old.rowid or new.rowid column is
115605 Expr *pRowidExpr, /* Expression used to recompute the rowid */
115683 Index *pPk; /* The PRIMARY KEY index for WITHOUT ROWID tables */
115694 u8 chngPk; /* PRIMARY KEY changed in a WITHOUT ROWID table */
115695 u8 chngRowid; /* Rowid changed in a normal table */
115713 int nKey = 0; /* Number of elements in regKey for WITHOUT ROWID */
115718 int regOldRowid = 0; /* The old rowid */
115719 int regNewRowid = 0; /* The new rowid */
115832 j<0 ? "ROWID" : pTab->aCol[j].zName,
115939 /* Remember the rowid of every item to be updated.
116228 ** maximum rowid counter values recorded while inserting into
116275 ** (A) The original rowid of that row.
116276 ** (B) The revised rowid for the row.
116291 Expr *pRowid, /* Expression used to recompute the rowid */
116305 int regRowid; /* Register for ephem table rowid */
117169 ** The VM register number pParse->regRowid holds the rowid of an
117177 "WHERE rowid=#%d",
118568 if( i==XN_ROWID ) return "rowid";
118694 zRangeOp = ">? AND rowid<";
118701 sqlite3XPrintf(&str, 0, " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp);
119136 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
119233 ** equality comparison against the ROWID field. Or
119234 ** we reference multiple rows using a "rowid IN (...)"
119257 /* Case 3: We have an inequality comparison against the ROWID field.
119645 ** RowSetTest are such that the rowid of the current row is inserted
119650 ** RowSetTest # Insert rowid into rowset
119666 ** Added 2014-05-26: If the table is a WITHOUT ROWID table, then
119678 int regRowid = 0; /* Register holding rowid */
119719 ** capable of holding primary keys in the case of a WITHOUT ROWID.
119806 ** rowid (or PRIMARY KEY) for the current row so that the same
123960 ** variable sPk to represent the rowid primary key index. Make this
123992 && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
124554 ** Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row.
124566 ** The rowid for a table is always UNIQUE and NOT NULL so whenever the
124567 ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is
125230 /* TUNING: Cost of a rowid lookup is 10 */
125708 ** WITHOUT ROWID table. No need for a separate index */
128221 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
131669 ** Return the ROWID of the most recent insert
134080 ** 1. The specified column name was rowid", "oid" or "_rowid_"
135865 #define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */
136712 fts3Appendf(pRc, &zRet, "rowid");
137390 ** 1. Direct lookup by rowid or docid.
137430 /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */
137441 ** rowid/docid lookup, prefer the MATCH strategy. This is done even
137442 ** though the rowid/docid lookup is faster than a MATCH query, selecting
137476 /* If using a docid=? or rowid=? strategy, set the UNIQUE flag. */
137497 /* Regardless of the strategy selected, FTS can deliver rows in rowid (or
137557 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
137569 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
139024 sqlite3_value *pCons = 0; /* The MATCH or rowid constraint, if any */
139098 "SELECT %s WHERE rowid BETWEEN %lld AND %lld ORDER BY rowid %s",
139103 zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s",
139134 ** retrieve the rowid for the current row of the result set. fts3
139135 ** exposes %_content.docid as the rowid for the virtual table. The
139136 ** rowid should be written to *pRowid.
139169 ** alias for "rowid", use the xRowid() method to obtain the value.
139209 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
141816 sqlite3_int64 iRowid; /* Current rowid */
142052 /* Increment our pretend rowid value. */
142283 ** xRowid - Return the current rowid for the cursor.
142287 sqlite_int64 *pRowid /* OUT: Rowid value */
145496 int iRowid; /* Current 'rowid' value */
145837 ** xRowid - Return the current rowid for the cursor.
145841 sqlite_int64 *pRowid /* OUT: Rowid value */
146029 sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */
146030 sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */
146031 sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */
146181 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
146182 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
146188 /* 7 */ "SELECT %s WHERE rowid=?",
146829 ** apVal[1] rowid
146834 ** apVal[p->nColumn+3] Hidden "docid" column (alias for rowid)
146875 ** a value for the "rowid" field, for the "docid" field, or for both.
146876 ** Which is a problem, since "rowid" and "docid" are aliases for the
146879 ** INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2);
146882 ** for both docid and some other rowid alias.
146888 /* A rowid/docid conflict. */
150605 ** exists, is stored in the rowid==1 row of the %_stat table.
151347 ** SQLite value pRowid contains the rowid of a row that may or may not be
151404 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
151453 /* If this is an INSERT operation, or an UPDATE that modifies the rowid
151463 /* Find the value object that holds the new rowid value. */
151473 /* The new rowid is not NULL (in this case the rowid will be
151476 ** rowid column. So if the conflict mode is REPLACE, then delete any
151477 ** existing row with rowid=pNewRowid.
151480 ** the %_content table. If we hit the duplicate rowid constraint (or any
154066 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER)
154072 ** table that maps from the entries rowid to the id of the node that it
154089 ** of 4-byte coordinates. For leaf nodes the integer is the rowid
154243 ** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates).
154741 ** node pNode. If pNode is a leaf node, this is a rowid. If it is
155483 ** rowid iRowid. If successful, set *ppLeaf to point to the node and
155490 i64 iRowid, /* The rowid searching for */
155582 /* Special case - lookup by rowid. */
155681 ** 1 Unused Direct lookup by rowid.
155720 ** is, do not consider the lookup-by-rowid plan as using such a plan would
155736 /* We have an equality constraint on the rowid. Use strategy 1. */
155746 /* This strategy involves a two rowid lookups on an B-Tree structures
155748 ** considered almost as quick as a direct rowid lookup (for which
156407 ** rowid of the row to delete, which can be used to find the leaf on which
156717 ** Select a currently unused rowid for a new r-tree record.
156730 ** Remove the entry with rowid=iDelete from the r-tree structure.
156855 int bHaveRowid = 0; /* Set to 1 after new rowid is determined */
156865 ** 1. A duplicate rowid value, or
156909 /* If a rowid value was supplied, check if it is already present in
156933 /* If azData[0] is not an SQL NULL value, it is the rowid of a
156949 /* Figure out the rowid of the new row. */
157075 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1",
157077 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1",
157092 "CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);"
157317 ** list, containing the 8-byte rowid/pageno followed by the
158484 ** has no PRIMARY KEY, affected rows must be identified by rowid.
158532 ** key column - "rowid". Virtual tables for which the "rowid" column does
158626 ** UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
158630 ** table in "rowid" order is roughly the same as reading them sorted by
159051 ** 1: Table has an implicit rowid.
159054 ** 4: Table is WITHOUT ROWID.
159807 ** RBU_PK_NONE: Table has an implicit rowid.
159810 ** RBU_PK_WITHOUT_ROWID: Table is WITHOUT ROWID.
160391 ** CREATE TABLE t1(a, b, c, PRIMARY KEY(b, a DESC)) WITHOUT ROWID
160445 ** function creates a WITHOUT ROWID imposter table named "rbu_imposter2"
160453 ** CREATE TABLE rbu_imposter2(c1 TEXT, c2 REAL, id INTEGER) WITHOUT ROWID;
160503 "CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID",
160569 (pIter->eType==RBU_PK_WITHOUT_ROWID ? " WITHOUT ROWID" : "")
160667 "CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID",
165077 u32 iRowid; /* The rowid */
165349 /* Return the current rowid value */
165737 ** Returns the rowid of the current row.
165746 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
166200 /* Name of rank and rowid columns */
166202 #define FTS5_ROWID_NAME "rowid"
166261 ** the string "rowid" otherwise. This text is not quoted - if it is
166448 #define FTS5INDEX_QUERY_DESC 0x0002 /* Docs in descending rowid order */
166637 i64 iRowid, /* Rowid for this entry */
166678 #define FTS5_STMT_SCAN_ASC 0 /* SELECT rowid, * FROM ... ORDER BY 1 ASC */
166679 #define FTS5_STMT_SCAN_DESC 1 /* SELECT rowid, * FROM ... ORDER BY 1 DESC */
166680 #define FTS5_STMT_LOOKUP 2 /* SELECT rowid, * FROM ... WHERE rowid=? */
166751 ** // The document with rowid iRowid matches the expression!
169456 pRet->zContentRowid = sqlite3Fts5Strndup(&rc, "rowid", -1);
169809 int bDesc; /* Iterate in descending rowid order */
169829 i64 iRowid; /* Current rowid */
170040 ** Argument pTerm must be a synonym iterator. Return the current rowid
170150 ** pointing to the same rowid when this function is called. This function
170151 ** checks if the current rowid really is a match, and if so populates
170156 ** otherwise. It is not considered an error code if the current rowid is
170408 /* Find the firstest rowid any synonym points to. */
170412 ** is valid - each iterator that points to a rowid before iFrom. */
170464 int bDesc, /* True if iterator is "rowid DESC" */
170465 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
170490 int bDesc, /* True if iterator is "rowid DESC" */
170491 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
170580 ** point to the same rowid, and if not, advances them until they do.
170595 i64 iLast; /* Lastest rowid any iterator points to */
170597 int bMatch; /* True if all terms are at the same rowid */
170606 /* Initialize iLast, the "lastest" rowid any iterator points to. If the
170608 ** the maximum rowid. Or, if the iterator is "ORDER BY rowid DESC", then it
170609 ** means the minimum rowid. */
170784 ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the
170785 ** new lastest rowid seen so far. */
170836 ** rowid value iFrom. Whether "past" means "less than" or "greater than"
170911 ** c) the node is now at or past rowid iFrom.
170937 /* Advance the iterators until they all point to the same rowid */
171026 ** parameter is passed a non-zero value, iteration is in descending rowid
171029 ** If iterating in ascending rowid order (bDesc==0), the first document
171030 ** visited is that with the smallest rowid that is larger than or equal
171032 ** then the first document visited must have a rowid smaller than or
171046 /* If not at EOF but the current rowid occurs earlier than iFirst in
172046 ** * Rowid, as a varint
172048 ** * Size of previous position list and rowid, as a 4 byte
172052 ** Offset of last rowid written to data area. Relative to first byte of
172069 i64 iRowid; /* Rowid of last value written */
172208 i64 iRowid, /* Rowid for this entry */
172263 ** + 9 bytes for a new rowid,
172283 /* If this is a new rowid, append the 4-byte size field for the previous
172284 ** entry, and the new rowid for this entry. */
172509 ** records that contain a copy of the first rowid on each page spanned by
172593 ** varint: first rowid
172596 ** varint: rowid delta (always > 0)
172623 ** * The byte offset of the first rowid on the page, if it exists
172641 ** + if the first rowid on a page occurs before the first term, it
172644 ** varint: first rowid
172663 ** * First rowid on page indicated by previous field. As a varint.
172666 ** positive delta if the termless page contains at least one rowid,
172676 ** * Copy of first rowid on page indicated by previous field. As a varint.
172678 ** * A list of delta-encoded varints - the first rowid on each subsequent
172686 #define FTS5_AVERAGES_ROWID 1 /* Rowid used for the averages record */
172696 ** The rowid for each segment leaf is found by passing the segment id and
172766 i64 iWriteRowid; /* Rowid for current doc being written */
172828 i64 iPrev; /* Previous rowid value written to page */
172834 i64 iPrevRowid; /* Previous rowid written to current leaf */
172835 u8 bFirstRowidInDoclist; /* True if next rowid is first in doclist */
172836 u8 bFirstRowidInPage; /* True if next rowid is first in page */
172852 ** visiting each term/rowid pair in the merged data.
172863 ** points to the smaller term/rowid combination. Iterators at EOF are
172877 ** Object for iterating through a single segment, visiting each term/rowid
172889 ** rowid field of the current entry. Usually this is the size field of the
172890 ** position list data. The exception is if the rowid for the current entry
172909 ** it is set, iterate through rowid in descending order instead of the
172915 ** For each rowid on the page corresponding to the current term, the
172931 ** is the offset of the first rowid in the current doclist. */
172941 int *aRowidOffset; /* Array of offset to rowid fields */
172947 i64 iRowid; /* Current rowid */
172991 i64 iSwitchRowid; /* Firstest rowid of other than aFirst[1] */
173018 i64 iRowid; /* First rowid on leaf iLeafPgno */
173704 ** points to the first rowid in the doclist-index.
173992 ** Fts5SegIter.rowid
174068 ** the position-list size field for the first relevant rowid on the page.
174069 ** Fts5SegIter.rowid is set, but nPos and bDel are not.
174072 ** relevant rowid on the page and, if necessary, initializes the
174075 ** byte of the position list content associated with said rowid.
174134 ** thing on the page - i.e. the first rowid is on the following page.
174314 ** Iterator pIter currently points to the first rowid in a doclist. This
174331 ** position-list content for the current rowid. Back it up so that it
174335 /* If this condition is true then the largest rowid for the current
174337 ** see where said rowid really is. */
174342 /* The last rowid in the doclist may not be on the current page. Search
174343 ** forward to find the page containing the last rowid. */
174362 /* If pLast is NULL at this point, then the last rowid for this doclist
174365 ** field associated with the first relevant rowid on the page.
174368 ** rowid. In this case configure the iterator so that it points to the
174369 ** first rowid on this page.
174392 ** Iterator pIter currently points to the first rowid of a doclist.
174847 ** Move the seg-iter so that it points to the first rowid on page iLeafPgno.
174885 ** past rowid iFrom. Regardless of the value of iFrom, the iterator is
174972 ** points to the same term though - just a different rowid. This function
175096 ** The iterator initially points to the first term/rowid entry in the
175194 int bDesc, /* True for descending rowid order */
175239 ** Return the rowid of the entry that the iterator currently points
175521 ** Rowid iRowid has just been appended to the current leaf page. It is the
175539 ** a copy of iRowid (which will become the first rowid on the next
175542 ** also push its first rowid upwards. */
175553 /* This was the root node. Push its first rowid up to the new root. */
175707 ** Append a rowid and position-list size field to the writers output.
175722 /* If this is to be the first rowid written to the page, set the
175723 ** rowid-pointer in the page-header. Also append a value to the dlidx
175730 /* Write the rowid. */
176001 /* Append the rowid to the output */
176258 fts5PutU16(&pBuf->p[0], pBuf->n); /* first rowid on page */
176673 i64 *piLastRowid, /* IN/OUT: Previous rowid written (if any) */
176674 i64 iRowid /* Rowid to append */
176781 int bDesc, /* True for "ORDER BY rowid DESC" */
176857 ** to the document with rowid iRowid.
177055 ** Open a new iterator to iterate though all rowid that match the
177129 ** Move to the next matching rowid.
177138 ** Move to the next matching term/rowid. Used by the fts5vocab module.
177159 ** Move to the next matching rowid that occurs at or after iMatch. The
177161 ** in ascending or descending rowid order.
177169 ** Return the current rowid.
177219 i64 *piRowid /* OUT: Current rowid */
177382 ** Instead, it tests that the same set of pgno/rowid combinations are
177438 i64 rowid = sqlite3Fts5IterRowid(pIdxIter);
177448 cksum ^= fts5IndexEntryCksum(rowid, iCol, iOff, iIdx, z, n);
177629 i64 iRow; /* Rowid for this leaf */
177646 ** is also a rowid pointer within the leaf page header, it points to a
177652 int iRowidOff; /* Offset of first rowid on leaf */
177693 /* Check any rowid-less pages that occur before the current leaf. */
177705 ** contain the rowid suggested by the same. */
177859 ** Decode a segment-data rowid from the %_data table. This function is
177863 i64 iRowid, /* Rowid from %_data table */
177882 int iSegid, iHeight, iPgno, bDlidx; /* Rowid compenents */
178026 i64 iRowid; /* Rowid for record being decoded */
178027 int iSegid,iHeight,iPgno,bDlidx;/* Rowid components */
178343 ** SELECT rowid, <fts> FROM <fts> ORDER BY +rank;
178352 i64 iRowid; /* Current rowid */
178372 ** <tbl> MATCH <expr> AND rowid BETWEEN $iFirstRowid AND $iLastRowid
178374 ** If the cursor iterates in descending order of rowid, iFirstRowid
178375 ** is the upper limit (i.e. the "first" rowid visited) and iLastRowid
178386 int bDesc; /* True for "ORDER BY rowid DESC" queries */
178420 #define FTS5_BI_ROWID_EQ 0x0004 /* rowid == ? */
178421 #define FTS5_BI_ROWID_LE 0x0008 /* rowid <= ? */
178422 #define FTS5_BI_ROWID_GE 0x0010 /* rowid >= ? */
178649 #define FTS5_PLAN_ROWID 6 /* (rowid = ?) */
178670 ** 3. An == constraint against the rowid column.
178671 ** 4. A < or <= constraint against the rowid column.
178672 ** 5. A > or >= constraint against the rowid column.
178677 ** 6. ORDER BY rowid [ASC|DESC]
178688 ** * One rowid range constraint: cost=750.0
178689 ** * Both rowid range constraints: cost=500.0
178690 ** * An == rowid constraint: cost=100.0
178695 ** * One rowid range constraint: cost=750000.0
178696 ** * Both rowid range constraints: cost=250000.0
178697 ** * An == rowid constraint: cost=10.0
178712 int iCol; /* 0==rowid, 1==tbl, 2==rank */
178954 ** is using. Then attempt to move the cursor to a rowid equal to or laster
178955 ** (in the cursors sort order - ASC or DESC) than the current rowid.
178957 ** If the new rowid is not equal to the old, set output parameter *pbSkip
179062 "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s",
179259 ** 2. A by-rowid lookup.
179274 int bDesc; /* True if ORDER BY [rank|rowid] DESC */
179278 sqlite3_value *pRowidEq = 0; /* rowid = ? expression (or NULL) */
179279 sqlite3_value *pRowidLe = 0; /* rowid <= ? expression (or NULL) */
179280 sqlite3_value *pRowidGe = 0; /* rowid >= ? expression (or NULL) */
179312 /* Set the cursor upper and lower rowid limits. Only some strategies
179315 ** on the rowid field. */
179373 ** by rowid (ePlan==FTS5_PLAN_ROWID). */
179403 ** Return the rowid that the cursor currently points to.
179419 ** retrieve the rowid for the current row of the result set. fts5
179420 ** exposes %_content.rowid as the rowid for the virtual table. The
179421 ** rowid should be written to *pRowid.
179599 ** A delete specifies a single argument - the rowid of the row to remove.
179603 ** 1. The "old" rowid, or NULL.
179604 ** 2. The "new" rowid.
179612 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
179649 ** any conflict on the rowid value must be detected before any
179653 ** 2) UPDATE (rowid not modified)
179654 ** 3) UPDATE (rowid modified)
179657 ** Cases 3 and 4 may violate the rowid constraint.
179676 i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */
179686 i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */
179694 i64 iOld = sqlite3_value_int64(apVal[0]); /* Old rowid */
179695 i64 iNew = sqlite3_value_int64(apVal[1]); /* New rowid */
180950 int bWithout, /* True for without rowid */
180957 pConfig->zDb, pConfig->zName, zPost, zDefn, bWithout?" WITHOUT ROWID":""
181085 ** If a row with rowid iDel is present in the %_content table, add the
181389 ** Allocate a new rowid. This is used for "external content" tables when
181390 ** a NULL value is inserted into the rowid column. The new rowid is allocated
181395 ** this case the user is required to provide a rowid explicitly.
181717 ** specified rowid and populates aCol[] with the results.
183813 Fts5IndexIter *pIter; /* Term/rowid iterator object */
183822 i64 rowid; /* This table's current rowid value */
184053 pCsr->rowid = 0;
184080 pCsr->rowid++;
184202 ** retrieve the rowid for the current row of the result set. The
184203 ** rowid should be written to *pRowid.
184210 *pRowid = pCsr->rowid;