| Index: third_party/sqlite/src/src/test_journal.c
|
| diff --git a/third_party/sqlite/src/src/test_journal.c b/third_party/sqlite/src/src/test_journal.c
|
| index 9db8b3864f7fb61bcd65dbf9ee5fc7fc42060e9a..ca4c5c38844b96381a6b1d26cb1567eb7b7b9e55 100644
|
| --- a/third_party/sqlite/src/src/test_journal.c
|
| +++ b/third_party/sqlite/src/src/test_journal.c
|
| @@ -14,8 +14,6 @@
|
| ** an existing VFS. The code in this file attempts to verify that SQLite
|
| ** correctly populates and syncs a journal file before writing to a
|
| ** corresponding database file.
|
| -**
|
| -** $Id: test_journal.c,v 1.17 2009/06/26 10:39:36 danielk1977 Exp $
|
| */
|
| #if SQLITE_TEST /* This file is used for testing only */
|
|
|
| @@ -163,9 +161,10 @@ static void jtDlClose(sqlite3_vfs*, void*);
|
| static int jtRandomness(sqlite3_vfs*, int nByte, char *zOut);
|
| static int jtSleep(sqlite3_vfs*, int microseconds);
|
| static int jtCurrentTime(sqlite3_vfs*, double*);
|
| +static int jtCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
|
|
|
| static sqlite3_vfs jt_vfs = {
|
| - 1, /* iVersion */
|
| + 2, /* iVersion */
|
| sizeof(jt_file), /* szOsFile */
|
| JT_MAX_PATHNAME, /* mxPathname */
|
| 0, /* pNext */
|
| @@ -181,7 +180,9 @@ static sqlite3_vfs jt_vfs = {
|
| jtDlClose, /* xDlClose */
|
| jtRandomness, /* xRandomness */
|
| jtSleep, /* xSleep */
|
| - jtCurrentTime /* xCurrentTime */
|
| + jtCurrentTime, /* xCurrentTime */
|
| + 0, /* xGetLastError */
|
| + jtCurrentTimeInt64 /* xCurrentTimeInt64 */
|
| };
|
|
|
| static sqlite3_io_methods jt_io_methods = {
|
| @@ -360,6 +361,7 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){
|
| sqlite3_file *p = pMain->pReal;
|
| int rc = SQLITE_OK;
|
|
|
| + closeTransaction(pMain);
|
| aData = sqlite3_malloc(pMain->nPagesize);
|
| pMain->pWritable = sqlite3BitvecCreate(pMain->nPage);
|
| pMain->aCksum = sqlite3_malloc(sizeof(u32) * (pMain->nPage + 1));
|
| @@ -378,6 +380,15 @@ static int openTransaction(jt_file *pMain, jt_file *pJournal){
|
| ** leaf to the jt_file.pWritable bitvec.
|
| */
|
| rc = sqlite3OsRead(p, aData, pMain->nPagesize, 0);
|
| + if( rc==SQLITE_OK ){
|
| + u32 nDbsize = decodeUint32(&aData[28]);
|
| + if( nDbsize>0 && memcmp(&aData[24], &aData[92], 4)==0 ){
|
| + u32 iPg;
|
| + for(iPg=nDbsize+1; iPg<=pMain->nPage; iPg++){
|
| + sqlite3BitvecSet(pMain->pWritable, iPg);
|
| + }
|
| + }
|
| + }
|
| iTrunk = decodeUint32(&aData[32]);
|
| while( rc==SQLITE_OK && iTrunk>0 ){
|
| u32 nLeaf;
|
| @@ -491,7 +502,6 @@ finish_rjf:
|
| return rc;
|
| }
|
|
|
| -
|
| /*
|
| ** Write data to an jt-file.
|
| */
|
| @@ -803,7 +813,13 @@ static int jtSleep(sqlite3_vfs *pVfs, int nMicro){
|
| ** Return the current time as a Julian Day number in *pTimeOut.
|
| */
|
| static int jtCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
|
| - return sqlite3OsCurrentTime(g.pVfs, pTimeOut);
|
| + return g.pVfs->xCurrentTime(g.pVfs, pTimeOut);
|
| +}
|
| +/*
|
| +** Return the current time as a Julian Day number in *pTimeOut.
|
| +*/
|
| +static int jtCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
|
| + return g.pVfs->xCurrentTimeInt64(g.pVfs, pTimeOut);
|
| }
|
|
|
| /**************************************************************************
|
| @@ -823,6 +839,11 @@ int jt_register(char *zWrap, int isDefault){
|
| return SQLITE_ERROR;
|
| }
|
| jt_vfs.szOsFile = sizeof(jt_file) + g.pVfs->szOsFile;
|
| + if( g.pVfs->iVersion==1 ){
|
| + jt_vfs.iVersion = 1;
|
| + }else if( g.pVfs->xCurrentTimeInt64==0 ){
|
| + jt_vfs.xCurrentTimeInt64 = 0;
|
| + }
|
| sqlite3_vfs_register(&jt_vfs, isDefault);
|
| return SQLITE_OK;
|
| }
|
|
|