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

If a database becomes corrupted such that an index is out of sync with its

table, make sure the corruption is detected and reported back.  Do not assume
that indices always contain rowids for valid table rows.

FossilOrigin-Name: 83395a3d24f18170fc068d9e644291678694c3f0
This commit is contained in:
drh
2010-07-30 18:40:55 +00:00
parent a3388cc5b0
commit be0b237e6a
3 changed files with 12 additions and 15 deletions

View File

@@ -2400,11 +2400,8 @@ int sqlite3VdbeCursorMoveto(VdbeCursor *p){
rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res);
if( rc ) return rc;
p->lastRowid = p->movetoTarget;
p->rowidIsValid = ALWAYS(res==0) ?1:0;
if( NEVER(res<0) ){
rc = sqlite3BtreeNext(p->pCursor, &res);
if( rc ) return rc;
}
if( res!=0 ) return SQLITE_CORRUPT_BKPT;
p->rowidIsValid = 1;
#ifdef SQLITE_TEST
sqlite3_search_count++;
#endif