Lines Matching refs:rowid
2786 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available
2790 ** is another alias for the rowid.
2792 ** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of
2793 ** the most recent successful [INSERT] into a rowid table or [virtual table]
2795 ** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred
2803 ** Some virtual table implementations may INSERT rows into rowid tables as
2805 ** to disk). In this case subsequent calls to this function return the rowid
2807 ** unintuitive results. Virtual table implementations that do write to rowid
2809 ** rowid value using [sqlite3_set_last_insert_rowid()] before returning
2813 ** return the [rowid] of the inserted row as long as the trigger is
2835 ** function is running and thus changes the last insert [rowid],
2838 ** last insert [rowid].
6940 ** a [rowid table].
6945 ** row is updated, inserted or deleted in a rowid table.
6953 ** ^The final callback parameter is the [rowid] of the row.
6954 ** ^In the case of an update, this is the [rowid] after the update takes place.
7193 ** ^If the specified column is "rowid", "oid" or "_rowid_" and the table
7198 ** for the [rowid] are set as follows:
7584 ** operand is the rowid.
7803 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
7892 ** by the rowid value passed as the second argument. Only the row can be
10431 ** For an UPDATE or DELETE operation on a [rowid table], the sixth
10432 ** parameter passed to the preupdate callback is the initial [rowid] of the
10433 ** row being modified or deleted. For an INSERT operation on a rowid table,
10435 ** parameter is undefined. For an INSERT or UPDATE on a rowid table the
10436 ** seventh parameter is the final rowid value of the row being inserted
10439 ** DELETE operations on rowid tables.
10498 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
11150 ** PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY
12822 ** Returns the rowid of the current row.
12831 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
15702 ** Table btrees (used for rowid tables) contain an integer rowid used as
16138 #define OP_NewRowid 127 /* synopsis: r[P2]=rowid */
16146 #define OP_Rowid 135 /* synopsis: r[P2]=PX rowid of P1 */
16152 #define OP_DeferredSeek 141 /* synopsis: Move P3 to P1.rowid if needed */
16153 #define OP_IdxRowid 142 /* synopsis: r[P2]=rowid */
17761 i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
17814 #define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */
17817 #define TF_NoVisibleRowid 0x00000200 /* No user-visible "rowid" column */
17868 /* Does the table have a rowid */
17969 ** for the rowid at the end.
18142 #define XN_ROWID (-1) /* Indexed column is the rowid */
18347 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
18969 #define SRT_Fifo 8 /* Store result as data with an automatic rowid */
18979 #define SRT_Table 14 /* Store result as data with an automatic rowid */
18980 #define SRT_Upfrom 15 /* Store result as data with rowid */
19009 int regCtr; /* Memory register holding the rowid counter */
19141 int regRowid; /* Register holding rowid of CREATE TABLE entry */
20849 #define IN_INDEX_ROWID 1 /* Search the rowid of the table */
22489 u8 isTable; /* True for rowid tables. False for indexes */
22587 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
32105 ** read the rowid field.
32168 sqlite3TreeViewLine(pView, "First FROM table rowid");
35729 /* 127 */ "NewRowid" OpHelp("r[P2]=rowid"),
35737 /* 135 */ "Rowid" OpHelp("r[P2]=PX rowid of P1"),
35743 /* 141 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
35744 /* 142 */ "IdxRowid" OpHelp("r[P2]=rowid"),
54834 ** can be intermixed with tests to see if a given rowid has been
55027 SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
55036 pEntry->v = rowid;
55040 if( rowid<=pLast->v ){ /*OPTIMIZATION-IF-FALSE*/
69158 ** rowid iRow is being replaced or deleted. In this case invalidate
69164 i64 iRow, /* The rowid that might be changing */
69279 ** (the rowid) is stored in pCur->nKey and pCur->pKey is left set to
69291 /* Only the rowid is required for a table btree */
73369 ** Return the value of the integer key or "rowid" for a table btree.
77604 ** For a table btree (used for rowid tables), only the pX.nKey value of
77606 ** rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields
77930 ** parameter iKey is used as the rowid value when the record is copied
78263 ** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
81951 int nCol = pIdx->nColumn; /* Number of index columns including rowid */
84227 sqlite3_str_appendf(p, "rowid");
84632 int *piPc, /* IN/OUT: Current rowid. Overwritten with next rowid */
84672 /* The rowid is small enough that we are still in the
87503 ** Read the rowid (the last field in the record) and store it in *rowid.
87509 SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
87513 u32 typeRowid; /* Serial type of the rowid */
87514 u32 lenRowid; /* Size of the rowid */
87565 *rowid = v.u.i;
87583 ** pUnpacked is either created without a rowid or is truncated so that it
87584 ** omits the rowid at the end. The rowid at the end of the index entry
87586 ** of the keys prior to the final rowid, not the entire key.
94984 i64 iKey; /* The rowid we are to seek to */
95602 ** contain a record with rowid P3 then jump immediately to P2.
95604 ** a record with rowid P3 then
95625 ** keys). P3 is an integer rowid. If P1 does not contain a record with
95626 ** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an
95627 ** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then
95724 ** Synopsis: r[P2]=rowid
95726 ** Get a new integer record number (a.k.a "rowid") used as the key to a table.
95739 i64 v; /* The new rowid */
95740 VdbeCursor *pC; /* Cursor of table to get the new rowid */
95744 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
95758 /* The next rowid or record number (different terms for the same
95761 ** First we attempt to find the largest existing rowid and add one
95762 ** to that. But if the largest existing rowid is already the maximum
95766 ** The second algorithm is to select a rowid at random and see if
95768 ** succeeded. If the random rowid does exist, we select a new one
95836 assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is
95871 ** then rowid is stored for subsequent return by the
95985 ** tables, register P3 contains the rowid to use with the new record in
96039 ** of the memory cell that contains the value that the rowid of the row will
96064 ** OP_Delete will have also set the pC->movetoTarget field to the rowid of
96075 ** VdbeCursor.movetoTarget to the current rowid. */
96283 ** Synopsis: r[P2]=PX rowid of P1
96771 ** Synopsis: Move P3 to P1.rowid if needed
96790 ** Synopsis: r[P2]=rowid
96794 ** the rowid of the table entry to which this index entry points.
96802 i64 rowid; /* Rowid that P1 current points to */
96823 rowid = 0; /* Not needed. Only used to silence a warning. */
96824 rc = sqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid);
96836 pTabCur->movetoTarget = rowid;
96846 pOut->u.i = rowid;
97118 ** P1>1. The P3 argument must be 1 (BTREE_INTKEY) for a rowid table
97202 "SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid",
98631 ** is the rowid of a row to delete. If argv[0] is NULL then no
98632 ** deletion occurs. The argv[1] element is the rowid of the new
98634 ** rowid for itself. The subsequent elements in the array are
98637 ** If P2==1 then no insert is performed. argv[0] is the rowid of
98642 ** is set to the value of the rowid for the row just inserted.
98652 sqlite_int64 rowid = 0;
98681 rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);
98686 db->lastRowid = rowid;
99362 zErr = sqlite3MPrintf(p->db, "no such rowid: %lld", iRow);
99426 sqlite3ErrorMsg(&sParse, "cannot open table without rowid: %s", zTable);
99526 /* blobSeekToRow() will initialize r[1] to the desired rowid */
99527 {OP_NotExists, 0, 5, 1}, /* 2: Seek the cursor to rowid=r[1] */
102495 ** the comparison, ignore the rowid field at the end of each record.
102580 int iRowid; /* The rowid of the output table */
102843 ** Return the rowid for the current row. In this implementation, the
102844 ** rowid is the same as the output value.
104079 /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
104551 /* The special operator TK_ROW means use the rowid for the first
105621 ** Expr.iColumn The column index in X.Y. -1 for the rowid.
108610 /* The "x IN (SELECT rowid FROM table)" case */
108720 } /* End if not an rowid index */
109605 VdbeComment((v, "%s.rowid", pTab->zName));
109647 ** is called. If iColumn<0 then code is generated that extracts the rowid.
109951 VdbeComment((v,"%s.rowid",pTab->zName));
109993 ** 0-(pParse->iSelfTab). The rowid (if any) is in a register
110474 ** read the rowid field.
110477 ** parameter is set to 0 for an old.rowid reference, or to (i+1)
110479 ** i is the index of the column. For a new.rowid reference, p1 is
110490 ** p1==0 -> old.rowid p1==3 -> new.rowid
110512 (pExpr->iColumn<0 ? "rowid" : pExpr->y.pTab->aCol[iCol].zCnName)
114892 int nCol; /* Number of columns in index + pk/rowid */
114893 int nKeyCol; /* Number of index columns w/o the pk/rowid */
114987 ** N: The number of columns in the index including the rowid/pk (note 1)
114988 ** K: The number of columns in the index excluding the rowid/pk.
114996 ** For indexes on ordinary rowid tables, N==K+1. But for indexes on
115219 /* The "rows less-than" for the rowid column must be greater than that
115395 #define STAT_GET_ROWID 1 /* "rowid" column of stat[34] entry */
115560 VdbeComment((v,"%s.rowid",pIdx->zName));
115701 ** regRowid = idx(rowid)
115710 ** the regPrev array and a trailing rowid (the rowid slot is required
115723 ** (1) the number of columns in the index including the rowid
115725 ** (2) the number of columns in the key without the rowid/pk
115817 ** regRowid = idx(rowid) // STAT4 only
118838 ** The rowid for the new entry is left in register pParse->regRowid.
118840 ** The rowid and root page number values are needed by the code that
119296 ** then we will try to use that column as the rowid. Set the Table.iPKey
119722 ** not a rowid or expression.
119788 ** are appropriate for a WITHOUT ROWID table instead of a rowid table.
119803 ** (6) Replace the rowid tail on all automatically generated UNIQUE
119906 ** the final rowid column into one or more columns of the PRIMARY KEY.
120354 " WHERE rowid=#%d",
120457 /* Legacy versions of SQLite allowed the use of the magic "rowid" column
121711 ** normal tables (when pPk==0) this will be the rowid.
122843 ** Code an OP_Halt due to non-unique rowid.
122848 Table *pTab /* The table with the non-unique rowid */
122857 zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName);
123884 Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */
123886 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
123910 ** DELETE FROM table_a WHERE rowid IN (
123911 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
123959 /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */
124186 /* For a rowid table, initialize the RowSet to an empty set */
124204 /* Construct a query to find the rowid or primary key for every row
124227 /* Extract the rowid or primary key for the current row */
124241 /* For ONEPASS, no need to store the rowid/primary-key. There is only
124265 /* Add the rowid of the row to be deleted to the RowSet */
124266 nKey = 1; /* OP_DeferredSeek always uses a single rowid */
124353 ** maximum rowid counter values recorded while inserting into
124398 ** in the case of a rowid table, or the PRIMARY KEY index in the case
124472 ** avoid copying the contents of the rowid register. */
124572 ** for rowid tables or to the primary key index for WITHOUT ROWID
124596 Index *pPk; /* PRIMARY KEY index, or NULL for rowid tables */
127592 ** for pTab. regBase itself holds the rowid. regBase+1 holds the first
127728 ** $current_rowid!=rowid
127731 ** The first form is used for rowid tables. The second form is used
127916 ** is set to -1). If the rowid column is modified by the UPDATE statement
127926 int bChngRowid /* True if rowid is modified by this update */
127943 ** is set to -1). If the rowid column is modified by the UPDATE statement
127998 ** rowid of the row being deleted, followed by each of the column values
128017 int bChngRowid /* True if rowid is UPDATEd */
128248 ** UPDATE statement modifies the rowid fields of the table.
128268 int chngRowid /* True for UPDATE that affects rowid */
128535 int bChngRowid /* True if rowid is UPDATEd */
128669 ** rowid that appears as the last column in every index.
128984 ** that holds the maximum rowid. Return zero if pTab is not an AUTOINCREMENT
128998 ** (3) The rowid in sqlite_sequence of pTab
129009 int memId = 0; /* Register holding maximum rowid */
129019 ** rowid table with exactly two columns.
129043 pInfo->regCtr = ++pToplevel->nMem; /* Max rowid register */
129059 int memId; /* Register holding max rowid */
129109 ** Update the maximum rowid for an autoincrement calculation.
129112 ** new rowid that is about to be inserted. If that new rowid is
129113 ** larger than the maximum rowid in the memId memory cell, then the
129124 ** maximum rowid values back into the sqlite_sequence register.
129320 int regIns; /* Block of regs holding rowid+data being inserted */
129321 int regRowid; /* registers holding insert rowid */
129436 /* Allocate a block registers to hold the rowid and the values
129724 ** SELECT, go ahead and copy the value into the rowid slot now, so that
129732 ** Only ordinary columns are computed in this loop. The rowid
129734 ** computed after the rowid since they might depend on the value
129735 ** of the rowid.
129745 ** using the rowid. So put a NULL in the IPK slot of the record to avoid
129826 ** not happened yet) so we substitute a rowid of -1
129883 /* Compute the new rowid */
129967 /* If there is a RETURNING clause, populate the rowid register with
129969 ** refer to the "rowid" of the view. */
130012 ** maximum rowid counter values recorded while inserting into
130082 ** changing columns (or the rowid if it is changing). In other words,
130094 int chngRowid /* True if UPDATE changes the rowid */
130184 ** that regNewData points to) will contain the new rowid, or NULL in the
130195 ** rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table)
130199 ** For an INSERT, the pkChng boolean indicates whether or not the rowid
130201 ** is zero, it means that the either rowid is computed automatically or
130202 ** that the table is a WITHOUT ROWID table and has no rowid. On an INSERT,
130204 ** value for either the rowid column or its INTEGER PRIMARY KEY alias.
130213 ** main table, if pTab is a rowid table, and stores that record in the
130223 ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY
130276 u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */
130317 ** normal rowid tables. nPkField is the number of key fields in the
130318 ** pPk index or 1 for a rowid table. In other words, nPkField is the
130497 ** (A) The rowid constraint
130610 /* If rowid is changing, make sure the new rowid does not previously
130616 /* Figure out what action to take in case of a rowid collision */
130642 /* If the response to a rowid conflict is REPLACE but the response
130644 ** to defer the running of the rowid conflict checking until after
130657 /* pkChng!=0 does not mean that the rowid has changed, only that
130658 ** it might have changed. Skip the conflict logic below if the rowid
130665 /* Check to see if the new rowid already exists in the table. Skip
130704 ** REPLACE INTO t(rowid) VALUES($newrowid)
130811 VdbeComment((v, "rowid"));
130894 /* Conflict only if the rowid of the existing index entry
130895 ** is different from old-rowid */
131149 ** rowid and the content to be inserted.
131230 ** Use iBase as the first cursor (either the *piDataCur for rowid tables
131234 ** For a rowid table, *piDataCur will be exactly one less than *piIdxCur.
131403 int regData, regRowid; /* Registers holding data and rowid */
131629 ** (If the destination is not initially empty, the rowid fields
133681 /* 44 */ "rowid",
136846 sqlite_int64 iRowid; /* Current rowid */
137508 "SELECT*FROM\"%w\".%s ORDER BY rowid",
140179 ** rowid of the sub-select or view. This expression is legal (see
140197 zOrigCol = "rowid";
140372 zCol = "rowid";
140465 zName = iCol>=0 ? pTab->aCol[iCol].zCnName : "rowid";
147710 ** reg+0 OLD.rowid
147714 ** reg+N+1 NEW.rowid
147791 ** It is not possible to determine if the old.rowid or new.rowid column is
147864 Expr *pRowidExpr, /* Expression used to recompute the rowid */
147934 ** being updated. chngRowid will be true if the rowid of the table is
147941 int chngRowid /* true if the rowid is being updated */
147944 assert( iIdxCol!=XN_ROWID ); /* Cannot index rowid */
147964 ** being updated. chngRowid will be true if the rowid of the table is
147970 int chngRowid /* true if the rowid is being updated */
148022 ** is its rowid. For a virtual table, the results are written to iEph as
148024 ** rowid value in <other-columns> is used as the integer key, and the
148156 int iRowidExpr = -1; /* Index of "rowid=" (or IPK) assignment in pChanges */
148184 int regOldRowid = 0; /* The old rowid */
148185 int regNewRowid = 0; /* The new rowid */
148605 /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
148606 ** mode, write the rowid into the FIFO. In either of the one-pass modes,
148715 /* If the rowid value will change, set register regNewRowid to
148716 ** contain the new value. If the rowid is not being modified,
148894 /* If changing the rowid value, or if there are foreign key constraints
148965 ** maximum rowid counter values recorded while inserting into
149013 ** (A) The original rowid of that row.
149014 ** (B) The revised rowid for the row.
149029 Expr *pRowid, /* Expression used to recompute the rowid */
149043 int regRowid; /* Register for ephem table rowid */
149315 /* Check to see if the conflict target matches the rowid. */
149324 /* The conflict-target is the rowid of the primary table */
150419 ** The VM register number pParse->regRowid holds the rowid of an
150427 "WHERE rowid=#%d",
151957 if( i==XN_ROWID ) return "rowid";
152109 "rowid";
152111 const char *zRowid = "rowid";
152186 sqlite3_str_appendf(&str, "rowid=?");
153050 ** a rowid value just read from cursor iIdxCur, open on index pIdx. This
153052 ** rowid stored in register iRowid.
153058 ** Which causes a seek on $iCur to the row with rowid $iRowid.
153464 ** we reference multiple rows using a "rowid IN (...)"
154028 ** RowSetTest are such that the rowid of the current row is inserted
154033 ** RowSetTest # Insert rowid into rowset
154061 int regRowid = 0; /* Register holding rowid */
154218 ** rowid (or PRIMARY KEY) for the current row so that the same
157808 if( pE2->iColumn<0 ) continue; /* Collseq does not matter for rowid */
159959 ** variable sPk to represent the rowid primary key index. Make this
160943 ** Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row.
160955 ** The rowid for a table is always UNIQUE and NOT NULL so whenever the
160956 ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is
161764 /* TUNING: Cost of a rowid lookup is 10 */
164939 int regCRowid = 0; /* Current rowid value */
164941 int regRowid = 0; /* AggStep rowid value */
165989 ** samve values in record form, and the rowid used to insert said record
169904 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
177313 ** 1. The specified column name was rowid", "oid" or "_rowid_"
179649 #define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */
180549 fts3Appendf(pRc, &zRet, "rowid");
181248 ** 1. Direct lookup by rowid or docid.
181292 /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */
181303 ** rowid/docid lookup, prefer the MATCH strategy. This is done even
181304 ** though the rowid/docid lookup is faster than a MATCH query, selecting
181338 /* If using a docid=? or rowid=? strategy, set the UNIQUE flag. */
181359 /* Regardless of the strategy selected, FTS can deliver rows in rowid (or
181448 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
181462 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
182952 sqlite3_value *pCons = 0; /* The MATCH or rowid constraint, if any */
183026 "SELECT %s WHERE rowid BETWEEN %lld AND %lld ORDER BY rowid %s",
183031 zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s",
183071 ** retrieve the rowid for the current row of the result set. fts3
183072 ** exposes %_content.docid as the rowid for the virtual table. The
183073 ** rowid should be written to *pRowid.
183150 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
185796 sqlite3_int64 iRowid; /* Current rowid */
186032 /* Increment our pretend rowid value. */
186268 ** xRowid - Return the current rowid for the cursor.
189492 int iRowid; /* Current 'rowid' value */
189834 ** xRowid - Return the current rowid for the cursor.
190181 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
190182 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
190188 /* 7 */ "SELECT %s WHERE rowid=?",
190834 ** apVal[1] rowid
190839 ** apVal[p->nColumn+3] Hidden "docid" column (alias for rowid)
190880 ** a value for the "rowid" field, for the "docid" field, or for both.
190881 ** Which is a problem, since "rowid" and "docid" are aliases for the
190884 ** INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2);
190887 ** for both docid and some other rowid alias.
190893 /* A rowid/docid conflict. */
194707 ** exists, is stored in the rowid==1 row of the %_stat table.
195487 ** SQLite value pRowid contains the rowid of a row that may or may not be
195544 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
195592 /* If this is an INSERT operation, or an UPDATE that modifies the rowid
195602 /* Find the value object that holds the new rowid value. */
195612 /* The new rowid is not NULL (in this case the rowid will be
195615 ** rowid column. So if the conflict mode is REPLACE, then delete any
195616 ** existing row with rowid=pNewRowid.
195619 ** the %_content table. If we hit the duplicate rowid constraint (or any
200369 u32 iRowid; /* The rowid */
200677 /* Return the current rowid value */
200973 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER, ...)
200979 ** table that maps from the entries rowid to the id of the node that it
200997 ** of 4-byte coordinates. For leaf nodes the integer is the rowid
201207 ** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates).
201864 ** node pNode. If pNode is a leaf node, this is a rowid. If it is
202717 ** rowid iRowid. If successful, set *ppLeaf to point to the node and
202724 i64 iRowid, /* The rowid searching for */
202797 /* Special case - lookup by rowid. */
202904 ** 1 Unused Direct lookup by rowid.
202943 ** is, do not consider the lookup-by-rowid plan as using such a plan would
202959 /* We have an equality constraint on the rowid. Use strategy 1. */
202969 /* This strategy involves a two rowid lookups on an B-Tree structures
202971 ** considered almost as quick as a direct rowid lookup (for which
203669 ** rowid of the row to delete, which can be used to find the leaf on which
203983 ** Select a currently unused rowid for a new r-tree record.
203996 ** Remove the entry with rowid=iDelete from the r-tree structure.
204173 int bHaveRowid = 0; /* Set to 1 after new rowid is determined */
204189 ** 1. A duplicate rowid value, or
204234 /* If a rowid value was supplied, check if it is already present in
204258 /* If aData[0] is not an SQL NULL value, it is the rowid of a
204274 /* Figure out the rowid of the new row. */
204417 "node", "parent", "rowid"
204469 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1",
204471 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1",
204489 "CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno",
204532 zFormat = "INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)"
204533 "ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno";
204545 "SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1",
204565 sqlite3_str_appendf(p, " WHERE rowid=?1");
204807 ** list, containing the 8-byte rowid/pageno followed by the
205019 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER, ...)
205035 "SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1"
205301 ** table corresponding to the cell's rowid value that
206684 ** 1 rowid lookup
206710 /* Special case - lookup by rowid. */
206817 ** 1 "rowid" Direct lookup by rowid.
206847 pIdxInfo->idxStr = "rowid";
206914 ** argv[0] = the rowid to be deleted
206919 ** argv[1] = rowid to insert, or an SQL NULL to select automatically
206925 ** argv[0] = rowid to modify. Never NULL
206926 ** argv[1] = rowid after the change. Never NULL
206939 i64 oldRowid; /* The old rowid */
206941 i64 newRowid; /* The new rowid */
206976 /* If a rowid value was supplied, check if it is already present in
206993 /* If aData[0] is not an SQL NULL value, it is the rowid of a
208330 ** has no PRIMARY KEY, affected rows must be identified by rowid.
208378 ** key column - "rowid". Virtual tables for which the "rowid" column does
208472 ** UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
208476 ** table in "rowid" order is roughly the same as reading them sorted by
209112 ** 1: Table has an implicit rowid.
209962 ** RBU_PK_NONE: Table has an implicit rowid.
210294 ** updating a table (not an index). The table may be a rowid table or
210298 ** rows from the source table. For a rowid table, the WHERE clause
210313 int bRowid, /* True for a rowid table */
212209 rbuIsVacuum(p) ? "rowid" : "rbu_rowid"
217011 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
217456 ** not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias)
221483 ** Returns the rowid of the current row.
221492 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
222013 /* Name of rank and rowid columns */
222015 #define FTS5_ROWID_NAME "rowid"
222090 ** the string "rowid" otherwise. This text is not quoted - if it is
222306 #define FTS5INDEX_QUERY_DESC 0x0002 /* Docs in descending rowid order */
222571 #define FTS5_STMT_SCAN_ASC 0 /* SELECT rowid, * FROM ... ORDER BY 1 ASC */
222572 #define FTS5_STMT_SCAN_DESC 1 /* SELECT rowid, * FROM ... ORDER BY 1 DESC */
222573 #define FTS5_STMT_LOOKUP 2 /* SELECT rowid, * FROM ... WHERE rowid=? */
222652 ** // The document with rowid iRowid matches the expression!
226031 pRet->zContentRowid = sqlite3Fts5Strndup(&rc, "rowid", -1);
226418 int bDesc; /* Iterate in descending rowid order */
226441 i64 iRowid; /* Current rowid */
226801 ** Argument pTerm must be a synonym iterator. Return the current rowid
226903 ** pointing to the same rowid when this function is called. This function
226904 ** checks if the current rowid really is a match, and if so populates
226909 ** otherwise. It is not considered an error code if the current rowid is
227151 int bDesc, /* True if iterator is "rowid DESC" */
227152 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
227177 int bDesc, /* True if iterator is "rowid DESC" */
227178 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
227393 ** point to the same rowid, and if not, advances them until they do.
227408 i64 iLast; /* Lastest rowid any iterator points to */
227410 int bMatch; /* True if all terms are at the same rowid */
227420 /* Initialize iLast, the "lastest" rowid any iterator points to. If the
227422 ** the maximum rowid. Or, if the iterator is "ORDER BY rowid DESC", then it
227423 ** means the minimum rowid. */
227485 /* Find the firstest rowid any synonym points to. */
227489 ** is valid - each iterator that points to a rowid before iFrom. */
227666 ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the
227667 ** new lastest rowid seen so far. */
227847 ** parameter is passed a non-zero value, iteration is in descending rowid
227850 ** If iterating in ascending rowid order (bDesc==0), the first document
227851 ** visited is that with the smallest rowid that is larger than or equal
227853 ** then the first document visited must have a rowid smaller than or
227867 /* If not at EOF but the current rowid occurs earlier than iFirst in
229493 ** * Size of previous position list and rowid, as a 4 byte
229497 ** Offset of last rowid written to data area. Relative to first byte of
229743 /* Add the first rowid field to the hash-entry */
229759 ** + 9 bytes for a new rowid,
229782 /* If this is a new rowid, append the 4-byte size field for the previous
229783 ** entry, and the new rowid for this entry. */
230041 ** records that contain a copy of the first rowid on each page spanned by
230125 ** varint: first rowid
230128 ** varint: rowid delta (always > 0)
230155 ** * The byte offset of the first rowid on the page, if it exists
230173 ** + if the first rowid on a page occurs before the first term, it
230176 ** varint: first rowid
230195 ** * First rowid on page indicated by previous field. As a varint.
230198 ** positive delta if the termless page contains at least one rowid,
230208 ** * Copy of first rowid on page indicated by previous field. As a varint.
230210 ** * A list of delta-encoded varints - the first rowid on each subsequent
230228 ** The rowid for each segment leaf is found by passing the segment id and
230359 i64 iPrev; /* Previous rowid value written to page */
230365 i64 iPrevRowid; /* Previous rowid written to current leaf */
230366 u8 bFirstRowidInDoclist; /* True if next rowid is first in doclist */
230367 u8 bFirstRowidInPage; /* True if next rowid is first in page */
230388 ** Object for iterating through a single segment, visiting each term/rowid
230400 ** rowid field of the current entry. Usually this is the size field of the
230401 ** position list data. The exception is if the rowid for the current entry
230420 ** it is set, iterate through rowid in descending order instead of the
230426 ** For each rowid on the page corresponding to the current term, the
230445 ** is the offset of the first rowid in the current doclist. */
230455 int *aRowidOffset; /* Array of offset to rowid fields */
230461 i64 iRowid; /* Current rowid */
230490 ** visiting each term/rowid pair in the merged data.
230501 ** points to the smaller term/rowid combination. Iterators at EOF are
230525 i64 iSwitchRowid; /* Firstest rowid of other than aFirst[1] */
230552 i64 iRowid; /* First rowid on leaf iLeafPgno */
231397 ** points to the first rowid in the doclist-index.
231702 ** Fts5SegIter.rowid
231799 ** the position-list size field for the first relevant rowid on the page.
231800 ** Fts5SegIter.rowid is set, but nPos and bDel are not.
231803 ** relevant rowid on the page and, if necessary, initializes the
231806 ** byte of the position list content associated with said rowid.
231875 ** thing on the page - i.e. the first rowid is on the following page.
232160 ** Iterator pIter currently points to the first rowid in a doclist. This
232177 ** position-list content for the current rowid. Back it up so that it
232188 /* If this condition is true then the largest rowid for the current
232190 ** see where said rowid really is. */
232195 /* The last rowid in the doclist may not be on the current page. Search
232196 ** forward to find the page containing the last rowid. */
232215 /* If pLast is NULL at this point, then the last rowid for this doclist
232218 ** field associated with the first relevant rowid on the page.
232221 ** rowid. In this case configure the iterator so that it points to the
232222 ** first rowid on this page.
232248 ** Iterator pIter currently points to the first rowid of a doclist.
232729 ** Move the seg-iter so that it points to the first rowid on page iLeafPgno.
232767 ** past rowid iFrom. Regardless of the value of iFrom, the iterator is
232855 ** points to the same term though - just a different rowid. This function
233448 ** The iterator initially points to the first term/rowid entry in the
233560 int bDesc, /* True for descending rowid order */
233606 ** Return the rowid of the entry that the iterator currently points
233897 ** a copy of iRowid (which will become the first rowid on the next
233900 ** also push its first rowid upwards. */
233911 /* This was the root node. Push its first rowid up to the new root. */
234068 ** Append a rowid and position-list size field to the writers output.
234082 /* If this is to be the first rowid written to the page, set the
234083 ** rowid-pointer in the page-header. Also append a value to the dlidx
234090 /* Write the rowid. */
234382 /* Append the rowid to the output */
234640 fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */
234937 i64 *piLastRowid, /* IN/OUT: Previous rowid written (if any) */
235079 ** a linked-list starting at pHead in ascending order of rowid. Avoid
235095 ** first rowid in one input is a large negative number, and the first in
235207 int bDesc, /* True for "ORDER BY rowid DESC" */
235340 ** to the document with rowid iRowid.
235555 ** Open a new iterator to iterate though all rowid that match the
235644 ** Move to the next matching rowid.
235654 ** Move to the next matching term/rowid. Used by the fts5vocab module.
235676 ** Move to the next matching rowid that occurs at or after iMatch. The
235678 ** in ascending or descending rowid order.
235819 ** Instead, it tests that the same set of pgno/rowid combinations are
235873 i64 rowid = pIter->iRowid;
235876 cksum ^= sqlite3Fts5IndexEntryCksum(rowid, 0, 0, iIdx, z, n);
235885 cksum ^= sqlite3Fts5IndexEntryCksum(rowid, iCol, iOff, iIdx, z, n);
236123 ** is also a rowid pointer within the leaf page header, it points to a
236129 int iRowidOff; /* Offset of first rowid on leaf */
236169 /* Check any rowid-less pages that occur before the current leaf. */
236181 ** contain the rowid suggested by the same. */
236324 ** Decode a segment-data rowid from the %_data table. This function is
236960 ** SELECT rowid, <fts> FROM <fts> ORDER BY +rank;
236969 i64 iRowid; /* Current rowid */
236989 ** <tbl> MATCH <expr> AND rowid BETWEEN $iFirstRowid AND $iLastRowid
236991 ** If the cursor iterates in descending order of rowid, iFirstRowid
236992 ** is the upper limit (i.e. the "first" rowid visited) and iLastRowid
237003 int bDesc; /* True for "ORDER BY rowid DESC" queries */
237037 #define FTS5_BI_ROWID_EQ 0x0004 /* rowid == ? */
237038 #define FTS5_BI_ROWID_LE 0x0008 /* rowid <= ? */
237039 #define FTS5_BI_ROWID_GE 0x0010 /* rowid >= ? */
237279 #define FTS5_PLAN_ROWID 6 /* (rowid = ?) */
237321 ** 4. An == constraint against the rowid column.
237322 ** 5. A < or <= constraint against the rowid column.
237323 ** 6. A > or >= constraint against the rowid column.
237328 ** 6. ORDER BY rowid [ASC|DESC]
237346 ** Equality constraint against the rowid: "="
237347 ** A < or <= against the rowid: "<"
237348 ** A > or >= against the rowid: ">"
237362 ** * One rowid range constraint: cost=750.0
237363 ** * Both rowid range constraints: cost=500.0
237364 ** * An == rowid constraint: cost=100.0
237369 ** * One rowid range constraint: cost=750000.0
237370 ** * Both rowid range constraints: cost=250000.0
237371 ** * An == rowid constraint: cost=10.0
237685 ** is using. Then attempt to move the cursor to a rowid equal to or laster
237686 ** (in the cursors sort order - ASC or DESC) than the current rowid.
237688 ** If the new rowid is not equal to the old, set output parameter *pbSkip
237836 "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s",
238030 ** 2. A by-rowid lookup.
238044 int bDesc; /* True if ORDER BY [rank|rowid] DESC */
238047 sqlite3_value *pRowidEq = 0; /* rowid = ? expression (or NULL) */
238048 sqlite3_value *pRowidLe = 0; /* rowid <= ? expression (or NULL) */
238049 sqlite3_value *pRowidGe = 0; /* rowid >= ? expression (or NULL) */
238145 /* Set the cursor upper and lower rowid limits. Only some strategies
238148 ** on the rowid field. */
238199 ** by rowid (ePlan==FTS5_PLAN_ROWID). */
238232 ** Return the rowid that the cursor currently points to.
238248 ** retrieve the rowid for the current row of the result set. fts5
238249 ** exposes %_content.rowid as the rowid for the virtual table. The
238250 ** rowid should be written to *pRowid.
238435 ** A delete specifies a single argument - the rowid of the row to remove.
238439 ** 1. The "old" rowid, or NULL.
238440 ** 2. The "new" rowid.
238448 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
238484 ** any conflict on the rowid value must be detected before any
238488 ** 2) UPDATE (rowid not modified)
238489 ** 3) UPDATE (rowid modified)
238492 ** Cases 3 and 4 may violate the rowid constraint.
238537 i64 iOld = sqlite3_value_int64(apVal[0]); /* Old rowid */
238538 i64 iNew = sqlite3_value_int64(apVal[1]); /* New rowid */
240002 int bWithout, /* True for without rowid */
240143 ** If a row with rowid iDel is present in the %_content table, add the
240424 ** Allocate a new rowid. This is used for "external content" tables when
240425 ** a NULL value is inserted into the rowid column. The new rowid is allocated
240430 ** this case the user is required to provide a rowid explicitly.
240808 ** specified rowid and populates aCol[] with the results.
243526 Fts5IndexIter *pIter; /* Term/rowid iterator object */
243538 i64 rowid; /* This table's current rowid value */
243859 pCsr->rowid = 0;
243945 pCsr->rowid++;
244213 ** retrieve the rowid for the current row of the result set. The
244214 ** rowid should be written to *pRowid.
244221 *pRowid = pCsr->rowid;
244447 ** Return the rowid for the current row. In this implementation, the
244448 ** rowid is the same as the output value.