1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Moving UPDATE towards the iDataCur/iIdxCur representation. Still not working

for WITHOUT ROWID, though.

FossilOrigin-Name: deacbd21b50cc8c63a1572d14a4bbc7af4052d37
This commit is contained in:
drh
2013-10-31 12:13:37 +00:00
parent 26198bb481
commit 77f64bb7b9
5 changed files with 54 additions and 88 deletions

View File

@@ -1122,41 +1122,6 @@ insert_cleanup:
#undef tmask
#endif
/*
** Locate the "principle btree" for a table. This is the table itself for
** ordinary tables, but for WITHOUT ROWID tables, the principle btree is the
** PRIMARY KEY index.
**
** Inputs are pTab and baseCur. The *ppPk is written with a pointer to the
** PRIMARY KEY index for WITHOUT ROWID tables or with NULL for ordinary
** tables. The *piPkCur is written with the cursor to use, assuming that the
** table cursor is baseCur and that index cursors are consecutively numbered
** thereafter.
*/
void sqlite3PrincipleBtree(
Table *pTab, /* The main Table object */
int baseCur, /* VDBE cursor for main table. */
Index **ppPk, /* Write PRIMARY KEY index of WITHOUT ROWID tables here */
int *piPkCur /* Either baseCur or the cursor for *ppPk */
){
int pkCur;
Index *pPk;
if( !HasRowid(pTab) ){
pkCur = baseCur+1;
pPk = pTab->pIndex;
while( ALWAYS(pPk) && pPk->autoIndex!=2 ){
pPk=pPk->pNext;
pkCur++;
}
}else{
pkCur = baseCur;
pPk = 0;
}
*ppPk = pPk;
*piPkCur = pkCur;
}
/*
** Generate code to do constraint checks prior to an INSERT or an UPDATE.
**