aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2006-06-28 18:18:09 +0000
committerdrh <drh@noemail.net>2006-06-28 18:18:09 +0000
commit3765df48c361f327d916fda61c1da434b7926e80 (patch)
treeee68884d37b7fa09455a519bb4f13e5cc4c9b3d0 /src
parent2cc55698cd70d2a273cd17356ac7b9e33302c03f (diff)
downloadsqlite-3765df48c361f327d916fda61c1da434b7926e80.tar.gz
sqlite-3765df48c361f327d916fda61c1da434b7926e80.zip
Changes to get tests to pass with OMIT_VIRTUALTABLE. Ticket #1877. (CVS 3318)
FossilOrigin-Name: 60616496b7d97fdda99262e2bab25e625151e857
Diffstat (limited to 'src')
-rw-r--r--src/pager.c14
-rw-r--r--src/vdbe.c10
2 files changed, 16 insertions, 8 deletions
diff --git a/src/pager.c b/src/pager.c
index d68c11bce..76273ea71 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.269 2006/06/15 14:31:07 drh Exp $
+** @(#) $Id: pager.c,v 1.270 2006/06/28 18:18:09 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -403,7 +403,12 @@ static void pager_resize_hash_table(Pager *pPager, int N){
pPager->nHash = N;
pPager->aHash = aHash;
for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
- int h = pPg->pgno & (N-1);
+ int h;
+ if( pPg->pgno==0 ){
+ assert( pPg->pNextHash==0 && pPg->pPrevHash==0 );
+ continue;
+ }
+ h = pPg->pgno & (N-1);
pPg->pNextHash = aHash[h];
if( aHash[h] ){
aHash[h]->pPrevHash = pPg;
@@ -1856,7 +1861,7 @@ static int syncJournal(Pager*);
*/
static void unlinkHashChain(Pager *pPager, PgHdr *pPg){
if( pPg->pgno==0 ){
- /* If the page number is zero, then this page is not in any hash chain. */
+ assert( pPg->pNextHash==0 && pPg->pPrevHash==0 );
return;
}
if( pPg->pNextHash ){
@@ -1867,7 +1872,6 @@ static void unlinkHashChain(Pager *pPager, PgHdr *pPg){
pPg->pPrevHash->pNextHash = pPg->pNextHash;
}else{
int h = pPg->pgno & (pPager->nHash-1);
- assert( pPager->aHash[h]==pPg );
pPager->aHash[h] = pPg->pNextHash;
}
if( MEMDB ){
@@ -2795,6 +2799,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
/* Link the page into the page hash table */
h = pgno & (pPager->nHash-1);
+ assert( pgno!=0 );
pPg->pNextHash = pPager->aHash[h];
pPager->aHash[h] = pPg;
if( pPg->pNextHash ){
@@ -3849,6 +3854,7 @@ int sqlite3pager_movepage(Pager *pPager, void *pData, Pgno pgno){
}
/* Change the page number for pPg and insert it into the new hash-chain. */
+ assert( pgno!=0 );
pPg->pgno = pgno;
h = pgno & (pPager->nHash-1);
if( pPager->aHash[h] ){
diff --git a/src/vdbe.c b/src/vdbe.c
index 0ae5669e6..5fda3338a 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.569 2006/06/24 11:51:34 danielk1977 Exp $
+** $Id: vdbe.c,v 1.570 2006/06/28 18:18:09 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -3895,7 +3895,7 @@ case OP_IdxIsNull: { /* no-push */
case OP_Destroy: {
int iMoved;
Vdbe *pVdbe;
- int iCnt = db->activeVdbeCnt;
+ int iCnt;
#ifndef SQLITE_OMIT_VIRTUALTABLE
iCnt = 0;
for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){
@@ -3903,6 +3903,8 @@ case OP_Destroy: {
iCnt++;
}
}
+#else
+ iCnt = db->activeVdbeCnt;
#endif
if( iCnt>1 ){
rc = SQLITE_LOCKED;
@@ -3912,11 +3914,11 @@ case OP_Destroy: {
pTos++;
pTos->flags = MEM_Int;
pTos->i = iMoved;
- #ifndef SQLITE_OMIT_AUTOVACUUM
+#ifndef SQLITE_OMIT_AUTOVACUUM
if( rc==SQLITE_OK && iMoved!=0 ){
sqlite3RootPageMoved(&db->aDb[pOp->p2], iMoved, pOp->p1);
}
- #endif
+#endif
}
break;
}