Lines Matching refs:rowid
3130 ** CAPI3REF: Last Insert Rowid
3133 ** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
3135 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available
3136 ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
3139 ** is another alias for the rowid.
3141 ** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of
3142 ** the most recent successful [INSERT] into a rowid table or [virtual table]
3143 ** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not
3144 ** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred
3152 ** Some virtual table implementations may INSERT rows into rowid tables as
3154 ** to disk). In this case subsequent calls to this function return the rowid
3156 ** unintuitive results. Virtual table implementations that do write to rowid
3158 ** rowid value using [sqlite3_set_last_insert_rowid()] before returning
3162 ** return the [rowid] of the inserted row as long as the trigger is
3184 ** function is running and thus changes the last insert [rowid],
3187 ** last insert [rowid].
3192 ** CAPI3REF: Set the Last Insert Rowid value.
3752 ** select random [ROWID | ROWIDs] when inserting new records into a table that
3753 ** already uses the largest possible [ROWID]. The PRNG is also used for
6704 ** a [rowid table].
6709 ** row is updated, inserted or deleted in a rowid table.
6717 ** ^The final callback parameter is the [rowid] of the row.
6718 ** ^In the case of an update, this is the [rowid] after the update takes place.
6722 ** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified.
6934 ** ^If the specified column is "rowid", "oid" or "_rowid_" and the table
6935 ** is not a [WITHOUT ROWID] table and an
6939 ** for the [rowid] are set as follows:
7269 int iColumn; /* Column constrained. -1 for ROWID */
7475 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
7498 ** <li> ^(Table zTable is a WITHOUT ROWID table)^,
7564 ** by the rowid value passed as the second argument. Only the row can be
9561 ** For an UPDATE or DELETE operation on a [rowid table], the sixth
9562 ** parameter passed to the preupdate callback is the initial [rowid] of the
9563 ** row being modified or deleted. For an INSERT operation on a rowid table,
9564 ** or any operation on a WITHOUT ROWID table, the value of the sixth
9565 ** parameter is undefined. For an INSERT or UPDATE on a rowid table the
9566 ** seventh parameter is the final rowid value of the row being inserted
9568 ** function is not defined for operations on WITHOUT ROWID tables, or for
9569 ** INSERT operations on rowid tables.
9618 sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
9619 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
9928 sqlite3_int64 iRowid; /* Rowid for current entry */
10089 ** PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY
11404 ** Returns the rowid of the current row.
11413 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
13550 ** Index btrees (used for indexes and also WITHOUT ROWID tables) contain
13554 ** Table btrees (used for rowid tables) contain an integer rowid used as
13958 #define OP_NewRowid 116 /* synopsis: r[P2]=rowid */
13966 #define OP_Rowid 124 /* synopsis: r[P2]=rowid */
13972 #define OP_DeferredSeek 130 /* synopsis: Move P3 to P1.rowid if needed */
13973 #define OP_IdxRowid 131 /* synopsis: r[P2]=rowid */
15220 i64 lastRowid; /* ROWID of most recent insert (see above) */
15776 i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
15811 #define TF_WithoutRowid 0x0020 /* No rowid. PRIMARY KEY is the key */
15812 #define TF_NoVisibleRowid 0x0040 /* No user-visible "rowid" column */
15847 /* Does the table have a rowid */
15943 ** for the rowid at the end.
16087 #define XN_ROWID (-1) /* Indexed column is the rowid */
16273 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
16728 #define SRT_Fifo 5 /* Store result as data with an automatic rowid */
16741 #define SRT_Table 14 /* Store result as data with an automatic rowid */
16769 int regCtr; /* Memory register holding the rowid counter */
16872 int regRowid; /* Register holding rowid of CREATE TABLE entry */
18181 #define IN_INDEX_ROWID 1 /* Search the rowid of the table */
18713 u8 isTable; /* True for rowid tables. False for indexes */
18802 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
19075 Index *pPk; /* PK index if pTab is WITHOUT ROWID */
27410 ** read the rowid field.
30486 /* 116 */ "NewRowid" OpHelp("r[P2]=rowid"),
30494 /* 124 */ "Rowid" OpHelp("r[P2]=rowid"),
30500 /* 130 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
30501 /* 131 */ "IdxRowid" OpHelp("r[P2]=rowid"),
47330 ** can be intermixed with tests to see if a given rowid has been
47400 i64 v; /* ROWID value for this entry */
47519 SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
47528 pEntry->v = rowid;
47532 if( rowid<=pLast->v ){ /*OPTIMIZATION-IF-FALSE*/
60930 ** rowid iRow is being replaced or deleted. In this case invalidate
60936 i64 iRow, /* The rowid that might be changing */
61051 ** (the rowid) is stored in pCur->nKey and pCur->pKey is left set to
61063 /* Only the rowid is required for a table btree */
64828 ** Return the value of the integer key or "rowid" for a table btree.
68193 ** and WITHOUT ROWID tables with exactly one column which is the
68548 ** For a table btree (used for rowid tables), only the pX.nKey value of
68550 ** rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields
68553 ** For an index btree (used for indexes and WITHOUT ROWID tables), the
68962 ** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
69844 checkAppendMsg(pCheck, "Rowid %lld out of order", info.nKey);
72350 int nCol = pIdx->nColumn; /* Number of index columns including rowid */
74221 sqlite3XPrintf(p, "rowid");
77373 ** Read the rowid (the last field in the record) and store it in *rowid.
77379 SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
77383 u32 typeRowid; /* Serial type of the rowid */
77384 u32 lenRowid; /* Size of the rowid */
77411 /* The last field of the index should be an integer - the ROWID.
77433 *rowid = v.u.i;
77451 ** pUnpacked is either created without a rowid or is truncated so that it
77452 ** omits the rowid at the end. The rowid at the end of the index entry
77454 ** of the keys prior to the final rowid, not the entire key.
83798 i64 iKey; /* The rowid we are to seek to */
84116 ** contain a record with rowid P3 then jump immediately to P2.
84118 ** a record with rowid P3 then
84139 ** keys). P3 is an integer rowid. If P1 does not contain a record with
84140 ** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an
84141 ** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then
84224 ** Synopsis: r[P2]=rowid
84226 ** Get a new integer record number (a.k.a "rowid") used as the key to a table.
84239 i64 v; /* The new rowid */
84240 VdbeCursor *pC; /* Cursor of table to get the new rowid */
84243 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
84255 /* The next rowid or record number (different terms for the same
84258 ** First we attempt to find the largest existing rowid and add one
84259 ** to that. But if the largest existing rowid is already the maximum
84263 ** The second algorithm is to select a rowid at random and see if
84265 ** succeeded. If the random rowid does exist, we select a new one
84329 /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the
84333 assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is
84368 ** then rowid is stored for subsequent return by the
84518 ** of the memory cell that contains the value that the rowid of the row will
84538 ** OP_Delete will have also set the pC->movetoTarget field to the rowid of
84549 ** VdbeCursor.movetoTarget to the current rowid. */
84759 /* Opcode: Rowid P1 P2 * * *
84760 ** Synopsis: r[P2]=rowid
84843 ** The next use of the Rowid or Column or Prev instruction for P1
84948 ** The next use of the Rowid or Column or Next instruction for P1
85218 ** Synopsis: Move P3 to P1.rowid if needed
85237 ** Synopsis: r[P2]=rowid
85241 ** the rowid of the table entry to which this index entry points.
85243 ** See also: Rowid, MakeRecord.
85249 i64 rowid; /* Rowid that P1 current points to */
85270 rowid = 0; /* Not needed. Only used to silence a warning. */
85271 rc = sqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid);
85283 pTabCur->movetoTarget = rowid;
85290 pOut->u.i = rowid;
85304 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
85315 ** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID
85325 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
85327 ** ROWID on the P1 index.
85336 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
85338 ** ROWID on the P1 index.
85517 ** P1>1. The P3 argument must be 1 (BTREE_INTKEY) for a rowid table
85518 ** it must be 2 (BTREE_BLOBKEY) for a index or WITHOUT ROWID table.
85584 "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",
86832 ** is the rowid of a row to delete. If argv[0] is NULL then no
86833 ** deletion occurs. The argv[1] element is the rowid of the new
86835 ** rowid for itself. The subsequent elements in the array are
86838 ** If P2==1 then no insert is performed. argv[0] is the rowid of
86843 ** is set to the value of the rowid for the row just inserted.
86853 sqlite_int64 rowid;
86880 rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);
86885 db->lastRowid = rowid;
87393 rowid: %lld", iRow);
87458 sqlite3ErrorMsg(&sParse, "cannot open table without rowid: %s", zTable);
87557 /* blobSeekToRow() will initialize r[1] to the desired rowid */
87558 {OP_NotExists, 0, 5, 1}, /* 2: Seek the cursor to rowid=r[1] */
90504 ** the comparison, ignore the rowid field at the end of each record.
91434 /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
91507 ** Perhaps the name is a reference to the ROWID
91744 /* The special operator TK_ROW means use the rowid for the first
92546 ** Expr.iColumn The column index in X.Y. -1 for the rowid.
94756 if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
94978 /* The "x IN (SELECT rowid FROM table)" case */
95089 } /* End if not an rowid index */
95219 ** to be of the form "<rowid> IN (?, ?, ?)", where <rowid> is a reference
95240 int isRowid /* If true, LHS of IN operator is a rowid */
95671 /* In this case, the RHS is the ROWID of table b-tree and so we also
95985 int iTabCur, /* The table cursor. Or the PK cursor for WITHOUT ROWID */
96018 ** is called. If iColumn<0 then code is generated that extracts the rowid.
96647 ** read the rowid field.
96650 ** parameter is set to 0 for an old.rowid reference, or to (i+1)
96652 ** i is the index of the column. For a new.rowid reference, p1 is
96663 ** p1==0 -> old.rowid p1==3 -> new.rowid
96678 (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName),
99107 i64 iRowid; /* Rowid in main table of the key */
99108 u8 *aRowid; /* Key for WITHOUT ROWID tables */
99119 int nCol; /* Number of columns in index + pk/rowid */
99120 int nKeyCol; /* Number of index columns w/o the pk/rowid */
99145 /* Initialize the BLOB value of a ROWID
99161 /* Initialize the INTEGER value of a ROWID.
99209 ** N: The number of columns in the index including the rowid/pk (note 1)
99210 ** K: The number of columns in the index excluding the rowid/pk.
99214 ** WITHOUT ROWID table, N is the number of PRIMARY KEY columns, not the
99219 ** For indexes on ordinary rowid tables, N==K+1. But for indexes on
99220 ** WITHOUT ROWID tables, N=K+P where P is the number of columns in the
99222 ** original WITHOUT ROWID table as N==K as a special case.
99443 /* The "rows less-than" for the rowid column must be greater than that
99548 ** R Rowid for the current row. Might be a key record for
99549 ** WITHOUT ROWID tables.
99639 #define STAT_GET_ROWID 1 /* "rowid" column of stat[34] entry */
99824 int regNewRowid = iMem++; /* Rowid for the inserted record */
99828 int regRowid = iMem++; /* Rowid argument passed to stat_push() */
99933 ** regRowid = idx(rowid)
99942 ** the regPrev array and a trailing rowid (the rowid slot is required
99955 ** (1) the number of columns in the index including the rowid
99956 ** (or for a WITHOUT ROWID table, the number of PK columns),
99957 ** (2) the number of columns in the key without the rowid/pk
100041 ** regRowid = idx(rowid) // STAT34 only
100500 ** Look up an index by name. Or, if the name of a WITHOUT ROWID table
101527 zCol = "ROWID";
102623 ** The rowid for the new entry is left in register pParse->regRowid.
102625 ** The rowid and root page number values are needed by the code that
102909 ** then we will try to use that column as the rowid. Set the Table.iPKey
103290 ** has a WITHOUT ROWID clause. The job of this routine is to convert both
103292 ** are appropriate for a WITHOUT ROWID table instead of a rowid table.
103307 ** (6) Replace the rowid tail on all automatically generated UNIQUE
103394 ** the final rowid column into one or more columns of the PRIMARY KEY.
103493 /* Special processing for WITHOUT ROWID Tables */
103497 "AUTOINCREMENT not allowed on WITHOUT ROWID tables");
103575 int regRowid; /* Rowid of the next row to insert */
103633 "WHERE rowid=#%d",
104544 Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */
104830 /* Append the table key to the end of the index. For WITHOUT ROWID
104832 ** normal tables (when pPk==0) this will be the rowid.
104958 ** of a WITHOUT ROWID table.
104978 ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In
105813 ** Code an OP_Halt due to non-unique rowid.
105818 Table *pTab /* The table with the non-unique rowid */
105827 zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName);
106705 Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */
106707 SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */
106731 ** DELETE FROM table_a WHERE rowid IN (
106732 ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
106773 /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */
106983 /* For a rowid table, initialize the RowSet to an empty set */
106989 /* For a WITHOUT ROWID table, create an ephemeral table used to
107001 /* Construct a query to find the rowid or primary key for every row
107020 /* Extract the rowid or primary key for the current row */
107035 /* For ONEPASS, no need to store the rowid/primary-key. There is only
107058 /* Add the rowid of the row to be deleted to the RowSet */
107059 nKey = 1; /* OP_DeferredSeek always uses a single rowid */
107148 ** maximum rowid counter values recorded while inserting into
107195 ** in the case of a rowid table, or the PRIMARY KEY index in the case
107196 ** of a WITHOUT ROWID table.)
107269 ** avoid copying the contents of the rowid register. */
107368 ** for rowid tables or to the primary key index for WITHOUT ROWID
107392 Index *pPk; /* PRIMARY KEY index, or NULL for rowid tables */
107415 ** the entry that needs indexing. If pTab is a WITHOUT ROWID table, then
107439 ** on a table with multiple indices, and especially with the ROWID or
109869 ** for pTab. regBase itself holds the rowid. regBase+1 holds the first
110008 ** $current_rowid!=rowid
110011 ** The first form is used for rowid tables. The second form is used
110012 ** for WITHOUT ROWID tables. In the second form, the primary key is
110173 ** is set to -1). If the rowid column is modified by the UPDATE statement
110183 int bChngRowid /* True if rowid is modified by this update */
110200 ** is set to -1). If the rowid column is modified by the UPDATE statement
110255 ** rowid of the row being deleted, followed by each of the column values
110274 int bChngRowid /* True if rowid is UPDATEd */
110502 ** UPDATE statement modifies the rowid fields of the table.
110520 int chngRowid /* True for UPDATE that affects rowid */
110771 int bChngRowid /* True if rowid is UPDATEd */
110860 ** If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index
110903 ** rowid that appears as the last column in every index.
111040 ** that holds the maximum rowid. Return zero if pTab is not an AUTOINCREMENT
111053 ** (2) Register to hold the maximum ROWID of pTab.
111054 ** (3) Register to hold the rowid in sqlite_sequence of pTab
111064 int memId = 0; /* Register holding maximum rowid */
111081 pInfo->regCtr = ++pToplevel->nMem; /* Max rowid register */
111082 pToplevel->nMem++; /* Rowid in sqlite_sequence */
111097 int memId; /* Register holding max rowid */
111141 ** Update the maximum rowid for an autoincrement calculation.
111144 ** new rowid that is about to be inserted. If that new rowid is
111145 ** larger than the maximum rowid in the memId memory cell, then the
111156 ** maximum rowid values back into the sqlite_sequence register.
111340 u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
111348 int regIns; /* Block of regs holding rowid+data being inserted */
111349 int regRowid; /* registers holding insert rowid */
111450 /* Allocate registers for holding the rowid of the new row,
111553 int regTempRowid; /* Register to hold temp table ROWID */
111672 ** not happened yet) so we substitute a rowid of -1
111789 ** Whenever this column is read, the rowid will be substituted
111885 ** maximum rowid counter values recorded while inserting into
111928 #define CKCNSTRNT_ROWID 0x02 /* CHECK constraint references the ROWID */
111952 ** aiChng[i]>=0, and also the ROWID is modified if chngRowid is true.
111955 ** changing columns (or the rowid if it is changing). In other words,
111984 ** that regNewData points to) will contain the new rowid, or NULL in the
111985 ** case of a WITHOUT ROWID table. The second register in the range will
111995 ** rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table)
111999 ** For an INSERT, the pkChng boolean indicates whether or not the rowid
112001 ** is zero, it means that the either rowid is computed automatically or
112002 ** that the table is a WITHOUT ROWID table and has no rowid. On an INSERT,
112004 ** value for either the rowid column or its INTEGER PRIMARY KEY alias.
112015 ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY
112016 ** index when operating on a WITHOUT ROWID table. iIdxCur is the cursor
112068 u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */
112084 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
112085 int ipkTop = 0; /* Top of the rowid change constraint check */
112086 int ipkBottom = 0; /* Bottom of the rowid change constraint check */
112097 /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
112098 ** normal rowid tables. nPkField is the number of key fields in the
112099 ** pPk index or 1 for a rowid table. In other words, nPkField is the
112117 continue; /* ROWID is never NULL */
112195 /* If rowid is changing, make sure the new rowid does not previously
112201 /* Figure out what action to take in case of a rowid collision */
112210 /* pkChng!=0 does not mean that the rowid has changed, only that
112211 ** it might have changed. Skip the conflict logic below if the rowid
112218 /* If the response to a rowid conflict is REPLACE but the response
112220 ** to defer the running of the rowid conflict checking until after
112232 /* Check to see if the new rowid already exists in the table. Skip
112237 /* Generate code that deals with a rowid collision */
112267 ** REPLACE INTO t(rowid) VALUES($newrowid)
112317 ** WITHOUT ROWID table.
112361 VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
112371 ** of a WITHOUT ROWID table and there has been no change the
112393 ** (2) The table is a WITHOUT ROWID table
112420 /* Conflict only if the rowid of the existing index entry
112421 ** is different from old-rowid */
112441 /* If currently processing the PRIMARY KEY of a WITHOUT ROWID
112538 ** rowid and the content to be inserted.
112557 int regData; /* Content registers (after the rowid) */
112630 ** ROWID table) is returned in *piDataCur. The first index cursor is
112633 ** Use iBase as the first cursor (either the *piDataCur for rowid tables
112634 ** or the first index for WITHOUT ROWID tables) if it is non-negative.
112637 ** For a rowid table, *piDataCur will be exactly one less than *piIdxCur.
112638 ** For a WITHOUT ROWID table, *piDataCur will be somewhere in the range
112649 u8 p5, /* P5 value for OP_Open* opcodes (except on WITHOUT ROWID) */
112805 int regData, regRowid; /* Registers holding data and rowid */
112878 return 0; /* source and destination must both be WITHOUT ROWID or not */
112988 ** (If the destination is not initially empty, the rowid fields
114786 /* 43 */ "rowid",
117487 sqlite_int64 iRowid; /* Current rowid */
118076 "SELECT name, rootpage, sql FROM \"%w\".%s ORDER BY rowid",
120029 ** declaration type for a ROWID field is INTEGER. Exactly when an expression
120121 ** rowid of the sub-select or view. This expression is legal (see
120139 zOrigCol = "rowid";
120311 zCol = "rowid";
120400 zName = iCol>=0 ? pTab->aCol[iCol].zName : "rowid";
121842 ** entry in pEList. (But leave references to the ROWID column
125961 ** reg+0 OLD.rowid
125965 ** reg+N+1 NEW.rowid
126034 ** It is not possible to determine if the old.rowid or new.rowid column is
126102 Expr *pRowidExpr, /* Expression used to recompute the rowid */
126182 Index *pPk; /* The PRIMARY KEY index for WITHOUT ROWID tables */
126193 u8 chngPk; /* PRIMARY KEY changed in a WITHOUT ROWID table */
126194 u8 chngRowid; /* Rowid changed in a normal table */
126213 int nKey = 0; /* Number of elements in regKey for WITHOUT ROWID */
126222 int regOldRowid = 0; /* The old rowid */
126223 int regNewRowid = 0; /* The new rowid */
126346 j<0 ? "ROWID" : pTab->aCol[j].zName,
126516 /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
126517 ** mode, write the rowid into the FIFO. In either of the one-pass modes,
126725 /* If changing the rowid value, or if there are foreign key constraints
126801 ** maximum rowid counter values recorded while inserting into
126852 ** (A) The original rowid of that row.
126853 ** (B) The revised rowid for the row.
126868 Expr *pRowid, /* Expression used to recompute the rowid */
126882 int regRowid; /* Register for ephem table rowid */
127777 ** The VM register number pParse->regRowid holds the rowid of an
127785 "WHERE rowid=#%d",
128143 /* WITHOUT ROWID virtual tables must either be read-only (xUpdate==0)
129199 if( i==XN_ROWID ) return "rowid";
129362 zRangeOp = ">? AND rowid<";
129369 sqlite3XPrintf(&str, " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp);
129753 testcase( nEq>1 ); /* Happens with a UNIQUE index on ROWID */
130183 ** a rowid value just read from cursor iIdxCur, open on index pIdx. This
130185 ** rowid stored in register iRowid.
130350 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
130498 ** equality comparison against the ROWID field. Or
130499 ** we reference multiple rows using a "rowid IN (...)"
130521 /* Case 3: We have an inequality comparison against the ROWID field.
130952 ** RowSetTest are such that the rowid of the current row is inserted
130957 ** RowSetTest # Insert rowid into rowset
130973 ** Added 2014-05-26: If the table is a WITHOUT ROWID table, then
130985 int regRowid = 0; /* Register holding rowid */
131026 ROWID.
131112 ** rowid (or PRIMARY KEY) for the current row so that the same
135724 ** variable sPk to represent the rowid primary key index. Make this
135756 && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
136466 ** Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row.
136478 ** The rowid for a table is always UNIQUE and NOT NULL so whenever the
136479 ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is
137213 /* TUNING: Cost of a rowid lookup is 10 */
137815 ** WITHOUT ROWID table. No need for a separate index */
140657 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
144285 ** Return the ROWID of the most recent insert
146841 ** 1. The specified column name was rowid", "oid" or "_rowid_"
148809 #define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */
149660 fts3Appendf(pRc, &zRet, "rowid");
150341 ** 1. Direct lookup by rowid or docid.
150381 /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */
150392 ** rowid/docid lookup, prefer the MATCH strategy. This is done even
150393 ** though the rowid/docid lookup is faster than a MATCH query, selecting
150427 /* If using a docid=? or rowid=? strategy, set the UNIQUE flag. */
150448 /* Regardless of the strategy selected, FTS can deliver rows in rowid (or
150537 ** "SELECT <columns> FROM %_content WHERE rowid = ?"
150551 zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
152006 sqlite3_value *pCons = 0; /* The MATCH or rowid constraint, if any */
152076 "SELECT %s WHERE rowid BETWEEN %lld AND %lld ORDER BY rowid %s",
152081 zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s",
152117 ** retrieve the rowid for the current row of the result set. fts3
152118 ** exposes %_content.docid as the rowid for the virtual table. The
152119 ** rowid should be written to *pRowid.
152196 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
154795 sqlite3_int64 iRowid; /* Current rowid */
155031 /* Increment our pretend rowid value. */
155262 ** xRowid - Return the current rowid for the cursor.
155266 sqlite_int64 *pRowid /* OUT: Rowid value */
158497 int iRowid; /* Current 'rowid' value */
158838 ** xRowid - Return the current rowid for the cursor.
158842 sqlite_int64 *pRowid /* OUT: Rowid value */
159030 sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */
159031 sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */
159032 sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */
159182 /* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?",
159183 /* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)",
159189 /* 7 */ "SELECT %s WHERE rowid=?",
159832 ** apVal[1] rowid
159837 ** apVal[p->nColumn+3] Hidden "docid" column (alias for rowid)
159878 ** a value for the "rowid" field, for the "docid" field, or for both.
159879 ** Which is a problem, since "rowid" and "docid" are aliases for the
159882 ** INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2);
159885 ** for both docid and some other rowid alias.
159891 /* A rowid/docid conflict. */
163617 ** exists, is stored in the rowid==1 row of the %_stat table.
164363 ** SQLite value pRowid contains the rowid of a row that may or may not be
164420 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
164469 /* If this is an INSERT operation, or an UPDATE that modifies the rowid
164479 /* Find the value object that holds the new rowid value. */
164489 /* The new rowid is not NULL (in this case the rowid will be
164492 ** rowid column. So if the conflict mode is REPLACE, then delete any
164493 ** existing row with rowid=pNewRowid.
164496 ** the %_content table. If we hit the duplicate rowid constraint (or any
167081 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER)
167087 ** table that maps from the entries rowid to the id of the node that it
167104 ** of 4-byte coordinates. For leaf nodes the integer is the rowid
167265 ** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates).
167878 ** node pNode. If pNode is a leaf node, this is a rowid. If it is
168667 ** rowid iRowid. If successful, set *ppLeaf to point to the node and
168674 i64 iRowid, /* The rowid searching for */
168750 /* Special case - lookup by rowid. */
168836 ** 1 Unused Direct lookup by rowid.
168875 ** is, do not consider the lookup-by-rowid plan as using such a plan would
168891 /* We have an equality constraint on the rowid. Use strategy 1. */
168901 /* This strategy involves a two rowid lookups on an B-Tree structures
168903 ** considered almost as quick as a direct rowid lookup (for which
169582 ** rowid of the row to delete, which can be used to find the leaf on which
169892 ** Select a currently unused rowid for a new r-tree record.
169905 ** Remove the entry with rowid=iDelete from the r-tree structure.
170077 int bHaveRowid = 0; /* Set to 1 after new rowid is determined */
170087 ** 1. A duplicate rowid value, or
170131 /* If a rowid value was supplied, check if it is already present in
170155 /* If azData[0] is not an SQL NULL value, it is the rowid of a
170171 /* Figure out the rowid of the new row. */
170349 "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1",
170351 "DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1",
170366 "CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);"
170596 ** list, containing the 8-byte rowid/pageno followed by the
170807 ** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER)
170823 "SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?"
171076 ** table corresponding to the cell's rowid value that
172273 ** has no PRIMARY KEY, affected rows must be identified by rowid.
172321 ** key column - "rowid". Virtual tables for which the "rowid" column does
172415 ** UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
172419 ** table in "rowid" order is roughly the same as reading them sorted by
172695 ** CREATE TABLE rbu_count(tbl TEXT PRIMARY KEY, cnt INTEGER) WITHOUT ROWID;
172996 ** 1: Table has an implicit rowid.
172999 ** 4: Table is WITHOUT ROWID.
173836 ** RBU_PK_NONE: Table has an implicit rowid.
173839 ** RBU_PK_WITHOUT_ROWID: Table is WITHOUT ROWID.
174431 ** CREATE TABLE t1(a, b, c, PRIMARY KEY(b, a DESC)) WITHOUT ROWID
174485 ** function creates a WITHOUT ROWID imposter table named "rbu_imposter2"
174493 ** CREATE TABLE rbu_imposter2(c1 TEXT, c2 REAL, id INTEGER) WITHOUT ROWID;
174543 "CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID",
174609 (pIter->eType==RBU_PK_WITHOUT_ROWID ? " WITHOUT ROWID" : "")
174715 "CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID",
175700 rbuIsVacuum(p) ? "rowid" : "rbu_rowid"
176214 ** CREATE TABLE rbu_count(tbl TEXT PRIMARY KEY, cnt INTEGER) WITHOUT ROWID;
180063 sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
180064 sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
180505 ** not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias)
185465 u32 iRowid; /* The rowid */
185737 /* Return the current rowid value */
186158 ** Returns the rowid of the current row.
186167 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
186671 /* Name of rank and rowid columns */
186673 #define FTS5_ROWID_NAME "rowid"
186742 ** the string "rowid" otherwise. This text is not quoted - if it is
186954 #define FTS5INDEX_QUERY_DESC 0x0002 /* Docs in descending rowid order */
187158 i64 iRowid, /* Rowid for this entry */
187199 #define FTS5_STMT_SCAN_ASC 0 /* SELECT rowid, * FROM ... ORDER BY 1 ASC */
187200 rowid, * FROM ... ORDER BY 1 DESC */
187201 #define FTS5_STMT_LOOKUP 2 /* SELECT rowid, * FROM ... WHERE rowid=? */
187272 ** // The document with rowid iRowid matches the expression!
190538 pRet->zContentRowid = sqlite3Fts5Strndup(&rc, "rowid", -1);
190923 int bDesc; /* Iterate in descending rowid order */
190946 i64 iRowid; /* Current rowid */
191190 ** Argument pTerm must be a synonym iterator. Return the current rowid
191291 ** pointing to the same rowid when this function is called. This function
191292 ** checks if the current rowid really is a match, and if so populates
191297 ** otherwise. It is not considered an error code if the current rowid is
191539 int bDesc, /* True if iterator is "rowid DESC" */
191540 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
191565 int bDesc, /* True if iterator is "rowid DESC" */
191566 i64 *piLast, /* IN/OUT: Lastest rowid seen so far */
191781 ** point to the same rowid, and if not, advances them until they do.
191796 i64 iLast; /* Lastest rowid any iterator points to */
191798 int bMatch; /* True if all terms are at the same rowid */
191808 /* Initialize iLast, the "lastest" rowid any iterator points to. If the
191810 ** the maximum rowid. Or, if the iterator is "ORDER BY rowid DESC", then it
191811 ** means the minimum rowid. */
191873 /* Find the firstest rowid any synonym points to. */
191877 ** is valid - each iterator that points to a rowid before iFrom. */
192054 ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the
192055 ** new lastest rowid seen so far. */
192235 ** parameter is passed a non-zero value, iteration is in descending rowid
192238 ** If iterating in ascending rowid order (bDesc==0), the first document
192239 ** visited is that with the smallest rowid that is larger than or equal
192241 ** then the first document visited must have a rowid smaller than or
192255 /* If not at EOF but the current rowid occurs earlier than iFirst in
193768 ** * Rowid, as a varint
193770 ** * Size of previous position list and rowid, as a 4 byte
193774 ** Offset of last rowid written to data area. Relative to first byte of
193792 i64 iRowid; /* Rowid of last value written */
193953 i64 iRowid, /* Rowid for this entry */
194009 /* Add the first rowid field to the hash-entry */
194026 ** + 9 bytes for a new rowid,
194049 /* If this is a new rowid, append the 4-byte size field for the previous
194050 ** entry, and the new rowid for this entry. */
194295 ** records that contain a copy of the first rowid on each page spanned by
194379 ** varint: first rowid
194382 ** varint: rowid delta (always > 0)
194409 ** * The byte offset of the first rowid on the page, if it exists
194427 ** + if the first rowid on a page occurs before the first term, it
194430 ** varint: first rowid
194449 ** * First rowid on page indicated by previous field. As a varint.
194452 ** positive delta if the termless page contains at least one rowid,
194462 ** * Copy of first rowid on page indicated by previous field. As a varint.
194464 ** * A list of delta-encoded varints - the first rowid on each subsequent
194472 #define FTS5_AVERAGES_ROWID 1 /* Rowid used for the averages record */
194482 ** The rowid for each segment leaf is found by passing the segment id and
194552 i64 iWriteRowid; /* Rowid for current doc being written */
194618 i64 iPrev; /* Previous rowid value written to page */
194624 i64 iPrevRowid; /* Previous rowid written to current leaf */
194625 u8 bFirstRowidInDoclist; /* True if next rowid is first in doclist */
194626 u8 bFirstRowidInPage; /* True if next rowid is first in page */
194647 ** Object for iterating through a single segment, visiting each term/rowid
194659 ** rowid field of the current entry. Usually this is the size field of the
194660 ** position list data. The exception is if the rowid for the current entry
194679 ** it is set, iterate through rowid in descending order instead of the
194685 ** For each rowid on the page corresponding to the current term, the
194704 ** is the offset of the first rowid in the current doclist. */
194714 int *aRowidOffset; /* Array of offset to rowid fields */
194720 i64 iRowid; /* Current rowid */
194749 ** visiting each term/rowid pair in the merged data.
194760 ** points to the smaller term/rowid combination. Iterators at EOF are
194785 i64 iSwitchRowid; /* Firstest rowid of other than aFirst[1] */
194812 i64 iRowid; /* First rowid on leaf iLeafPgno */
195591 ** points to the first rowid in the doclist-index.
195896 ** Fts5SegIter.rowid
195991 ** the position-list size field for the first relevant rowid on the page.
195992 ** Fts5SegIter.rowid is set, but nPos and bDel are not.
195995 ** relevant rowid on the page and, if necessary, initializes the
195998 ** byte of the position list content associated with said rowid.
196067 ** thing on the page - i.e. the first rowid is on the following page.
196353 ** Iterator pIter currently points to the first rowid in a doclist. This
196370 ** position-list content for the current rowid. Back it up so that it
196381 /* If this condition is true then the largest rowid for the current
196383 ** see where said rowid really is. */
196388 /* The last rowid in the doclist may not be on the current page. Search
196389 ** forward to find the page containing the last rowid. */
196408 /* If pLast is NULL at this point, then the last rowid for this doclist
196411 ** field associated with the first relevant rowid on the page.
196414 ** rowid. In this case configure the iterator so that it points to the
196415 ** first rowid on this page.
196438 ** Iterator pIter currently points to the first rowid of a doclist.
196906 ** Move the seg-iter so that it points to the first rowid on page iLeafPgno.
196944 ** past rowid iFrom. Regardless of the value of iFrom, the iterator is
197033 ** points to the same term though - just a different rowid. This function
197618 ** The iterator initially points to the first term/rowid entry in the
197725 int bDesc, /* True for descending rowid order */
197770 ** Return the rowid of the entry that the iterator currently points
198039 ** Rowid iRowid has just been appended to the current leaf page. It is the
198057 ** a copy of iRowid (which will become the first rowid on the next
198060 ** also push its first rowid upwards. */
198071 /* This was the root node. Push its first rowid up to the new root. */
198225 ** Append a rowid and position-list size field to the writers output.
198239 /* If this is to be the first rowid written to the page, set the
198240 ** rowid-pointer in the page-header. Also append a value to the dlidx
198247 /* Write the rowid. */
198528 /* Append the rowid to the output */
198784 fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */
199073 i64 *piLastRowid, /* IN/OUT: Previous rowid written (if any) */
199074 i64 iRowid /* Rowid to append */
199173 ** first rowid in one input is a large negative number, and the first in
199281 int bDesc, /* True for "ORDER BY rowid DESC" */
199377 ** to the document with rowid iRowid.
199584 ** Open a new iterator to iterate though all rowid that match the
199667 ** Move to the next matching rowid.
199677 ** Move to the next matching term/rowid. Used by the fts5vocab module.
199699 ** Move to the next matching rowid that occurs at or after iMatch. The
199701 ** in ascending or descending rowid order.
199841 ** Instead, it tests that the same set of pgno/rowid combinations are
199895 i64 rowid = pIter->iRowid;
199898 cksum ^= sqlite3Fts5IndexEntryCksum(rowid, 0, 0, iIdx, z, n);
199907 cksum ^= sqlite3Fts5IndexEntryCksum(rowid, iCol, iOff, iIdx, z, n);
200090 i64 iRow; /* Rowid for this leaf */
200107 ** is also a rowid pointer within the leaf page header, it points to a
200113 int iRowidOff; /* Offset of first rowid on leaf */
200153 /* Check any rowid-less pages that occur before the current leaf. */
200165 ** contain the rowid suggested by the same. */
200303 ** Decode a segment-data rowid from the %_data table. This function is
200307 i64 iRowid, /* Rowid from %_data table */
200326 int iSegid, iHeight, iPgno, bDlidx; /* Rowid compenents */
200512 i64 iRowid; /* Rowid for record being decoded */
200513 int iSegid,iHeight,iPgno,bDlidx;/* Rowid components */
200896 ** SELECT rowid, <fts> FROM <fts> ORDER BY +rank;
200905 i64 iRowid; /* Current rowid */
200925 ** <tbl> MATCH <expr> AND rowid BETWEEN $iFirstRowid AND $iLastRowid
200927 ** If the cursor iterates in descending order of rowid, iFirstRowid
200928 ** is the upper limit (i.e. the "first" rowid visited) and iLastRowid
200939 int bDesc; /* True for "ORDER BY rowid DESC" queries */
200973 #define FTS5_BI_ROWID_EQ 0x0004 /* rowid == ? */
200974 #define FTS5_BI_ROWID_LE 0x0008 /* rowid <= ? */
200975 #define FTS5_BI_ROWID_GE 0x0010 /* rowid >= ? */
201212 #define FTS5_PLAN_ROWID 6 /* (rowid = ?) */
201236 ** 3. An == constraint against the rowid column.
201237 ** 4. A < or <= constraint against the rowid column.
201238 ** 5. A > or >= constraint against the rowid column.
201243 ** 6. ORDER BY rowid [ASC|DESC]
201254 ** * One rowid range constraint: cost=750.0
201255 ** * Both rowid range constraints: cost=500.0
201256 ** * An == rowid constraint: cost=100.0
201261 ** * One rowid range constraint: cost=750000.0
201262 ** * Both rowid range constraints: cost=250000.0
201263 ** * An == rowid constraint: cost=10.0
201279 int iCol; /* 0==rowid, 1==tbl, 2==rank */
201546 ** is using. Then attempt to move the cursor to a rowid equal to or laster
201547 ** (in the cursors sort order - ASC or DESC) than the current rowid.
201549 ** If the new rowid is not equal to the old, set output parameter *pbSkip
201684 "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s",
201878 ** 2. A by-rowid lookup.
201893 int bDesc; /* True if ORDER BY [rank|rowid] DESC */
201897 sqlite3_value *pRowidEq = 0; /* rowid = ? expression (or NULL) */
201898 sqlite3_value *pRowidLe = 0; /* rowid <= ? expression (or NULL) */
201899 sqlite3_value *pRowidGe = 0; /* rowid >= ? expression (or NULL) */
201937 /* Set the cursor upper and lower rowid limits. Only some strategies
201940 ** on the rowid field. */
201998 ** by rowid (ePlan==FTS5_PLAN_ROWID). */
202028 ** Return the rowid that the cursor currently points to.
202044 ** retrieve the rowid for the current row of the result set. fts5
202045 ** exposes %_content.rowid as the rowid for the virtual table. The
202046 ** rowid should be written to *pRowid.
202223 ** A delete specifies a single argument - the rowid of the row to remove.
202227 ** 1. The "old" rowid, or NULL.
202228 ** 2. The "new" rowid.
202236 sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */
202273 ** any conflict on the rowid value must be detected before any
202277 ** 2) UPDATE (rowid not modified)
202278 ** 3) UPDATE (rowid modified)
202281 ** Cases 3 and 4 may violate the rowid constraint.
202303 i64 iDel = sqlite3_value_int64(apVal[0]); /* Rowid to delete */
202313 i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */
202321 i64 iOld = sqlite3_value_int64(apVal[0]); /* Old rowid */
202322 i64 iNew = sqlite3_value_int64(apVal[1]); /* New rowid */
203752 int bWithout, /* True for without rowid */
203761 bWithout?" WITHOUT ROWID":
203893 ** If a row with rowid iDel is present in the %_content table, add the
204157 ** Allocate a new rowid. This is used for "external content" tables when
204158 ** a NULL value is inserted into the rowid column. The new rowid is allocated
204163 ** this case the user is required to provide a rowid explicitly.
204533 ** specified rowid and populates aCol[] with the results.
206650 Fts5IndexIter *pIter; /* Term/rowid iterator object */
206662 i64 rowid; /* This table's current rowid value */
206973 pCsr->rowid = 0;
207052 pCsr->rowid++;
207310 ** retrieve the rowid for the current row of the result set. The
207311 ** rowid should be written to *pRowid.
207318 *pRowid = pCsr->rowid;
207411 sqlite3_int64 iRowid; /* The rowid */
207551 ** Return the rowid for the current row. In this implementation, the
207552 ** rowid is the same as the output value.