1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix a problem with sub-queries and the flattening optimization. Also handle an extra case of database corruption. (CVS 2324)

FossilOrigin-Name: f7858d8830cdd0f57b8f9bc73068d29a7062b8ac
This commit is contained in:
danielk1977
2005-02-12 08:59:55 +00:00
parent 8cbd373ca7
commit a1cb183d04
8 changed files with 79 additions and 26 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.246 2005/02/06 02:45:42 drh Exp $
** $Id: btree.c,v 1.247 2005/02/12 08:59:56 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@@ -3222,6 +3222,9 @@ static int clearCell(MemPage *pPage, unsigned char *pCell){
ovflPgno = get4byte(&pCell[info.iOverflow]);
while( ovflPgno!=0 ){
MemPage *pOvfl;
if( ovflPgno>sqlite3pager_pagecount(pBt->pPager) ){
return SQLITE_CORRUPT;
}
rc = getPage(pBt, ovflPgno, &pOvfl);
if( rc ) return rc;
ovflPgno = get4byte(pOvfl->aData);
@@ -4766,6 +4769,10 @@ static int clearDatabasePage(
unsigned char *pCell;
int i;
if( pgno>sqlite3pager_pagecount(pBt->pPager) ){
return SQLITE_CORRUPT;
}
rc = getAndInitPage(pBt, pgno, &pPage, pParent);
if( rc ) return rc;
rc = sqlite3pager_write(pPage->aData);