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

Updates prior to release 2.6.3. (CVS 706)

FossilOrigin-Name: 34c4149eea7a48927e36867f4e25ff7fac40c66e
This commit is contained in:
drh
2002-08-13 00:01:16 +00:00
parent 94f3331a0b
commit 74587e5567
10 changed files with 74 additions and 70 deletions

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.69 2002/08/11 20:10:47 drh Exp $
** $Id: btree.c,v 1.70 2002/08/13 00:01:17 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@ -76,6 +76,8 @@
*/
#ifdef SQLITE_TEST
int btree_native_byte_order = 1;
#else
# define btree_native_byte_order 1
#endif
/*
@ -793,7 +795,6 @@ static int newDatabase(Btree *pBt){
return rc;
}
strcpy(pP1->zMagic, zMagicHeader);
#ifdef SQLITE_TEST
if( btree_native_byte_order ){
pP1->iMagic = MAGIC;
pBt->needSwab = 0;
@ -801,10 +802,6 @@ static int newDatabase(Btree *pBt){
pP1->iMagic = swab32(MAGIC);
pBt->needSwab = 1;
}
#else
pP1->iMagic = MAGIC;
pBt->needSwab = 0;
#endif
zeroPage(pBt, pRoot);
sqlitepager_unref(pRoot);
return SQLITE_OK;

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.50 2002/08/12 12:29:57 drh Exp $
** @(#) $Id: pager.c,v 1.51 2002/08/13 00:01:17 drh Exp $
*/
#include "sqliteInt.h"
#include "pager.h"
@ -177,6 +177,8 @@ static const unsigned char aJournalMagic[] = {
*/
#ifdef SQLITE_TEST
int pager_old_format = 0;
#else
# define pager_old_format 0
#endif
/*
@ -187,7 +189,7 @@ int pager_old_format = 0;
/*
** Enable reference count tracking here:
*/
#if SQLITE_TEST
#ifdef SQLITE_TEST
int pager_refinfo_enable = 0;
static void pager_refinfo(PgHdr *p){
static int cnt = 0;
@ -225,11 +227,9 @@ static int read32bits(Pager *pPager, OsFile *fd, u32 *pRes){
*/
static int write32bits(OsFile *fd, u32 val){
unsigned char ac[4];
#ifdef SQLITE_TEST
if( pager_old_format ){
return sqliteOsWrite(fd, &val, 4);
}
#endif
ac[0] = (val>>24) & 0xff;
ac[1] = (val>>16) & 0xff;
ac[2] = (val>>8) & 0xff;
@ -482,7 +482,11 @@ static int pager_ckpt_playback(Pager *pPager){
/* Copy original pages out of the checkpoint journal and back into the
** database file.
*/
pPager->journalFormat = SQLITE_NEW_JOURNAL_FORMAT;
if( pager_old_format ){
pPager->journalFormat = SQLITE_OLD_JOURNAL_FORMAT;
}else{
pPager->journalFormat = SQLITE_NEW_JOURNAL_FORMAT;
}
for(i=nRec-1; i>=0; i--){
rc = pager_playback_one_page(pPager, &pPager->cpfd);
if( rc!=SQLITE_OK ) goto end_ckpt_playback;
@ -1140,16 +1144,12 @@ int sqlitepager_begin(void *pData){
pPager->state = SQLITE_WRITELOCK;
sqlitepager_pagecount(pPager);
pPager->origDbSize = pPager->dbSize;
#ifdef SQLITE_TEST
if( pager_old_format ){
rc = sqliteOsWrite(&pPager->jfd, aOldJournalMagic,
sizeof(aOldJournalMagic));
}else{
rc = sqliteOsWrite(&pPager->jfd, aJournalMagic, sizeof(aJournalMagic));
}
#else
rc = sqliteOsWrite(&pPager->jfd, aJournalMagic, sizeof(aJournalMagic));
#endif
if( rc==SQLITE_OK ){
rc = write32bits(&pPager->jfd, pPager->dbSize);
}
@ -1532,7 +1532,7 @@ int sqlitepager_ckpt_rollback(Pager *pPager){
return rc;
}
#if SQLITE_TEST
#ifdef SQLITE_TEST
/*
** Print a listing of all referenced pages and their ref count.
*/