1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Add extended return code SQLITE_CORRUPT_VTAB. Returned when the tcontents of the sqlite tables used internally by a virtual table module are invalid or inconsistent.

FossilOrigin-Name: 8844e8bfb87314fb40ecb92705e8fff88f72bb38
This commit is contained in:
dan
2011-05-17 15:56:16 +00:00
parent fc24373999
commit 133d7dab17
9 changed files with 41 additions and 31 deletions

View File

@ -517,17 +517,17 @@ nodeAcquire(
if( pNode && iNode==1 ){
pRtree->iDepth = readInt16(pNode->zData);
if( pRtree->iDepth>RTREE_MAX_DEPTH ){
rc = SQLITE_CORRUPT;
rc = SQLITE_CORRUPT_VTAB;
}
}
/* If no error has occurred so far, check if the "number of entries"
** field on the node is too large. If so, set the return code to
** SQLITE_CORRUPT.
** SQLITE_CORRUPT_VTAB.
*/
if( pNode && rc==SQLITE_OK ){
if( NCELL(pNode)>((pRtree->iNodeSize-4)/pRtree->nBytesPerCell) ){
rc = SQLITE_CORRUPT;
rc = SQLITE_CORRUPT_VTAB;
}
}
@ -535,7 +535,7 @@ nodeAcquire(
if( pNode!=0 ){
nodeHashInsert(pRtree, pNode);
}else{
rc = SQLITE_CORRUPT;
rc = SQLITE_CORRUPT_VTAB;
}
*ppNode = pNode;
}else{
@ -1062,7 +1062,7 @@ static int nodeRowidIndex(
return SQLITE_OK;
}
}
return SQLITE_CORRUPT;
return SQLITE_CORRUPT_VTAB;
}
/*
@ -1657,7 +1657,7 @@ static int AdjustTree(
int iCell;
if( nodeParentIndex(pRtree, p, &iCell) ){
return SQLITE_CORRUPT;
return SQLITE_CORRUPT_VTAB;
}
nodeGetCell(pRtree, pParent, iCell, &cell);
@ -2329,7 +2329,7 @@ static int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){
}
rc = sqlite3_reset(pRtree->pReadParent);
if( rc==SQLITE_OK ) rc = rc2;
if( rc==SQLITE_OK && !pChild->pParent ) rc = SQLITE_CORRUPT;
if( rc==SQLITE_OK && !pChild->pParent ) rc = SQLITE_CORRUPT_VTAB;
pChild = pChild->pParent;
}
return rc;