Lines Matching refs:rowid

2864 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available
2868 ** is another alias for the rowid.
2870 ** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of
2871 ** the most recent successful [INSERT] into a rowid table or [virtual table]
2873 ** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred
2881 ** Some virtual table implementations may INSERT rows into rowid tables as
2883 ** to disk). In this case subsequent calls to this function return the rowid
2885 ** unintuitive results. Virtual table implementations that do write to rowid
2887 ** rowid value using [sqlite3_set_last_insert_rowid()] before returning
2891 ** return the [rowid] of the inserted row as long as the trigger is
2913 ** function is running and thus changes the last insert [rowid],
2916 ** last insert [rowid].
7176 ** a [rowid table].
7181 ** row is updated, inserted or deleted in a rowid table.
7189 ** ^The final callback parameter is the [rowid] of the row.
7190 ** ^In the case of an update, this is the [rowid] after the update takes place.
7435 ** ^If the specified column is "rowid", "oid" or "_rowid_" and the table
7440 ** for the [rowid] are set as follows:
7821 ** operand is the rowid.
8030 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
8119 ** by the rowid value passed as the second argument. Only the row can be
10709 ** For an UPDATE or DELETE operation on a [rowid table], the sixth
10710 ** parameter passed to the preupdate callback is the initial [rowid] of the
10711 ** row being modified or deleted. For an INSERT operation on a rowid table,
10713 ** parameter is undefined. For an INSERT or UPDATE on a rowid table the
10714 ** seventh parameter is the final rowid value of the row being inserted
10717 ** DELETE operations on rowid tables.
10780 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
11475 ** PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY
13247 ** Returns the rowid of the current row.
13256 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
16299 ** Table btrees (used for rowid tables) contain an integer rowid used as
16743 #define OP_NewRowid 127 /* synopsis: r[P2]=rowid */
16751 #define OP_Rowid 135 /* synopsis: r[P2]=PX rowid of P1 */
16757 #define OP_DeferredSeek 141 /* synopsis: Move P3 to P1.rowid if needed */
16758 #define OP_IdxRowid 142 /* synopsis: r[P2]=rowid */
18401 i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
18454 #define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */
18456 #define TF_NoVisibleRowid 0x00000200 /* No user-visible "rowid" column */
18507 /* Does the table have a rowid */
18617 ** for the rowid at the end.
18792 #define XN_ROWID (-1) /* Indexed column is the rowid */
19013 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
19204 #define ENAME_ROWID 3 /* "DB.TABLE._rowid_" for * expansion of rowid */
19648 #define SRT_Fifo 8 /* Store result as data with an automatic rowid */
19658 #define SRT_Table 14 /* Store result as data with an automatic rowid */
19659 #define SRT_Upfrom 15 /* Store result as data with rowid */
19688 int regCtr; /* Memory register holding the rowid counter */
19826 int regRowid; /* Register holding rowid of CREATE TABLE entry */
21625 #define IN_INDEX_ROWID 1 /* Search the rowid of the table */
22971 0, /* mNoVisibleRowid. 0 == allow rowid-in-view */
23185 u8 isTable; /* True for rowid tables. False for indexes */
23297 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
32784 pItem->fg.rowidUsed ? "+rowid" : "");
33384 ** read the rowid field.
33447 sqlite3TreeViewLine(pView, "First FROM table rowid");
37307 /* 127 */ "NewRowid" OpHelp("r[P2]=rowid"),
37315 /* 135 */ "Rowid" OpHelp("r[P2]=PX rowid of P1"),
37321 /* 141 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
37322 /* 142 */ "IdxRowid" OpHelp("r[P2]=rowid"),
56456 ** can be intermixed with tests to see if a given rowid has been
56649 SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
56658 pEntry->v = rowid;
56662 if( rowid<=pLast->v ){ /*OPTIMIZATION-IF-FALSE*/
71131 ** rowid iRow is being replaced or deleted. In this case invalidate
71137 i64 iRow, /* The rowid that might be changing */
71252 ** (the rowid) is stored in pCur->nKey and pCur->pKey is left set to
71264 /* Only the rowid is required for a table btree */
75394 ** Return the value of the integer key or "rowid" for a table btree.
79813 ** For a table btree (used for rowid tables), only the pX.nKey value of
79815 ** rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields
80143 ** parameter iKey is used as the rowid value when the record is copied
80479 ** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
84224 int nCol = pIdx->nColumn; /* Number of index columns including rowid */
86675 sqlite3_str_appendf(p, "rowid");
87080 int *piPc, /* IN/OUT: Current rowid. Overwritten with next rowid */
87120 /* The rowid is small enough that we are still in the
89991 ** Read the rowid (the last field in the record) and store it in *rowid.
89997 SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
90001 u32 typeRowid; /* Serial type of the rowid */
90002 u32 lenRowid; /* Size of the rowid */
90053 *rowid = v.u.i;
90071 ** pUnpacked is either created without a rowid or is truncated so that it
90072 ** omits the rowid at the end. The rowid at the end of the index entry
90074 ** of the keys prior to the final rowid, not the entire key.
97853 i64 iKey; /* The rowid we are to seek to */
98472 ** contain a record with rowid P3 then jump immediately to P2.
98474 ** a record with rowid P3 then
98495 ** keys). P3 is an integer rowid. If P1 does not contain a record with
98496 ** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an
98497 ** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then
98594 ** Synopsis: r[P2]=rowid
98596 ** Get a new integer record number (a.k.a "rowid") used as the key to a table.
98609 i64 v; /* The new rowid */
98610 VdbeCursor *pC; /* Cursor of table to get the new rowid */
98614 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
98628 /* The next rowid or record number (different terms for the same
98631 ** First we attempt to find the largest existing rowid and add one
98632 ** to that. But if the largest existing rowid is already the maximum
98636 ** The second algorithm is to select a rowid at random and see if
98638 ** succeeded. If the random rowid does exist, we select a new one
98706 assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is
98741 ** then rowid is stored for subsequent return by the
98860 ** tables, register P3 contains the rowid to use with the new record in
98919 ** of the memory cell that contains the value that the rowid of the row will
98944 ** OP_Delete will have also set the pC->movetoTarget field to the rowid of
98955 ** VdbeCursor.movetoTarget to the current rowid. */
99164 ** Synopsis: r[P2]=PX rowid of P1
99668 ** Synopsis: Move P3 to P1.rowid if needed
99687 ** Synopsis: r[P2]=rowid
99691 ** the rowid of the table entry to which this index entry points.
99699 i64 rowid; /* Rowid that P1 current points to */
99720 rowid = 0; /* Not needed. Only used to silence a warning. */
99721 rc = sqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid);
99733 pTabCur->movetoTarget = rowid;
99743 pOut->u.i = rowid;
100015 ** P1>1. The P3 argument must be 1 (BTREE_INTKEY) for a rowid table
100140 "SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid",
101605 ** is the rowid of a row to delete. If argv[0] is NULL then no
101606 ** deletion occurs. The argv[1] element is the rowid of the new
101608 ** rowid for itself. The subsequent elements in the array are
101611 ** If P2==1 then no insert is performed. argv[0] is the rowid of
101616 ** is set to the value of the rowid for the row just inserted.
101626 sqlite_int64 rowid = 0;
101655 rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);
101660 db->lastRowid = rowid;
102387 zErr = sqlite3MPrintf(p->db, "no such rowid: %lld", iRow);
102451 sqlite3ErrorMsg(&sParse, "cannot open table without rowid: %s", zTable);
102551 /* blobSeekToRow() will initialize r[1] to the desired rowid */
102552 {OP_NotExists, 0, 5, 1}, /* 2: Seek the cursor to rowid=r[1] */
105520 ** the comparison, ignore the rowid field at the end of each record.
105605 int iRowid; /* The rowid of the output table */
105888 ** Return the rowid for the current row. In this implementation, the
105889 ** rowid is the same as the output value.
106843 ** SF_NestedFrom subqueries also store an entry for the implicit rowid (or
106845 ** and setting zSpan to "DATABASE.TABLE.<rowid-alias>". This type of pItem
106846 ** argument matches if zCol is a rowid alias. If it is not NULL, (*pbRowid)
107012 int cntTab = 0; /* Number of potential "rowid" matches */
107090 int bRowid = 0; /* True if possible rowid match */
107122 /* This is a potential rowid match, but there has already been
107131 /* rowid cannot be part of a USING clause - assert() this. */
107187 /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
107705 /* The special operator TK_ROW means use the rowid for the first
108815 ** Expr.iColumn The column index in X.Y. -1 for the rowid.
111935 ** Return a pointer to a buffer containing a usable rowid alias for table
112178 /* The "x IN (SELECT rowid FROM table)" case */
112287 } /* End if not an rowid index */
113180 VdbeComment((v, "%s.rowid", pTab->zName));
113222 ** is called. If iColumn<0 then code is generated that extracts the rowid.
113592 VdbeComment((v,"%s.rowid",pTab->zName));
113639 ** 0-(pParse->iSelfTab). The rowid (if any) is in a register
114120 ** read the rowid field.
114123 ** parameter is set to 0 for an old.rowid reference, or to (i+1)
114125 ** i is the index of the column. For a new.rowid reference, p1 is
114136 ** p1==0 -> old.rowid p1==3 -> new.rowid
114158 (pExpr->iColumn<0 ? "rowid" : pExpr->y.pTab->aCol[iCol].zCnName)
118742 int nCol; /* Number of columns in index + pk/rowid */
118743 int nKeyCol; /* Number of index columns w/o the pk/rowid */
118837 ** N: The number of columns in the index including the rowid/pk (note 1)
118838 ** K: The number of columns in the index excluding the rowid/pk.
118846 ** For indexes on ordinary rowid tables, N==K+1. But for indexes on
119069 /* The "rows less-than" for the rowid column must be greater than that
119249 #define STAT_GET_ROWID 1 /* "rowid" column of stat[34] entry */
119416 VdbeComment((v,"%s.rowid",pIdx->zName));
119566 ** regRowid = idx(rowid)
119575 ** the regPrev array and a trailing rowid (the rowid slot is required
119602 ** (1) the number of columns in the index including the rowid
119604 ** (2) the number of columns in the key without the rowid/pk
119677 ** regRowid = idx(rowid) // STAT4 only
122733 ** The rowid for the new entry is left in register pParse->regRowid.
122735 ** The rowid and root page number values are needed by the code that
123188 ** then we will try to use that column as the rowid. Set the Table.iPKey
123625 ** not a rowid or expression.
123691 ** are appropriate for a WITHOUT ROWID table instead of a rowid table.
123706 ** (6) Replace the rowid tail on all automatically generated UNIQUE
123809 ** the final rowid column into one or more columns of the PRIMARY KEY.
124258 " WHERE rowid=#%d",
124369 /* Legacy versions of SQLite allowed the use of the magic "rowid" column
124378 p->tabFlags |= TF_NoVisibleRowid; /* Never allow rowid in view */
125626 ** normal tables (when pPk==0) this will be the rowid.
126758 ** Code an OP_Halt due to non-unique rowid.
126763 Table *pTab /* The table with the non-unique rowid */
126772 zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName);
127807 Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */
127809 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
127833 ** DELETE FROM table_a WHERE rowid IN (
127834 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
127888 /* now generate the new WHERE rowid IN clause for the DELETE/UPDATE */
128115 /* For a rowid table, initialize the RowSet to an empty set */
128133 /* Construct a query to find the rowid or primary key for every row
128157 /* Extract the rowid or primary key for the current row */
128171 /* For ONEPASS, no need to store the rowid/primary-key. There is only
128195 /* Add the rowid of the row to be deleted to the RowSet */
128196 nKey = 1; /* OP_DeferredSeek always uses a single rowid */
128283 ** maximum rowid counter values recorded while inserting into
128328 ** in the case of a rowid table, or the PRIMARY KEY index in the case
128402 ** avoid copying the contents of the rowid register. */
128504 ** for rowid tables or to the primary key index for WITHOUT ROWID
128528 Index *pPk; /* PRIMARY KEY index, or NULL for rowid tables */
131876 ** for pTab. regBase itself holds the rowid. regBase+1 holds the first
132012 ** $current_rowid!=rowid
132015 ** The first form is used for rowid tables. The second form is used
132200 ** is set to -1). If the rowid column is modified by the UPDATE statement
132210 int bChngRowid /* True if rowid is modified by this update */
132227 ** is set to -1). If the rowid column is modified by the UPDATE statement
132283 ** rowid of the row being deleted, followed by each of the column values
132302 int bChngRowid /* True if rowid is UPDATEd */
132535 ** UPDATE statement modifies the rowid fields of the table.
132555 int chngRowid /* True for UPDATE that affects rowid */
132827 int bChngRowid /* True if rowid is UPDATEd */
132962 ** rowid that appears as the last column in every index.
133279 ** that holds the maximum rowid. Return zero if pTab is not an AUTOINCREMENT
133293 ** (3) The rowid in sqlite_sequence of pTab
133304 int memId = 0; /* Register holding maximum rowid */
133314 ** rowid table with exactly two columns.
133338 pInfo->regCtr = ++pToplevel->nMem; /* Max rowid register */
133354 int memId; /* Register holding max rowid */
133404 ** Update the maximum rowid for an autoincrement calculation.
133407 ** new rowid that is about to be inserted. If that new rowid is
133408 ** larger than the maximum rowid in the memId memory cell, then the
133419 ** maximum rowid values back into the sqlite_sequence register.
133805 int regIns; /* Block of regs holding rowid+data being inserted */
133806 int regRowid; /* registers holding insert rowid */
133921 /* Allocate a block registers to hold the rowid and the values
134224 ** SELECT, go ahead and copy the value into the rowid slot now, so that
134232 ** Only ordinary columns are computed in this loop. The rowid
134234 ** computed after the rowid since they might depend on the value
134235 ** of the rowid.
134245 ** using the rowid. So put a NULL in the IPK slot of the record to avoid
134326 ** not happened yet) so we substitute a rowid of -1
134383 /* Compute the new rowid */
134467 /* If there is a RETURNING clause, populate the rowid register with
134469 ** refer to the "rowid" of the view. */
134512 ** maximum rowid counter values recorded while inserting into
134582 ** changing columns (or the rowid if it is changing). In other words,
134594 int chngRowid /* True if UPDATE changes the rowid */
134684 ** that regNewData points to) will contain the new rowid, or NULL in the
134695 ** rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table)
134699 ** For an INSERT, the pkChng boolean indicates whether or not the rowid
134701 ** is zero, it means that the either rowid is computed automatically or
134702 ** that the table is a WITHOUT ROWID table and has no rowid. On an INSERT,
134704 ** value for either the rowid column or its INTEGER PRIMARY KEY alias.
134713 ** main table, if pTab is a rowid table, and stores that record in the
134723 ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY
134776 u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */
134817 ** normal rowid tables. nPkField is the number of key fields in the
134818 ** pPk index or 1 for a rowid table. In other words, nPkField is the
134998 ** (A) The rowid constraint
135111 /* If rowid is changing, make sure the new rowid does not previously
135117 /* Figure out what action to take in case of a rowid collision */
135143 /* If the response to a rowid conflict is REPLACE but the response
135145 ** to defer the running of the rowid conflict checking until after
135158 /* pkChng!=0 does not mean that the rowid has changed, only that
135159 ** it might have changed. Skip the conflict logic below if the rowid
135166 /* Check to see if the new rowid already exists in the table. Skip
135205 ** REPLACE INTO t(rowid) VALUES($newrowid)
135312 VdbeComment((v, "rowid"));
135395 /* Conflict only if the rowid of the existing index entry
135396 ** is different from old-rowid */
135650 ** rowid and the content to be inserted.
135731 ** Use iBase as the first cursor (either the *piDataCur for rowid tables
135735 ** For a rowid table, *piDataCur will be exactly one less than *piIdxCur.
135906 int regData, regRowid; /* Registers holding data and rowid */
136135 ** (If the destination is not initially empty, the rowid fields
138207 /* 44 */ "rowid",
140791 ** that extracts the rowid off the end of the index record.
140800 "rowid not at end-of-record for row ");
141503 sqlite_int64 iRowid; /* Current rowid */
142175 "SELECT*FROM\"%w\".%s ORDER BY rowid",
144856 ** rowid of the sub-select or view. This expression is legal (see
144874 zOrigCol = "rowid";
145042 zCol = "rowid";
145135 zName = iCol>=0 ? pTab->aCol[iCol].zCnName : "rowid";
148044 ** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This
149054 int nAdd; /* Number of cols including rowid */
153140 ** reg+0 OLD.rowid
153144 ** reg+N+1 NEW.rowid
153221 ** It is not possible to determine if the old.rowid or new.rowid column is
153297 Expr *pRowidExpr, /* Expression used to recompute the rowid */
153367 ** being updated. chngRowid will be true if the rowid of the table is
153374 int chngRowid /* true if the rowid is being updated */
153377 assert( iIdxCol!=XN_ROWID ); /* Cannot index rowid */
153397 ** being updated. chngRowid will be true if the rowid of the table is
153403 int chngRowid /* true if the rowid is being updated */
153455 ** is its rowid. For a virtual table, the results are written to iEph as
153457 ** rowid value in <other-columns> is used as the integer key, and the
153590 int iRowidExpr = -1; /* Index of "rowid=" (or IPK) assignment in pChanges */
153618 int regOldRowid = 0; /* The old rowid */
153619 int regNewRowid = 0; /* The new rowid */
154049 /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
154050 ** mode, write the rowid into the FIFO. In either of the one-pass modes,
154161 /* If the rowid value will change, set register regNewRowid to
154162 ** contain the new value. If the rowid is not being modified,
154343 /* If changing the rowid value, or if there are foreign key constraints
154416 ** maximum rowid counter values recorded while inserting into
154464 ** (A) The original rowid of that row.
154465 ** (B) The revised rowid for the row.
154480 Expr *pRowid, /* Expression used to recompute the rowid */
154494 int regRowid; /* Register for ephemeral table rowid */
154769 /* Check to see if the conflict target matches the rowid. */
154778 /* The conflict-target is the rowid of the primary table */
155874 ** The VM register number pParse->regRowid holds the rowid of an
155882 "WHERE rowid=#%d",
157442 if( i==XN_ROWID ) return "rowid";
157594 "rowid";
157596 const char *zRowid = "rowid";
157671 sqlite3_str_appendf(&str, "rowid=?");
158563 ** a rowid value just read from cursor iIdxCur, open on index pIdx. This
158565 ** rowid stored in register iRowid.
158571 ** Which causes a seek on $iCur to the row with rowid $iRowid.
159000 ** we reference multiple rows using a "rowid IN (...)"
159557 ** RowSetTest are such that the rowid of the current row is inserted
159562 ** RowSetTest # Insert rowid into rowset
159590 int regRowid = 0; /* Register holding rowid */
159747 ** rowid (or PRIMARY KEY) for the current row so that the same
163525 if( pE2->iColumn<0 ) continue; /* Collseq does not matter for rowid */
165908 ** variable sPk to represent the rowid primary key index. Make this
166936 ** Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row.
166948 ** The rowid for a table is always UNIQUE and NOT NULL so whenever the
166949 ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is
167849 /* TUNING: Cost of a rowid lookup is 10 */
171163 int regCRowid = 0; /* Current rowid value */
171165 int regRowid = 0; /* AggStep rowid value */
172213 ** same values in record form, and the rowid used to insert said record
176193 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
183751 ** 1. The specified column name was rowid", "oid" or "_rowid_"
186154 #define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */
187059 fts3Appendf(pRc, &zRet, "rowid");
187758 ** 1. Direct lookup by rowid or docid.
187802 /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */
187813 ** rowid/docid lookup, prefer the MATCH strategy. This is done even
187814 ** though the rowid/docid lookup is faster than a MATCH query, selecting
187848 /* If using a docid=? or rowid=? strategy, set the UNIQUE flag. */
187869 /* Regardless of the strategy selected, FTS can deliver rows in rowid (or
187958 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
187972 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
189462 sqlite3_value *pCons = 0; /* The MATCH or rowid constraint, if any */
189536 "SELECT %s WHERE rowid BETWEEN %lld AND %lld ORDER BY rowid %s",
189541 zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s",
189581 ** retrieve the rowid for the current row of the result set. fts3
189582 ** exposes %_content.docid as the rowid for the virtual table. The
189583 ** rowid should be written to *pRowid.
189660 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
192378 sqlite3_int64 iRowid; /* Current rowid */
192614 /* Increment our pretend rowid value. */
192850 ** xRowid - Return the current rowid for the cursor.
196075 int iRowid; /* Current 'rowid' value */
196417 ** xRowid - Return the current rowid for the cursor.
196765 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
196766 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
196772 /* 7 */ "SELECT %s WHERE rowid=?",
197418 ** apVal[1] rowid
197423 ** apVal[p->nColumn+3] Hidden "docid" column (alias for rowid)
197464 ** a value for the "rowid" field, for the "docid" field, or for both.
197465 ** Which is a problem, since "rowid" and "docid" are aliases for the
197468 ** INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2);
197471 ** for both docid and some other rowid alias.
197477 /* A rowid/docid conflict. */
201303 ** exists, is stored in the rowid==1 row of the %_stat table.
202091 ** SQLite value pRowid contains the rowid of a row that may or may not be
202148 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
202196 /* If this is an INSERT operation, or an UPDATE that modifies the rowid
202206 /* Find the value object that holds the new rowid value. */
202216 /* The new rowid is not NULL (in this case the rowid will be
202219 ** rowid column. So if the conflict mode is REPLACE, then delete any
202220 ** existing row with rowid=pNewRowid.
202223 ** the %_content table. If we hit the duplicate rowid constraint (or any
209632 u32 iRowid; /* The rowid */
209870 /* Length of the path for rowid==0 in bRecursive mode.
209990 /* Return the current rowid value */
210340 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER, ...)
210346 ** table that maps from the entries rowid to the id of the node that it
210364 ** of 4-byte coordinates. For leaf nodes the integer is the rowid
210579 ** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates).
211238 ** node pNode. If pNode is a leaf node, this is a rowid. If it is
212099 ** rowid iRowid. If successful, set *ppLeaf to point to the node and
212106 i64 iRowid, /* The rowid searching for */
212181 /* Special case - lookup by rowid. */
212302 ** 1 Unused Direct lookup by rowid.
212341 ** is, do not consider the lookup-by-rowid plan as using such a plan would
212357 /* We have an equality constraint on the rowid. Use strategy 1. */
212367 /* This strategy involves a two rowid lookups on an B-Tree structures
212369 ** considered almost as quick as a direct rowid lookup (for which
213006 ** rowid of the row to delete, which can be used to find the leaf on which
213214 ** Select a currently unused rowid for a new r-tree record.
213227 ** Remove the entry with rowid=iDelete from the r-tree structure.
213404 int bHaveRowid = 0; /* Set to 1 after new rowid is determined */
213420 ** 1. A duplicate rowid value, or
213465 /* If a rowid value was supplied, check if it is already present in
213489 /* If aData[0] is not an SQL NULL value, it is the rowid of a
213505 /* Figure out the rowid of the new row. */
213650 "node", "parent", "rowid"
213706 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1",
213708 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1",
213726 "CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno",
213769 zFormat = "INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)"
213770 "ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno";
213782 "SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1",
213802 sqlite3_str_appendf(p, " WHERE rowid=?1");
214049 ** list, containing the 8-byte rowid/pageno followed by the
214261 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER, ...)
214277 "SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1"
214552 ** table corresponding to the cell's rowid value that
215956 ** 1 rowid lookup
215983 /* Special case - lookup by rowid. */
216090 ** 1 "rowid" Direct lookup by rowid.
216121 pIdxInfo->idxStr = "rowid";
216188 ** argv[0] = the rowid to be deleted
216193 ** argv[1] = rowid to insert, or an SQL NULL to select automatically
216199 ** argv[0] = rowid to modify. Never NULL
216200 ** argv[1] = rowid after the change. Never NULL
216213 i64 oldRowid; /* The old rowid */
216215 i64 newRowid; /* The new rowid */
216250 /* If a rowid value was supplied, check if it is already present in
216267 /* If aData[0] is not an SQL NULL value, it is the rowid of a
217639 ** has no PRIMARY KEY, affected rows must be identified by rowid.
217687 ** key column - "rowid". Virtual tables for which the "rowid" column does
217781 ** UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
217785 ** table in "rowid" order is roughly the same as reading them sorted by
218422 ** 1: Table has an implicit rowid.
219273 ** RBU_PK_NONE: Table has an implicit rowid.
219605 ** updating a table (not an index). The table may be a rowid table or
219609 ** rows from the source table. For a rowid table, the WHERE clause
219624 int bRowid, /* True for a rowid table */
221536 rbuIsVacuum(p) ? "rowid" : "rbu_rowid"
225025 int bRowid; /* True if this table uses rowid for PK */
225922 int *pbRowid /* OUT: True if only PK is a rowid */
225935 int bRowid = 0; /* Set to true to use rowid as PK */
226658 nByte += 9; /* Size of rowid field - an integer */
226775 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
227258 ** not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias)
231556 ** Returns the rowid of the current row.
231565 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
232130 /* Name of rank and rowid columns */
232132 #define FTS5_ROWID_NAME "rowid"
232211 ** the string "rowid" otherwise. This text is not quoted - if it is
232435 #define FTS5INDEX_QUERY_DESC 0x0002 /* Docs in descending rowid order */
232724 #define FTS5_STMT_SCAN_ASC 0 /* SELECT rowid, * FROM ... ORDER BY 1 ASC */
232725 #define FTS5_STMT_SCAN_DESC 1 /* SELECT rowid, * FROM ... ORDER BY 1 DESC */
232726 #define FTS5_STMT_LOOKUP 2 /* SELECT rowid, * FROM ... WHERE rowid=? */
232805 ** // The document with rowid iRowid matches the expression!
236299 pRet->zContentRowid = sqlite3Fts5Strndup(&rc, "rowid", -1);
236720 int bDesc; /* Iterate in descending rowid order */
236749 i64 iRowid; /* Current rowid */
237156 ** Argument pTerm must be a synonym iterator. Return the current rowid
237258 ** pointing to the same rowid when this function is called. This function
237259 ** checks if the current rowid really is a match, and if so populates
237264 ** otherwise. It is not considered an error code if the current rowid is
237506 int bDesc, /* True if iterator is "rowid DESC" */
237507 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
237532 int bDesc, /* True if iterator is "rowid DESC" */
237533 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
237748 ** point to the same rowid, and if not, advances them until they do.
237763 i64 iLast; /* Lastest rowid any iterator points to */
237765 int bMatch; /* True if all terms are at the same rowid */
237775 /* Initialize iLast, the "lastest" rowid any iterator points to. If the
237777 ** the maximum rowid. Or, if the iterator is "ORDER BY rowid DESC", then it
237778 ** means the minimum rowid. */
237840 /* Find the firstest rowid any synonym points to. */
237844 ** is valid - each iterator that points to a rowid before iFrom. */
238021 ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the
238022 ** new lastest rowid seen so far. */
238202 ** parameter is passed a non-zero value, iteration is in descending rowid
238205 ** If iterating in ascending rowid order (bDesc==0), the first document
238206 ** visited is that with the smallest rowid that is larger than or equal
238208 ** then the first document visited must have a rowid smaller than or
238222 /* If not at EOF but the current rowid occurs earlier than iFirst in
239987 ** * Size of previous position list and rowid, as a 4 byte
239991 ** Offset of last rowid written to data area. Relative to first byte of
240236 /* Add the first rowid field to the hash-entry */
240252 ** + 9 bytes for a new rowid,
240275 /* If this is a new rowid, append the 4-byte size field for the previous
240276 ** entry, and the new rowid for this entry. */
240560 ** records that contain a copy of the first rowid on each page spanned by
240670 ** varint: first rowid
240673 ** varint: rowid delta (always > 0)
240700 ** * The byte offset of the first rowid on the page, if it exists
240718 ** + if the first rowid on a page occurs before the first term, it
240721 ** varint: first rowid
240740 ** * First rowid on page indicated by previous field. As a varint.
240743 ** positive delta if the termless page contains at least one rowid,
240753 ** * Copy of first rowid on page indicated by previous field. As a varint.
240755 ** * A list of delta-encoded varints - the first rowid on each subsequent
240769 ** iPg = (rowid % nHashPg)
240773 ** iSlot = (rowid / nHashPg) % nSlot
240778 ** 1-byte: rowid-0-tombstone flag. This flag is only valid on the
240780 ** the hash table contains rowid 0. If clear, it does not.
240805 ** The rowid for each segment leaf is found by passing the segment id and
240965 i64 iPrev; /* Previous rowid value written to page */
240971 i64 iPrevRowid; /* Previous rowid written to current leaf */
240972 u8 bFirstRowidInDoclist; /* True if next rowid is first in doclist */
240973 u8 bFirstRowidInPage; /* True if next rowid is first in page */
240994 ** Object for iterating through a single segment, visiting each term/rowid
241023 ** it is set, iterate through rowid in descending order instead of the
241029 ** For each rowid on the page corresponding to the current term, the
241056 ** is the offset of the first rowid in the current doclist. */
241066 int *aRowidOffset; /* Array of offset to rowid fields */
241072 i64 iRowid; /* Current rowid */
241110 ** visiting each term/rowid pair in the merged data.
241121 ** points to the smaller term/rowid combination. Iterators at EOF are
241152 i64 iSwitchRowid; /* Firstest rowid of other than aFirst[1] */
241178 i64 iRowid; /* First rowid on leaf iLeafPgno */
242117 ** points to the first rowid in the doclist-index.
242405 ** Fts5SegIter.rowid
242524 ** the position-list size field for the first relevant rowid on the page.
242525 ** Fts5SegIter.rowid is set, but nPos and bDel are not.
242528 ** relevant rowid on the page and, if necessary, initializes the
242531 ** byte of the position list content associated with said rowid.
242600 ** thing on the page - i.e. the first rowid is on the following page.
242886 ** Iterator pIter currently points to the first rowid in a doclist. This
242903 ** position-list content for the current rowid. Back it up so that it
242914 /* If this condition is true then the largest rowid for the current
242916 ** see where said rowid really is. */
242921 /* The last rowid in the doclist may not be on the current page. Search
242922 ** forward to find the page containing the last rowid. */
242941 /* If pLast is NULL at this point, then the last rowid for this doclist
242944 ** field associated with the first relevant rowid on the page.
242947 ** rowid. In this case configure the iterator so that it points to the
242948 ** first rowid on this page.
242974 ** Iterator pIter currently points to the first rowid of a doclist.
243569 ** Move the seg-iter so that it points to the first rowid on page iLeafPgno.
243610 ** past rowid iFrom. Regardless of the value of iFrom, the iterator is
243697 ** points to the same term though - just a different rowid. This function
243764 ** Query a single tombstone hash table for rowid iRowid. Return true if
243810 /* Figure out which page the rowid might be present on. */
244399 ** The iterator initially points to the first term/rowid entry in the
244494 int bDesc, /* True for descending rowid order */
244539 ** Return the rowid of the entry that the iterator currently points
244833 ** a copy of iRowid (which will become the first rowid on the next
244836 ** also push its first rowid upwards. */
244847 /* This was the root node. Push its first rowid up to the new root. */
245004 ** Append a rowid and position-list size field to the writers output.
245018 /* If this is to be the first rowid written to the page, set the
245019 ** rowid-pointer in the page-header. Also append a value to the dlidx
245026 /* Write the rowid. */
245324 /* Append the rowid to the output */
245591 ** it is followed by another rowid/position list.
245724 ** + the rowid or delta rowid value for the entry, and
245728 ** pSeg->iLeafOffset - the rowid or delta rowid value.
245733 ** The offset of the first byte of the rowid or delta-rowid
245737 ** The value of the rowid or delta-rowid value for the doclist
245789 ** to be the last rowid in the doclist for its term. */
245813 /* If this is (a) the first rowid on a page and (b) is not followed by
245814 ** another position list on the same page, set the "first-rowid" field
245981 ** pStruct to remove the entries for term zTerm, rowid iRowid.
246119 fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */
246455 i64 *piLastRowid, /* IN/OUT: Previous rowid written (if any) */
246597 ** a linked-list starting at pHead in ascending order of rowid. Avoid
246613 ** first rowid in one input is a large negative number, and the first in
246725 int bDesc, /* True for "ORDER BY rowid DESC" */
246865 ** to the document with rowid iRowid.
247120 ** associated with position iPos of rowid iRowid. This is used by the
247359 ** a rowid of iFrom or greater.
247539 ** Open a new iterator to iterate though all rowid that match the
247636 ** Move to the next matching rowid.
247650 ** Move to the next matching term/rowid. Used by the fts5vocab module.
247672 ** Move to the next matching rowid that occurs at or after iMatch. The
247674 ** in ascending or descending rowid order.
247900 ** associated with the same segment. This function adds rowid iRowid to
248016 /* If this is page 0 of the old hash, copy the rowid-0-flag from the
248139 ** Add a tombstone for rowid iRowid to segment pSeg.
248177 /* If all has succeeded, write the new rowid into one of the new hash
248254 ** Instead, it tests that the same set of pgno/rowid combinations are
248310 i64 rowid = pIter->iRowid;
248313 cksum ^= sqlite3Fts5IndexEntryCksum(rowid, 0, 0, iIdx, z, n);
248322 cksum ^= sqlite3Fts5IndexEntryCksum(rowid, iCol, iOff, iIdx, z, n);
248561 ** is also a rowid pointer within the leaf page header, it points to a
248579 int iRowidOff; /* Offset of first rowid on leaf */
248619 /* Check any rowid-less pages that occur before the current leaf. */
248631 ** contain the rowid suggested by the same. */
248777 ** Decode a segment-data rowid from the %_data table. This function is
249728 ** SELECT rowid, <fts> FROM <fts> ORDER BY +rank;
249737 i64 iRowid; /* Current rowid */
249757 ** <tbl> MATCH <expr> AND rowid BETWEEN $iFirstRowid AND $iLastRowid
249759 ** If the cursor iterates in descending order of rowid, iFirstRowid
249760 ** is the upper limit (i.e. the "first" rowid visited) and iLastRowid
249771 int bDesc; /* True for "ORDER BY rowid DESC" queries */
249805 #define FTS5_BI_ROWID_EQ 0x0004 /* rowid == ? */
249806 #define FTS5_BI_ROWID_LE 0x0008 /* rowid <= ? */
249807 #define FTS5_BI_ROWID_GE 0x0010 /* rowid >= ? */
250054 #define FTS5_PLAN_ROWID 6 /* (rowid = ?) */
250096 ** 4. An == constraint against the rowid column.
250097 ** 5. A < or <= constraint against the rowid column.
250098 ** 6. A > or >= constraint against the rowid column.
250103 ** 6. ORDER BY rowid [ASC|DESC]
250121 ** Equality constraint against the rowid: "="
250122 ** A < or <= against the rowid: "<"
250123 ** A > or >= against the rowid: ">"
250137 ** * One rowid range constraint: cost=750.0
250138 ** * Both rowid range constraints: cost=500.0
250139 ** * An == rowid constraint: cost=100.0
250144 ** * One rowid range constraint: cost=750000.0
250145 ** * Both rowid range constraints: cost=250000.0
250146 ** * An == rowid constraint: cost=10.0
250255 ** Note that tokendata=1 tables cannot currently handle "ORDER BY rowid DESC".
250463 ** is using. Then attempt to move the cursor to a rowid equal to or laster
250464 ** (in the cursors sort order - ASC or DESC) than the current rowid.
250466 ** If the new rowid is not equal to the old, set output parameter *pbSkip
250624 "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s",
250818 ** 2. A by-rowid lookup.
250832 int bDesc; /* True if ORDER BY [rank|rowid] DESC */
250835 sqlite3_value *pRowidEq = 0; /* rowid = ? expression (or NULL) */
250836 sqlite3_value *pRowidLe = 0; /* rowid <= ? expression (or NULL) */
250837 sqlite3_value *pRowidGe = 0; /* rowid >= ? expression (or NULL) */
250933 /* Set the cursor upper and lower rowid limits. Only some strategies
250936 ** on the rowid field. */
250991 ** by rowid (ePlan==FTS5_PLAN_ROWID). */
251024 ** Return the rowid that the cursor currently points to.
251040 ** retrieve the rowid for the current row of the result set. fts5
251041 ** exposes %_content.rowid as the rowid for the virtual table. The
251042 ** rowid should be written to *pRowid.
251241 ** A delete specifies a single argument - the rowid of the row to remove.
251245 ** 1. The "old" rowid, or NULL.
251246 ** 2. The "new" rowid.
251254 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
251304 ** any conflict on the rowid value must be detected before any
251308 ** 2) UPDATE (rowid not modified)
251309 ** 3) UPDATE (rowid modified)
251312 ** Cases 3 and 4 may violate the rowid constraint.
251364 i64 iOld = sqlite3_value_int64(apVal[0]); /* Old rowid */
251365 i64 iNew = sqlite3_value_int64(apVal[1]); /* New rowid */
252972 int bWithout, /* True for without rowid */
253115 ** If a row with rowid iDel is present in the %_content table, add the
253180 ** table. It adds the tombstone required to delete the entry with rowid
253441 ** Allocate a new rowid. This is used for "external content" tables when
253442 ** a NULL value is inserted into the rowid column. The new rowid is allocated
253447 ** this case the user is required to provide a rowid explicitly.
253825 ** specified rowid and populates aCol[] with the results.
256590 Fts5IndexIter *pIter; /* Term/rowid iterator object */
256602 i64 rowid; /* This table's current rowid value */
256923 pCsr->rowid = 0;
257009 pCsr->rowid++;
257277 ** retrieve the rowid for the current row of the result set. The
257278 ** rowid should be written to *pRowid.
257285 *pRowid = pCsr->rowid;
257516 ** Return the rowid for the current row. In this implementation, the
257517 ** rowid is the same as the output value.