Fossil SCM
Update the built-in fossil to the latest development version.
Commit
1e6ded985600c8aba675b9de560cb5defc24052e
Parent
932825bc6a2510a…
2 files changed
+90
-68
+1
-1
+90
-68
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -643,11 +643,11 @@ | ||
| 643 | 643 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 644 | 644 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 645 | 645 | */ |
| 646 | 646 | #define SQLITE_VERSION "3.7.0" |
| 647 | 647 | #define SQLITE_VERSION_NUMBER 3007000 |
| 648 | -#define SQLITE_SOURCE_ID "2010-07-07 14:45:41 8eefc287265443ec043bdab629597e79c9d22006" | |
| 648 | +#define SQLITE_SOURCE_ID "2010-07-08 17:40:38 e396184cd3bdb96e29ac33af5d1f631cac553341" | |
| 649 | 649 | |
| 650 | 650 | /* |
| 651 | 651 | ** CAPI3REF: Run-Time Library Version Numbers |
| 652 | 652 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 653 | 653 | ** |
| @@ -8572,11 +8572,10 @@ | ||
| 8572 | 8572 | int errMask; /* & result codes with this before returning */ |
| 8573 | 8573 | u8 autoCommit; /* The auto-commit flag. */ |
| 8574 | 8574 | u8 temp_store; /* 1: file 2: memory 0: default */ |
| 8575 | 8575 | u8 mallocFailed; /* True if we have seen a malloc failure */ |
| 8576 | 8576 | u8 dfltLockMode; /* Default locking-mode for attached dbs */ |
| 8577 | - u8 dfltJournalMode; /* Default journal mode for attached dbs */ | |
| 8578 | 8577 | signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ |
| 8579 | 8578 | u8 suppressErr; /* Do not issue error messages if true */ |
| 8580 | 8579 | int nextPagesize; /* Pagesize after VACUUM if >0 */ |
| 8581 | 8580 | int nTable; /* Number of tables in the database */ |
| 8582 | 8581 | CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ |
| @@ -29420,10 +29419,11 @@ | ||
| 29420 | 29419 | assert( id!=0 ); |
| 29421 | 29420 | assert( pFile->pShm==0 ); |
| 29422 | 29421 | OSTRACE(("CLOSE %d\n", pFile->h)); |
| 29423 | 29422 | do{ |
| 29424 | 29423 | rc = CloseHandle(pFile->h); |
| 29424 | + /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */ | |
| 29425 | 29425 | }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (Sleep(100), 1) ); |
| 29426 | 29426 | #if SQLITE_OS_WINCE |
| 29427 | 29427 | #define WINCE_DELETION_ATTEMPTS 3 |
| 29428 | 29428 | winceDestroyLock(pFile); |
| 29429 | 29429 | if( pFile->zDeleteOnClose ){ |
| @@ -29577,31 +29577,44 @@ | ||
| 29577 | 29577 | |
| 29578 | 29578 | /* |
| 29579 | 29579 | ** Make sure all writes to a particular file are committed to disk. |
| 29580 | 29580 | */ |
| 29581 | 29581 | static int winSync(sqlite3_file *id, int flags){ |
| 29582 | -#ifndef SQLITE_NO_SYNC | |
| 29582 | +#if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || defined(SQLITE_DEBUG) | |
| 29583 | 29583 | winFile *pFile = (winFile*)id; |
| 29584 | - | |
| 29585 | - assert( id!=0 ); | |
| 29586 | - OSTRACE(("SYNC %d lock=%d\n", pFile->h, pFile->locktype)); | |
| 29587 | 29584 | #else |
| 29588 | 29585 | UNUSED_PARAMETER(id); |
| 29589 | 29586 | #endif |
| 29587 | + | |
| 29588 | + assert( pFile ); | |
| 29589 | + /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */ | |
| 29590 | + assert((flags&0x0F)==SQLITE_SYNC_NORMAL | |
| 29591 | + || (flags&0x0F)==SQLITE_SYNC_FULL | |
| 29592 | + ); | |
| 29593 | + | |
| 29594 | + OSTRACE(("SYNC %d lock=%d\n", pFile->h, pFile->locktype)); | |
| 29595 | + | |
| 29590 | 29596 | #ifndef SQLITE_TEST |
| 29591 | 29597 | UNUSED_PARAMETER(flags); |
| 29592 | 29598 | #else |
| 29593 | 29599 | if( flags & SQLITE_SYNC_FULL ){ |
| 29594 | 29600 | sqlite3_fullsync_count++; |
| 29595 | 29601 | } |
| 29596 | 29602 | sqlite3_sync_count++; |
| 29597 | 29603 | #endif |
| 29604 | + | |
| 29605 | + /* Unix cannot, but some systems may return SQLITE_FULL from here. This | |
| 29606 | + ** line is to test that doing so does not cause any problems. | |
| 29607 | + */ | |
| 29608 | + SimulateDiskfullError( return SQLITE_FULL ); | |
| 29609 | + SimulateIOError( return SQLITE_IOERR; ); | |
| 29610 | + | |
| 29598 | 29611 | /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a |
| 29599 | 29612 | ** no-op |
| 29600 | 29613 | */ |
| 29601 | 29614 | #ifdef SQLITE_NO_SYNC |
| 29602 | - return SQLITE_OK; | |
| 29615 | + return SQLITE_OK; | |
| 29603 | 29616 | #else |
| 29604 | 29617 | if( FlushFileBuffers(pFile->h) ){ |
| 29605 | 29618 | return SQLITE_OK; |
| 29606 | 29619 | }else{ |
| 29607 | 29620 | pFile->lastErrno = GetLastError(); |
| @@ -29840,10 +29853,12 @@ | ||
| 29840 | 29853 | */ |
| 29841 | 29854 | static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ |
| 29842 | 29855 | int rc; |
| 29843 | 29856 | winFile *pFile = (winFile*)id; |
| 29844 | 29857 | |
| 29858 | + SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); | |
| 29859 | + | |
| 29845 | 29860 | assert( id!=0 ); |
| 29846 | 29861 | if( pFile->locktype>=RESERVED_LOCK ){ |
| 29847 | 29862 | rc = 1; |
| 29848 | 29863 | OSTRACE(("TEST WR-LOCK %d %d (local)\n", pFile->h, rc)); |
| 29849 | 29864 | }else{ |
| @@ -29912,11 +29927,13 @@ | ||
| 29912 | 29927 | *(int*)pArg = (int)((winFile*)id)->lastErrno; |
| 29913 | 29928 | return SQLITE_OK; |
| 29914 | 29929 | } |
| 29915 | 29930 | case SQLITE_FCNTL_SIZE_HINT: { |
| 29916 | 29931 | sqlite3_int64 sz = *(sqlite3_int64*)pArg; |
| 29932 | + SimulateIOErrorBenign(1); | |
| 29917 | 29933 | winTruncate(id, sz); |
| 29934 | + SimulateIOErrorBenign(0); | |
| 29918 | 29935 | return SQLITE_OK; |
| 29919 | 29936 | } |
| 29920 | 29937 | } |
| 29921 | 29938 | return SQLITE_ERROR; |
| 29922 | 29939 | } |
| @@ -30123,14 +30140,20 @@ | ||
| 30123 | 30140 | if( p->mutex ) sqlite3_mutex_free(p->mutex); |
| 30124 | 30141 | for(i=0; i<p->nRegion; i++){ |
| 30125 | 30142 | UnmapViewOfFile(p->aRegion[i].pMap); |
| 30126 | 30143 | CloseHandle(p->aRegion[i].hMap); |
| 30127 | 30144 | } |
| 30128 | - if( p->hFile.h != INVALID_HANDLE_VALUE ) { | |
| 30145 | + if( p->hFile.h != INVALID_HANDLE_VALUE ){ | |
| 30146 | + SimulateIOErrorBenign(1); | |
| 30129 | 30147 | winClose((sqlite3_file *)&p->hFile); |
| 30148 | + SimulateIOErrorBenign(0); | |
| 30130 | 30149 | } |
| 30131 | - if( deleteFlag ) winDelete(pVfs, p->zFilename, 0); | |
| 30150 | + if( deleteFlag ){ | |
| 30151 | + SimulateIOErrorBenign(1); | |
| 30152 | + winDelete(pVfs, p->zFilename, 0); | |
| 30153 | + SimulateIOErrorBenign(0); | |
| 30154 | + } | |
| 30132 | 30155 | *pp = p->pNext; |
| 30133 | 30156 | sqlite3_free(p->aRegion); |
| 30134 | 30157 | sqlite3_free(p); |
| 30135 | 30158 | }else{ |
| 30136 | 30159 | pp = &p->pNext; |
| @@ -30528,10 +30551,17 @@ | ||
| 30528 | 30551 | "abcdefghijklmnopqrstuvwxyz" |
| 30529 | 30552 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 30530 | 30553 | "0123456789"; |
| 30531 | 30554 | size_t i, j; |
| 30532 | 30555 | char zTempPath[MAX_PATH+1]; |
| 30556 | + | |
| 30557 | + /* It's odd to simulate an io-error here, but really this is just | |
| 30558 | + ** using the io-error infrastructure to test that SQLite handles this | |
| 30559 | + ** function failing. | |
| 30560 | + */ | |
| 30561 | + SimulateIOError( return SQLITE_IOERR ); | |
| 30562 | + | |
| 30533 | 30563 | if( sqlite3_temp_directory ){ |
| 30534 | 30564 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory); |
| 30535 | 30565 | }else if( isNT() ){ |
| 30536 | 30566 | char *zMulti; |
| 30537 | 30567 | WCHAR zWidePath[MAX_PATH]; |
| @@ -30559,20 +30589,30 @@ | ||
| 30559 | 30589 | }else{ |
| 30560 | 30590 | return SQLITE_NOMEM; |
| 30561 | 30591 | } |
| 30562 | 30592 | #endif |
| 30563 | 30593 | } |
| 30594 | + | |
| 30595 | + /* Check that the output buffer is large enough for the temporary file | |
| 30596 | + ** name. If it is not, return SQLITE_ERROR. | |
| 30597 | + */ | |
| 30598 | + if( (sqlite3Strlen30(zTempPath) + sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX) + 17) >= nBuf ){ | |
| 30599 | + return SQLITE_ERROR; | |
| 30600 | + } | |
| 30601 | + | |
| 30564 | 30602 | for(i=sqlite3Strlen30(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){} |
| 30565 | 30603 | zTempPath[i] = 0; |
| 30566 | - sqlite3_snprintf(nBuf-30, zBuf, | |
| 30604 | + | |
| 30605 | + sqlite3_snprintf(nBuf-17, zBuf, | |
| 30567 | 30606 | "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath); |
| 30568 | 30607 | j = sqlite3Strlen30(zBuf); |
| 30569 | - sqlite3_randomness(20, &zBuf[j]); | |
| 30570 | - for(i=0; i<20; i++, j++){ | |
| 30608 | + sqlite3_randomness(15, &zBuf[j]); | |
| 30609 | + for(i=0; i<15; i++, j++){ | |
| 30571 | 30610 | zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; |
| 30572 | 30611 | } |
| 30573 | 30612 | zBuf[j] = 0; |
| 30613 | + | |
| 30574 | 30614 | OSTRACE(("TEMP FILENAME: %s\n", zBuf)); |
| 30575 | 30615 | return SQLITE_OK; |
| 30576 | 30616 | } |
| 30577 | 30617 | |
| 30578 | 30618 | /* |
| @@ -30812,17 +30852,19 @@ | ||
| 30812 | 30852 | int syncDir /* Not used on win32 */ |
| 30813 | 30853 | ){ |
| 30814 | 30854 | int cnt = 0; |
| 30815 | 30855 | DWORD rc; |
| 30816 | 30856 | DWORD error = 0; |
| 30817 | - void *zConverted = convertUtf8Filename(zFilename); | |
| 30857 | + void *zConverted; | |
| 30818 | 30858 | UNUSED_PARAMETER(pVfs); |
| 30819 | 30859 | UNUSED_PARAMETER(syncDir); |
| 30860 | + | |
| 30861 | + SimulateIOError(return SQLITE_IOERR_DELETE); | |
| 30862 | + zConverted = convertUtf8Filename(zFilename); | |
| 30820 | 30863 | if( zConverted==0 ){ |
| 30821 | 30864 | return SQLITE_NOMEM; |
| 30822 | 30865 | } |
| 30823 | - SimulateIOError(return SQLITE_IOERR_DELETE); | |
| 30824 | 30866 | if( isNT() ){ |
| 30825 | 30867 | do{ |
| 30826 | 30868 | DeleteFileW(zConverted); |
| 30827 | 30869 | }while( ( ((rc = GetFileAttributesW(zConverted)) != INVALID_FILE_ATTRIBUTES) |
| 30828 | 30870 | || ((error = GetLastError()) == ERROR_ACCESS_DENIED)) |
| @@ -30931,16 +30973,18 @@ | ||
| 30931 | 30973 | int nFull, /* Size of output buffer in bytes */ |
| 30932 | 30974 | char *zFull /* Output buffer */ |
| 30933 | 30975 | ){ |
| 30934 | 30976 | |
| 30935 | 30977 | #if defined(__CYGWIN__) |
| 30978 | + SimulateIOError( return SQLITE_ERROR ); | |
| 30936 | 30979 | UNUSED_PARAMETER(nFull); |
| 30937 | 30980 | cygwin_conv_to_full_win32_path(zRelative, zFull); |
| 30938 | 30981 | return SQLITE_OK; |
| 30939 | 30982 | #endif |
| 30940 | 30983 | |
| 30941 | 30984 | #if SQLITE_OS_WINCE |
| 30985 | + SimulateIOError( return SQLITE_ERROR ); | |
| 30942 | 30986 | UNUSED_PARAMETER(nFull); |
| 30943 | 30987 | /* WinCE has no concept of a relative pathname, or so I am told. */ |
| 30944 | 30988 | sqlite3_snprintf(pVfs->mxPathname, zFull, "%s", zRelative); |
| 30945 | 30989 | return SQLITE_OK; |
| 30946 | 30990 | #endif |
| @@ -30947,10 +30991,17 @@ | ||
| 30947 | 30991 | |
| 30948 | 30992 | #if !SQLITE_OS_WINCE && !defined(__CYGWIN__) |
| 30949 | 30993 | int nByte; |
| 30950 | 30994 | void *zConverted; |
| 30951 | 30995 | char *zOut; |
| 30996 | + | |
| 30997 | + /* It's odd to simulate an io-error here, but really this is just | |
| 30998 | + ** using the io-error infrastructure to test that SQLite handles this | |
| 30999 | + ** function failing. This function could fail if, for example, the | |
| 31000 | + ** current working directory has been unlinked. | |
| 31001 | + */ | |
| 31002 | + SimulateIOError( return SQLITE_ERROR ); | |
| 30952 | 31003 | UNUSED_PARAMETER(nFull); |
| 30953 | 31004 | zConverted = convertUtf8Filename(zRelative); |
| 30954 | 31005 | if( isNT() ){ |
| 30955 | 31006 | WCHAR *zTemp; |
| 30956 | 31007 | nByte = GetFullPathNameW((WCHAR*)zConverted, 0, 0, 0) + 3; |
| @@ -31014,11 +31065,13 @@ | ||
| 31014 | 31065 | /* |
| 31015 | 31066 | ** We need to get the full path name of the file |
| 31016 | 31067 | ** to get the drive letter to look up the sector |
| 31017 | 31068 | ** size. |
| 31018 | 31069 | */ |
| 31070 | + SimulateIOErrorBenign(1); | |
| 31019 | 31071 | rc = winFullPathname(pVfs, zRelative, MAX_PATH, zFullpath); |
| 31072 | + SimulateIOErrorBenign(0); | |
| 31020 | 31073 | if( rc == SQLITE_OK ) |
| 31021 | 31074 | { |
| 31022 | 31075 | void *zConverted = convertUtf8Filename(zFullpath); |
| 31023 | 31076 | if( zConverted ){ |
| 31024 | 31077 | if( isNT() ){ |
| @@ -36166,10 +36219,11 @@ | ||
| 36166 | 36219 | |
| 36167 | 36220 | /* Set the database size back to the value it was before the savepoint |
| 36168 | 36221 | ** being reverted was opened. |
| 36169 | 36222 | */ |
| 36170 | 36223 | pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize; |
| 36224 | + pPager->changeCountDone = pPager->tempFile; | |
| 36171 | 36225 | |
| 36172 | 36226 | if( !pSavepoint && pagerUseWal(pPager) ){ |
| 36173 | 36227 | return pagerRollbackWal(pPager); |
| 36174 | 36228 | } |
| 36175 | 36229 | |
| @@ -36983,11 +37037,12 @@ | ||
| 36983 | 37037 | } |
| 36984 | 37038 | |
| 36985 | 37039 | /* Before the first write, give the VFS a hint of what the final |
| 36986 | 37040 | ** file size will be. |
| 36987 | 37041 | */ |
| 36988 | - if( pPager->dbSize > (pPager->dbOrigSize+1) && isOpen(pPager->fd) ){ | |
| 37042 | + assert( rc!=SQLITE_OK || isOpen(pPager->fd) ); | |
| 37043 | + if( rc==SQLITE_OK && pPager->dbSize>(pPager->dbOrigSize+1) ){ | |
| 36989 | 37044 | sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize; |
| 36990 | 37045 | sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile); |
| 36991 | 37046 | } |
| 36992 | 37047 | |
| 36993 | 37048 | while( rc==SQLITE_OK && pList ){ |
| @@ -40983,11 +41038,10 @@ | ||
| 40983 | 41038 | |
| 40984 | 41039 | pRet->pVfs = pVfs; |
| 40985 | 41040 | pRet->pWalFd = (sqlite3_file *)&pRet[1]; |
| 40986 | 41041 | pRet->pDbFd = pDbFd; |
| 40987 | 41042 | pRet->readLock = -1; |
| 40988 | - sqlite3_randomness(8, &pRet->hdr.aSalt); | |
| 40989 | 41043 | pRet->zWalName = zWalName; |
| 40990 | 41044 | rc = sqlite3OsShmOpen(pDbFd); |
| 40991 | 41045 | |
| 40992 | 41046 | /* Open file handle on the write-ahead log file. */ |
| 40993 | 41047 | if( rc==SQLITE_OK ){ |
| @@ -42156,10 +42210,11 @@ | ||
| 42156 | 42210 | |
| 42157 | 42211 | sqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN)); |
| 42158 | 42212 | sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION); |
| 42159 | 42213 | sqlite3Put4byte(&aWalHdr[8], szPage); |
| 42160 | 42214 | sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt); |
| 42215 | + sqlite3_randomness(8, pWal->hdr.aSalt); | |
| 42161 | 42216 | memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8); |
| 42162 | 42217 | walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum); |
| 42163 | 42218 | sqlite3Put4byte(&aWalHdr[24], aCksum[0]); |
| 42164 | 42219 | sqlite3Put4byte(&aWalHdr[28], aCksum[1]); |
| 42165 | 42220 | |
| @@ -63531,15 +63586,10 @@ | ||
| 63531 | 63586 | ** operation. No IO is required. |
| 63532 | 63587 | ** |
| 63533 | 63588 | ** If changing into or out of WAL mode the procedure is more complicated. |
| 63534 | 63589 | ** |
| 63535 | 63590 | ** Write a string containing the final journal-mode to register P2. |
| 63536 | -** | |
| 63537 | -** If an attempt to change in to or out of WAL mode fails because another | |
| 63538 | -** connection also has the same database open, then an SQLITE_BUSY error | |
| 63539 | -** is raised if P5==0, or of P5!=0 the journal mode changed is skipped | |
| 63540 | -** without signaling the error. | |
| 63541 | 63591 | */ |
| 63542 | 63592 | case OP_JournalMode: { /* out2-prerelease */ |
| 63543 | 63593 | #if 0 /* local variables moved into u.cd */ |
| 63544 | 63594 | Btree *pBt; /* Btree to change journal mode of */ |
| 63545 | 63595 | Pager *pPager; /* Pager associated with pBt */ |
| @@ -63635,11 +63685,10 @@ | ||
| 63635 | 63685 | } |
| 63636 | 63686 | } |
| 63637 | 63687 | #endif /* ifndef SQLITE_OMIT_WAL */ |
| 63638 | 63688 | |
| 63639 | 63689 | if( rc ){ |
| 63640 | - if( rc==SQLITE_BUSY && pOp->p5!=0 ) rc = SQLITE_OK; | |
| 63641 | 63690 | u.cd.eNew = u.cd.eOld; |
| 63642 | 63691 | } |
| 63643 | 63692 | u.cd.eNew = sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63644 | 63693 | |
| 63645 | 63694 | pOut = &aMem[pOp->p2]; |
| @@ -71860,12 +71909,10 @@ | ||
| 71860 | 71909 | "attached databases must use the same text encoding as main database"); |
| 71861 | 71910 | rc = SQLITE_ERROR; |
| 71862 | 71911 | } |
| 71863 | 71912 | pPager = sqlite3BtreePager(aNew->pBt); |
| 71864 | 71913 | sqlite3PagerLockingMode(pPager, db->dfltLockMode); |
| 71865 | - /* journal_mode set by the OP_JournalMode opcode that will following | |
| 71866 | - ** the OP_Function opcode that invoked this function. */ | |
| 71867 | 71914 | sqlite3BtreeSecureDelete(aNew->pBt, |
| 71868 | 71915 | sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); |
| 71869 | 71916 | } |
| 71870 | 71917 | aNew->safety_level = 3; |
| 71871 | 71918 | aNew->zName = sqlite3DbStrDup(db, zName); |
| @@ -72057,21 +72104,10 @@ | ||
| 72057 | 72104 | sqlite3VdbeAddOp3(v, OP_Function, 0, regArgs+3-pFunc->nArg, regArgs+3); |
| 72058 | 72105 | assert( pFunc->nArg==-1 || (pFunc->nArg&0xff)==pFunc->nArg ); |
| 72059 | 72106 | sqlite3VdbeChangeP5(v, (u8)(pFunc->nArg)); |
| 72060 | 72107 | sqlite3VdbeChangeP4(v, -1, (char *)pFunc, P4_FUNCDEF); |
| 72061 | 72108 | |
| 72062 | - if( type==SQLITE_ATTACH ){ | |
| 72063 | - /* On an attach, also set the journal mode. Note that | |
| 72064 | - ** sqlite3VdbeUsesBtree() is not call here since the iDb index | |
| 72065 | - ** will be out of range prior to the new database being attached. | |
| 72066 | - ** The OP_JournalMode opcode will all sqlite3VdbeUsesBtree() for us. | |
| 72067 | - */ | |
| 72068 | - sqlite3VdbeAddOp3(v, OP_JournalMode, db->nDb, regArgs+3, | |
| 72069 | - db->dfltJournalMode); | |
| 72070 | - sqlite3VdbeChangeP5(v, 1); | |
| 72071 | - } | |
| 72072 | - | |
| 72073 | 72109 | /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this |
| 72074 | 72110 | ** statement only). For DETACH, set it to false (expire all existing |
| 72075 | 72111 | ** statements). |
| 72076 | 72112 | */ |
| 72077 | 72113 | sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH)); |
| @@ -75944,11 +75980,10 @@ | ||
| 75944 | 75980 | assert( db->aDb[1].pSchema ); |
| 75945 | 75981 | if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){ |
| 75946 | 75982 | db->mallocFailed = 1; |
| 75947 | 75983 | return 1; |
| 75948 | 75984 | } |
| 75949 | - sqlite3PagerSetJournalMode(sqlite3BtreePager(pBt), db->dfltJournalMode); | |
| 75950 | 75985 | } |
| 75951 | 75986 | return 0; |
| 75952 | 75987 | } |
| 75953 | 75988 | |
| 75954 | 75989 | /* |
| @@ -83613,62 +83648,49 @@ | ||
| 83613 | 83648 | ** PRAGMA [database.]journal_mode |
| 83614 | 83649 | ** PRAGMA [database.]journal_mode = |
| 83615 | 83650 | ** (delete|persist|off|truncate|memory|wal|off) |
| 83616 | 83651 | */ |
| 83617 | 83652 | if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){ |
| 83618 | - int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */ | |
| 83653 | + int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */ | |
| 83654 | + int ii; /* Loop counter */ | |
| 83619 | 83655 | |
| 83656 | + /* Force the schema to be loaded on all databases. This cases all | |
| 83657 | + ** database files to be opened and the journal_modes set. */ | |
| 83620 | 83658 | if( sqlite3ReadSchema(pParse) ){ |
| 83621 | 83659 | goto pragma_out; |
| 83622 | 83660 | } |
| 83623 | 83661 | |
| 83624 | 83662 | sqlite3VdbeSetNumCols(v, 1); |
| 83625 | 83663 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC); |
| 83626 | 83664 | |
| 83627 | 83665 | if( zRight==0 ){ |
| 83666 | + /* If there is no "=MODE" part of the pragma, do a query for the | |
| 83667 | + ** current mode */ | |
| 83628 | 83668 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83629 | 83669 | }else{ |
| 83630 | 83670 | const char *zMode; |
| 83631 | 83671 | int n = sqlite3Strlen30(zRight); |
| 83632 | 83672 | for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){ |
| 83633 | 83673 | if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; |
| 83634 | 83674 | } |
| 83635 | 83675 | if( !zMode ){ |
| 83676 | + /* If the "=MODE" part does not match any known journal mode, | |
| 83677 | + ** then do a query */ | |
| 83636 | 83678 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83637 | 83679 | } |
| 83638 | 83680 | } |
| 83639 | - if( pId2->n==0 && eMode==PAGER_JOURNALMODE_QUERY ){ | |
| 83640 | - /* Simple "PRAGMA journal_mode;" statement. This is a query for | |
| 83641 | - ** the current default journal mode (which may be different to | |
| 83642 | - ** the journal-mode of the main database). | |
| 83643 | - */ | |
| 83644 | - eMode = db->dfltJournalMode; | |
| 83645 | - sqlite3VdbeAddOp2(v, OP_String8, 0, 1); | |
| 83646 | - sqlite3VdbeChangeP4(v, -1, sqlite3JournalModename(eMode), P4_STATIC); | |
| 83647 | - }else{ | |
| 83648 | - int ii; | |
| 83649 | - | |
| 83650 | - if( pId2->n==0 ){ | |
| 83651 | - /* When there is no database name before the "journal_mode" keyword | |
| 83652 | - ** in the PRAGMA, then the journal-mode will be set on | |
| 83653 | - ** all attached databases, as well as the main db file. | |
| 83654 | - ** | |
| 83655 | - ** Also, the sqlite3.dfltJournalMode variable is set so that | |
| 83656 | - ** any subsequently attached databases also use the specified | |
| 83657 | - ** journal mode. | |
| 83658 | - */ | |
| 83659 | - db->dfltJournalMode = (u8)eMode; | |
| 83660 | - } | |
| 83661 | - | |
| 83662 | - for(ii=db->nDb-1; ii>=0; ii--){ | |
| 83663 | - if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){ | |
| 83664 | - sqlite3VdbeUsesBtree(v, ii); | |
| 83665 | - sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode); | |
| 83666 | - } | |
| 83667 | - } | |
| 83668 | - } | |
| 83669 | - | |
| 83681 | + if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){ | |
| 83682 | + /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */ | |
| 83683 | + iDb = 0; | |
| 83684 | + pId2->n = 1; | |
| 83685 | + } | |
| 83686 | + for(ii=db->nDb-1; ii>=0; ii--){ | |
| 83687 | + if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){ | |
| 83688 | + sqlite3VdbeUsesBtree(v, ii); | |
| 83689 | + sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode); | |
| 83690 | + } | |
| 83691 | + } | |
| 83670 | 83692 | sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); |
| 83671 | 83693 | }else |
| 83672 | 83694 | |
| 83673 | 83695 | /* |
| 83674 | 83696 | ** PRAGMA [database.]journal_size_limit |
| 83675 | 83697 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -643,11 +643,11 @@ | |
| 643 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 644 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 645 | */ |
| 646 | #define SQLITE_VERSION "3.7.0" |
| 647 | #define SQLITE_VERSION_NUMBER 3007000 |
| 648 | #define SQLITE_SOURCE_ID "2010-07-07 14:45:41 8eefc287265443ec043bdab629597e79c9d22006" |
| 649 | |
| 650 | /* |
| 651 | ** CAPI3REF: Run-Time Library Version Numbers |
| 652 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 653 | ** |
| @@ -8572,11 +8572,10 @@ | |
| 8572 | int errMask; /* & result codes with this before returning */ |
| 8573 | u8 autoCommit; /* The auto-commit flag. */ |
| 8574 | u8 temp_store; /* 1: file 2: memory 0: default */ |
| 8575 | u8 mallocFailed; /* True if we have seen a malloc failure */ |
| 8576 | u8 dfltLockMode; /* Default locking-mode for attached dbs */ |
| 8577 | u8 dfltJournalMode; /* Default journal mode for attached dbs */ |
| 8578 | signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ |
| 8579 | u8 suppressErr; /* Do not issue error messages if true */ |
| 8580 | int nextPagesize; /* Pagesize after VACUUM if >0 */ |
| 8581 | int nTable; /* Number of tables in the database */ |
| 8582 | CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ |
| @@ -29420,10 +29419,11 @@ | |
| 29420 | assert( id!=0 ); |
| 29421 | assert( pFile->pShm==0 ); |
| 29422 | OSTRACE(("CLOSE %d\n", pFile->h)); |
| 29423 | do{ |
| 29424 | rc = CloseHandle(pFile->h); |
| 29425 | }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (Sleep(100), 1) ); |
| 29426 | #if SQLITE_OS_WINCE |
| 29427 | #define WINCE_DELETION_ATTEMPTS 3 |
| 29428 | winceDestroyLock(pFile); |
| 29429 | if( pFile->zDeleteOnClose ){ |
| @@ -29577,31 +29577,44 @@ | |
| 29577 | |
| 29578 | /* |
| 29579 | ** Make sure all writes to a particular file are committed to disk. |
| 29580 | */ |
| 29581 | static int winSync(sqlite3_file *id, int flags){ |
| 29582 | #ifndef SQLITE_NO_SYNC |
| 29583 | winFile *pFile = (winFile*)id; |
| 29584 | |
| 29585 | assert( id!=0 ); |
| 29586 | OSTRACE(("SYNC %d lock=%d\n", pFile->h, pFile->locktype)); |
| 29587 | #else |
| 29588 | UNUSED_PARAMETER(id); |
| 29589 | #endif |
| 29590 | #ifndef SQLITE_TEST |
| 29591 | UNUSED_PARAMETER(flags); |
| 29592 | #else |
| 29593 | if( flags & SQLITE_SYNC_FULL ){ |
| 29594 | sqlite3_fullsync_count++; |
| 29595 | } |
| 29596 | sqlite3_sync_count++; |
| 29597 | #endif |
| 29598 | /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a |
| 29599 | ** no-op |
| 29600 | */ |
| 29601 | #ifdef SQLITE_NO_SYNC |
| 29602 | return SQLITE_OK; |
| 29603 | #else |
| 29604 | if( FlushFileBuffers(pFile->h) ){ |
| 29605 | return SQLITE_OK; |
| 29606 | }else{ |
| 29607 | pFile->lastErrno = GetLastError(); |
| @@ -29840,10 +29853,12 @@ | |
| 29840 | */ |
| 29841 | static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ |
| 29842 | int rc; |
| 29843 | winFile *pFile = (winFile*)id; |
| 29844 | |
| 29845 | assert( id!=0 ); |
| 29846 | if( pFile->locktype>=RESERVED_LOCK ){ |
| 29847 | rc = 1; |
| 29848 | OSTRACE(("TEST WR-LOCK %d %d (local)\n", pFile->h, rc)); |
| 29849 | }else{ |
| @@ -29912,11 +29927,13 @@ | |
| 29912 | *(int*)pArg = (int)((winFile*)id)->lastErrno; |
| 29913 | return SQLITE_OK; |
| 29914 | } |
| 29915 | case SQLITE_FCNTL_SIZE_HINT: { |
| 29916 | sqlite3_int64 sz = *(sqlite3_int64*)pArg; |
| 29917 | winTruncate(id, sz); |
| 29918 | return SQLITE_OK; |
| 29919 | } |
| 29920 | } |
| 29921 | return SQLITE_ERROR; |
| 29922 | } |
| @@ -30123,14 +30140,20 @@ | |
| 30123 | if( p->mutex ) sqlite3_mutex_free(p->mutex); |
| 30124 | for(i=0; i<p->nRegion; i++){ |
| 30125 | UnmapViewOfFile(p->aRegion[i].pMap); |
| 30126 | CloseHandle(p->aRegion[i].hMap); |
| 30127 | } |
| 30128 | if( p->hFile.h != INVALID_HANDLE_VALUE ) { |
| 30129 | winClose((sqlite3_file *)&p->hFile); |
| 30130 | } |
| 30131 | if( deleteFlag ) winDelete(pVfs, p->zFilename, 0); |
| 30132 | *pp = p->pNext; |
| 30133 | sqlite3_free(p->aRegion); |
| 30134 | sqlite3_free(p); |
| 30135 | }else{ |
| 30136 | pp = &p->pNext; |
| @@ -30528,10 +30551,17 @@ | |
| 30528 | "abcdefghijklmnopqrstuvwxyz" |
| 30529 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 30530 | "0123456789"; |
| 30531 | size_t i, j; |
| 30532 | char zTempPath[MAX_PATH+1]; |
| 30533 | if( sqlite3_temp_directory ){ |
| 30534 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory); |
| 30535 | }else if( isNT() ){ |
| 30536 | char *zMulti; |
| 30537 | WCHAR zWidePath[MAX_PATH]; |
| @@ -30559,20 +30589,30 @@ | |
| 30559 | }else{ |
| 30560 | return SQLITE_NOMEM; |
| 30561 | } |
| 30562 | #endif |
| 30563 | } |
| 30564 | for(i=sqlite3Strlen30(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){} |
| 30565 | zTempPath[i] = 0; |
| 30566 | sqlite3_snprintf(nBuf-30, zBuf, |
| 30567 | "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath); |
| 30568 | j = sqlite3Strlen30(zBuf); |
| 30569 | sqlite3_randomness(20, &zBuf[j]); |
| 30570 | for(i=0; i<20; i++, j++){ |
| 30571 | zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; |
| 30572 | } |
| 30573 | zBuf[j] = 0; |
| 30574 | OSTRACE(("TEMP FILENAME: %s\n", zBuf)); |
| 30575 | return SQLITE_OK; |
| 30576 | } |
| 30577 | |
| 30578 | /* |
| @@ -30812,17 +30852,19 @@ | |
| 30812 | int syncDir /* Not used on win32 */ |
| 30813 | ){ |
| 30814 | int cnt = 0; |
| 30815 | DWORD rc; |
| 30816 | DWORD error = 0; |
| 30817 | void *zConverted = convertUtf8Filename(zFilename); |
| 30818 | UNUSED_PARAMETER(pVfs); |
| 30819 | UNUSED_PARAMETER(syncDir); |
| 30820 | if( zConverted==0 ){ |
| 30821 | return SQLITE_NOMEM; |
| 30822 | } |
| 30823 | SimulateIOError(return SQLITE_IOERR_DELETE); |
| 30824 | if( isNT() ){ |
| 30825 | do{ |
| 30826 | DeleteFileW(zConverted); |
| 30827 | }while( ( ((rc = GetFileAttributesW(zConverted)) != INVALID_FILE_ATTRIBUTES) |
| 30828 | || ((error = GetLastError()) == ERROR_ACCESS_DENIED)) |
| @@ -30931,16 +30973,18 @@ | |
| 30931 | int nFull, /* Size of output buffer in bytes */ |
| 30932 | char *zFull /* Output buffer */ |
| 30933 | ){ |
| 30934 | |
| 30935 | #if defined(__CYGWIN__) |
| 30936 | UNUSED_PARAMETER(nFull); |
| 30937 | cygwin_conv_to_full_win32_path(zRelative, zFull); |
| 30938 | return SQLITE_OK; |
| 30939 | #endif |
| 30940 | |
| 30941 | #if SQLITE_OS_WINCE |
| 30942 | UNUSED_PARAMETER(nFull); |
| 30943 | /* WinCE has no concept of a relative pathname, or so I am told. */ |
| 30944 | sqlite3_snprintf(pVfs->mxPathname, zFull, "%s", zRelative); |
| 30945 | return SQLITE_OK; |
| 30946 | #endif |
| @@ -30947,10 +30991,17 @@ | |
| 30947 | |
| 30948 | #if !SQLITE_OS_WINCE && !defined(__CYGWIN__) |
| 30949 | int nByte; |
| 30950 | void *zConverted; |
| 30951 | char *zOut; |
| 30952 | UNUSED_PARAMETER(nFull); |
| 30953 | zConverted = convertUtf8Filename(zRelative); |
| 30954 | if( isNT() ){ |
| 30955 | WCHAR *zTemp; |
| 30956 | nByte = GetFullPathNameW((WCHAR*)zConverted, 0, 0, 0) + 3; |
| @@ -31014,11 +31065,13 @@ | |
| 31014 | /* |
| 31015 | ** We need to get the full path name of the file |
| 31016 | ** to get the drive letter to look up the sector |
| 31017 | ** size. |
| 31018 | */ |
| 31019 | rc = winFullPathname(pVfs, zRelative, MAX_PATH, zFullpath); |
| 31020 | if( rc == SQLITE_OK ) |
| 31021 | { |
| 31022 | void *zConverted = convertUtf8Filename(zFullpath); |
| 31023 | if( zConverted ){ |
| 31024 | if( isNT() ){ |
| @@ -36166,10 +36219,11 @@ | |
| 36166 | |
| 36167 | /* Set the database size back to the value it was before the savepoint |
| 36168 | ** being reverted was opened. |
| 36169 | */ |
| 36170 | pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize; |
| 36171 | |
| 36172 | if( !pSavepoint && pagerUseWal(pPager) ){ |
| 36173 | return pagerRollbackWal(pPager); |
| 36174 | } |
| 36175 | |
| @@ -36983,11 +37037,12 @@ | |
| 36983 | } |
| 36984 | |
| 36985 | /* Before the first write, give the VFS a hint of what the final |
| 36986 | ** file size will be. |
| 36987 | */ |
| 36988 | if( pPager->dbSize > (pPager->dbOrigSize+1) && isOpen(pPager->fd) ){ |
| 36989 | sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize; |
| 36990 | sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile); |
| 36991 | } |
| 36992 | |
| 36993 | while( rc==SQLITE_OK && pList ){ |
| @@ -40983,11 +41038,10 @@ | |
| 40983 | |
| 40984 | pRet->pVfs = pVfs; |
| 40985 | pRet->pWalFd = (sqlite3_file *)&pRet[1]; |
| 40986 | pRet->pDbFd = pDbFd; |
| 40987 | pRet->readLock = -1; |
| 40988 | sqlite3_randomness(8, &pRet->hdr.aSalt); |
| 40989 | pRet->zWalName = zWalName; |
| 40990 | rc = sqlite3OsShmOpen(pDbFd); |
| 40991 | |
| 40992 | /* Open file handle on the write-ahead log file. */ |
| 40993 | if( rc==SQLITE_OK ){ |
| @@ -42156,10 +42210,11 @@ | |
| 42156 | |
| 42157 | sqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN)); |
| 42158 | sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION); |
| 42159 | sqlite3Put4byte(&aWalHdr[8], szPage); |
| 42160 | sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt); |
| 42161 | memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8); |
| 42162 | walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum); |
| 42163 | sqlite3Put4byte(&aWalHdr[24], aCksum[0]); |
| 42164 | sqlite3Put4byte(&aWalHdr[28], aCksum[1]); |
| 42165 | |
| @@ -63531,15 +63586,10 @@ | |
| 63531 | ** operation. No IO is required. |
| 63532 | ** |
| 63533 | ** If changing into or out of WAL mode the procedure is more complicated. |
| 63534 | ** |
| 63535 | ** Write a string containing the final journal-mode to register P2. |
| 63536 | ** |
| 63537 | ** If an attempt to change in to or out of WAL mode fails because another |
| 63538 | ** connection also has the same database open, then an SQLITE_BUSY error |
| 63539 | ** is raised if P5==0, or of P5!=0 the journal mode changed is skipped |
| 63540 | ** without signaling the error. |
| 63541 | */ |
| 63542 | case OP_JournalMode: { /* out2-prerelease */ |
| 63543 | #if 0 /* local variables moved into u.cd */ |
| 63544 | Btree *pBt; /* Btree to change journal mode of */ |
| 63545 | Pager *pPager; /* Pager associated with pBt */ |
| @@ -63635,11 +63685,10 @@ | |
| 63635 | } |
| 63636 | } |
| 63637 | #endif /* ifndef SQLITE_OMIT_WAL */ |
| 63638 | |
| 63639 | if( rc ){ |
| 63640 | if( rc==SQLITE_BUSY && pOp->p5!=0 ) rc = SQLITE_OK; |
| 63641 | u.cd.eNew = u.cd.eOld; |
| 63642 | } |
| 63643 | u.cd.eNew = sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63644 | |
| 63645 | pOut = &aMem[pOp->p2]; |
| @@ -71860,12 +71909,10 @@ | |
| 71860 | "attached databases must use the same text encoding as main database"); |
| 71861 | rc = SQLITE_ERROR; |
| 71862 | } |
| 71863 | pPager = sqlite3BtreePager(aNew->pBt); |
| 71864 | sqlite3PagerLockingMode(pPager, db->dfltLockMode); |
| 71865 | /* journal_mode set by the OP_JournalMode opcode that will following |
| 71866 | ** the OP_Function opcode that invoked this function. */ |
| 71867 | sqlite3BtreeSecureDelete(aNew->pBt, |
| 71868 | sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); |
| 71869 | } |
| 71870 | aNew->safety_level = 3; |
| 71871 | aNew->zName = sqlite3DbStrDup(db, zName); |
| @@ -72057,21 +72104,10 @@ | |
| 72057 | sqlite3VdbeAddOp3(v, OP_Function, 0, regArgs+3-pFunc->nArg, regArgs+3); |
| 72058 | assert( pFunc->nArg==-1 || (pFunc->nArg&0xff)==pFunc->nArg ); |
| 72059 | sqlite3VdbeChangeP5(v, (u8)(pFunc->nArg)); |
| 72060 | sqlite3VdbeChangeP4(v, -1, (char *)pFunc, P4_FUNCDEF); |
| 72061 | |
| 72062 | if( type==SQLITE_ATTACH ){ |
| 72063 | /* On an attach, also set the journal mode. Note that |
| 72064 | ** sqlite3VdbeUsesBtree() is not call here since the iDb index |
| 72065 | ** will be out of range prior to the new database being attached. |
| 72066 | ** The OP_JournalMode opcode will all sqlite3VdbeUsesBtree() for us. |
| 72067 | */ |
| 72068 | sqlite3VdbeAddOp3(v, OP_JournalMode, db->nDb, regArgs+3, |
| 72069 | db->dfltJournalMode); |
| 72070 | sqlite3VdbeChangeP5(v, 1); |
| 72071 | } |
| 72072 | |
| 72073 | /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this |
| 72074 | ** statement only). For DETACH, set it to false (expire all existing |
| 72075 | ** statements). |
| 72076 | */ |
| 72077 | sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH)); |
| @@ -75944,11 +75980,10 @@ | |
| 75944 | assert( db->aDb[1].pSchema ); |
| 75945 | if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){ |
| 75946 | db->mallocFailed = 1; |
| 75947 | return 1; |
| 75948 | } |
| 75949 | sqlite3PagerSetJournalMode(sqlite3BtreePager(pBt), db->dfltJournalMode); |
| 75950 | } |
| 75951 | return 0; |
| 75952 | } |
| 75953 | |
| 75954 | /* |
| @@ -83613,62 +83648,49 @@ | |
| 83613 | ** PRAGMA [database.]journal_mode |
| 83614 | ** PRAGMA [database.]journal_mode = |
| 83615 | ** (delete|persist|off|truncate|memory|wal|off) |
| 83616 | */ |
| 83617 | if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){ |
| 83618 | int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */ |
| 83619 | |
| 83620 | if( sqlite3ReadSchema(pParse) ){ |
| 83621 | goto pragma_out; |
| 83622 | } |
| 83623 | |
| 83624 | sqlite3VdbeSetNumCols(v, 1); |
| 83625 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC); |
| 83626 | |
| 83627 | if( zRight==0 ){ |
| 83628 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83629 | }else{ |
| 83630 | const char *zMode; |
| 83631 | int n = sqlite3Strlen30(zRight); |
| 83632 | for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){ |
| 83633 | if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; |
| 83634 | } |
| 83635 | if( !zMode ){ |
| 83636 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83637 | } |
| 83638 | } |
| 83639 | if( pId2->n==0 && eMode==PAGER_JOURNALMODE_QUERY ){ |
| 83640 | /* Simple "PRAGMA journal_mode;" statement. This is a query for |
| 83641 | ** the current default journal mode (which may be different to |
| 83642 | ** the journal-mode of the main database). |
| 83643 | */ |
| 83644 | eMode = db->dfltJournalMode; |
| 83645 | sqlite3VdbeAddOp2(v, OP_String8, 0, 1); |
| 83646 | sqlite3VdbeChangeP4(v, -1, sqlite3JournalModename(eMode), P4_STATIC); |
| 83647 | }else{ |
| 83648 | int ii; |
| 83649 | |
| 83650 | if( pId2->n==0 ){ |
| 83651 | /* When there is no database name before the "journal_mode" keyword |
| 83652 | ** in the PRAGMA, then the journal-mode will be set on |
| 83653 | ** all attached databases, as well as the main db file. |
| 83654 | ** |
| 83655 | ** Also, the sqlite3.dfltJournalMode variable is set so that |
| 83656 | ** any subsequently attached databases also use the specified |
| 83657 | ** journal mode. |
| 83658 | */ |
| 83659 | db->dfltJournalMode = (u8)eMode; |
| 83660 | } |
| 83661 | |
| 83662 | for(ii=db->nDb-1; ii>=0; ii--){ |
| 83663 | if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){ |
| 83664 | sqlite3VdbeUsesBtree(v, ii); |
| 83665 | sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode); |
| 83666 | } |
| 83667 | } |
| 83668 | } |
| 83669 | |
| 83670 | sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); |
| 83671 | }else |
| 83672 | |
| 83673 | /* |
| 83674 | ** PRAGMA [database.]journal_size_limit |
| 83675 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -643,11 +643,11 @@ | |
| 643 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 644 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 645 | */ |
| 646 | #define SQLITE_VERSION "3.7.0" |
| 647 | #define SQLITE_VERSION_NUMBER 3007000 |
| 648 | #define SQLITE_SOURCE_ID "2010-07-08 17:40:38 e396184cd3bdb96e29ac33af5d1f631cac553341" |
| 649 | |
| 650 | /* |
| 651 | ** CAPI3REF: Run-Time Library Version Numbers |
| 652 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 653 | ** |
| @@ -8572,11 +8572,10 @@ | |
| 8572 | int errMask; /* & result codes with this before returning */ |
| 8573 | u8 autoCommit; /* The auto-commit flag. */ |
| 8574 | u8 temp_store; /* 1: file 2: memory 0: default */ |
| 8575 | u8 mallocFailed; /* True if we have seen a malloc failure */ |
| 8576 | u8 dfltLockMode; /* Default locking-mode for attached dbs */ |
| 8577 | signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ |
| 8578 | u8 suppressErr; /* Do not issue error messages if true */ |
| 8579 | int nextPagesize; /* Pagesize after VACUUM if >0 */ |
| 8580 | int nTable; /* Number of tables in the database */ |
| 8581 | CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ |
| @@ -29420,10 +29419,11 @@ | |
| 29419 | assert( id!=0 ); |
| 29420 | assert( pFile->pShm==0 ); |
| 29421 | OSTRACE(("CLOSE %d\n", pFile->h)); |
| 29422 | do{ |
| 29423 | rc = CloseHandle(pFile->h); |
| 29424 | /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */ |
| 29425 | }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (Sleep(100), 1) ); |
| 29426 | #if SQLITE_OS_WINCE |
| 29427 | #define WINCE_DELETION_ATTEMPTS 3 |
| 29428 | winceDestroyLock(pFile); |
| 29429 | if( pFile->zDeleteOnClose ){ |
| @@ -29577,31 +29577,44 @@ | |
| 29577 | |
| 29578 | /* |
| 29579 | ** Make sure all writes to a particular file are committed to disk. |
| 29580 | */ |
| 29581 | static int winSync(sqlite3_file *id, int flags){ |
| 29582 | #if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || defined(SQLITE_DEBUG) |
| 29583 | winFile *pFile = (winFile*)id; |
| 29584 | #else |
| 29585 | UNUSED_PARAMETER(id); |
| 29586 | #endif |
| 29587 | |
| 29588 | assert( pFile ); |
| 29589 | /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */ |
| 29590 | assert((flags&0x0F)==SQLITE_SYNC_NORMAL |
| 29591 | || (flags&0x0F)==SQLITE_SYNC_FULL |
| 29592 | ); |
| 29593 | |
| 29594 | OSTRACE(("SYNC %d lock=%d\n", pFile->h, pFile->locktype)); |
| 29595 | |
| 29596 | #ifndef SQLITE_TEST |
| 29597 | UNUSED_PARAMETER(flags); |
| 29598 | #else |
| 29599 | if( flags & SQLITE_SYNC_FULL ){ |
| 29600 | sqlite3_fullsync_count++; |
| 29601 | } |
| 29602 | sqlite3_sync_count++; |
| 29603 | #endif |
| 29604 | |
| 29605 | /* Unix cannot, but some systems may return SQLITE_FULL from here. This |
| 29606 | ** line is to test that doing so does not cause any problems. |
| 29607 | */ |
| 29608 | SimulateDiskfullError( return SQLITE_FULL ); |
| 29609 | SimulateIOError( return SQLITE_IOERR; ); |
| 29610 | |
| 29611 | /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a |
| 29612 | ** no-op |
| 29613 | */ |
| 29614 | #ifdef SQLITE_NO_SYNC |
| 29615 | return SQLITE_OK; |
| 29616 | #else |
| 29617 | if( FlushFileBuffers(pFile->h) ){ |
| 29618 | return SQLITE_OK; |
| 29619 | }else{ |
| 29620 | pFile->lastErrno = GetLastError(); |
| @@ -29840,10 +29853,12 @@ | |
| 29853 | */ |
| 29854 | static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ |
| 29855 | int rc; |
| 29856 | winFile *pFile = (winFile*)id; |
| 29857 | |
| 29858 | SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); |
| 29859 | |
| 29860 | assert( id!=0 ); |
| 29861 | if( pFile->locktype>=RESERVED_LOCK ){ |
| 29862 | rc = 1; |
| 29863 | OSTRACE(("TEST WR-LOCK %d %d (local)\n", pFile->h, rc)); |
| 29864 | }else{ |
| @@ -29912,11 +29927,13 @@ | |
| 29927 | *(int*)pArg = (int)((winFile*)id)->lastErrno; |
| 29928 | return SQLITE_OK; |
| 29929 | } |
| 29930 | case SQLITE_FCNTL_SIZE_HINT: { |
| 29931 | sqlite3_int64 sz = *(sqlite3_int64*)pArg; |
| 29932 | SimulateIOErrorBenign(1); |
| 29933 | winTruncate(id, sz); |
| 29934 | SimulateIOErrorBenign(0); |
| 29935 | return SQLITE_OK; |
| 29936 | } |
| 29937 | } |
| 29938 | return SQLITE_ERROR; |
| 29939 | } |
| @@ -30123,14 +30140,20 @@ | |
| 30140 | if( p->mutex ) sqlite3_mutex_free(p->mutex); |
| 30141 | for(i=0; i<p->nRegion; i++){ |
| 30142 | UnmapViewOfFile(p->aRegion[i].pMap); |
| 30143 | CloseHandle(p->aRegion[i].hMap); |
| 30144 | } |
| 30145 | if( p->hFile.h != INVALID_HANDLE_VALUE ){ |
| 30146 | SimulateIOErrorBenign(1); |
| 30147 | winClose((sqlite3_file *)&p->hFile); |
| 30148 | SimulateIOErrorBenign(0); |
| 30149 | } |
| 30150 | if( deleteFlag ){ |
| 30151 | SimulateIOErrorBenign(1); |
| 30152 | winDelete(pVfs, p->zFilename, 0); |
| 30153 | SimulateIOErrorBenign(0); |
| 30154 | } |
| 30155 | *pp = p->pNext; |
| 30156 | sqlite3_free(p->aRegion); |
| 30157 | sqlite3_free(p); |
| 30158 | }else{ |
| 30159 | pp = &p->pNext; |
| @@ -30528,10 +30551,17 @@ | |
| 30551 | "abcdefghijklmnopqrstuvwxyz" |
| 30552 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 30553 | "0123456789"; |
| 30554 | size_t i, j; |
| 30555 | char zTempPath[MAX_PATH+1]; |
| 30556 | |
| 30557 | /* It's odd to simulate an io-error here, but really this is just |
| 30558 | ** using the io-error infrastructure to test that SQLite handles this |
| 30559 | ** function failing. |
| 30560 | */ |
| 30561 | SimulateIOError( return SQLITE_IOERR ); |
| 30562 | |
| 30563 | if( sqlite3_temp_directory ){ |
| 30564 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory); |
| 30565 | }else if( isNT() ){ |
| 30566 | char *zMulti; |
| 30567 | WCHAR zWidePath[MAX_PATH]; |
| @@ -30559,20 +30589,30 @@ | |
| 30589 | }else{ |
| 30590 | return SQLITE_NOMEM; |
| 30591 | } |
| 30592 | #endif |
| 30593 | } |
| 30594 | |
| 30595 | /* Check that the output buffer is large enough for the temporary file |
| 30596 | ** name. If it is not, return SQLITE_ERROR. |
| 30597 | */ |
| 30598 | if( (sqlite3Strlen30(zTempPath) + sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX) + 17) >= nBuf ){ |
| 30599 | return SQLITE_ERROR; |
| 30600 | } |
| 30601 | |
| 30602 | for(i=sqlite3Strlen30(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){} |
| 30603 | zTempPath[i] = 0; |
| 30604 | |
| 30605 | sqlite3_snprintf(nBuf-17, zBuf, |
| 30606 | "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath); |
| 30607 | j = sqlite3Strlen30(zBuf); |
| 30608 | sqlite3_randomness(15, &zBuf[j]); |
| 30609 | for(i=0; i<15; i++, j++){ |
| 30610 | zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; |
| 30611 | } |
| 30612 | zBuf[j] = 0; |
| 30613 | |
| 30614 | OSTRACE(("TEMP FILENAME: %s\n", zBuf)); |
| 30615 | return SQLITE_OK; |
| 30616 | } |
| 30617 | |
| 30618 | /* |
| @@ -30812,17 +30852,19 @@ | |
| 30852 | int syncDir /* Not used on win32 */ |
| 30853 | ){ |
| 30854 | int cnt = 0; |
| 30855 | DWORD rc; |
| 30856 | DWORD error = 0; |
| 30857 | void *zConverted; |
| 30858 | UNUSED_PARAMETER(pVfs); |
| 30859 | UNUSED_PARAMETER(syncDir); |
| 30860 | |
| 30861 | SimulateIOError(return SQLITE_IOERR_DELETE); |
| 30862 | zConverted = convertUtf8Filename(zFilename); |
| 30863 | if( zConverted==0 ){ |
| 30864 | return SQLITE_NOMEM; |
| 30865 | } |
| 30866 | if( isNT() ){ |
| 30867 | do{ |
| 30868 | DeleteFileW(zConverted); |
| 30869 | }while( ( ((rc = GetFileAttributesW(zConverted)) != INVALID_FILE_ATTRIBUTES) |
| 30870 | || ((error = GetLastError()) == ERROR_ACCESS_DENIED)) |
| @@ -30931,16 +30973,18 @@ | |
| 30973 | int nFull, /* Size of output buffer in bytes */ |
| 30974 | char *zFull /* Output buffer */ |
| 30975 | ){ |
| 30976 | |
| 30977 | #if defined(__CYGWIN__) |
| 30978 | SimulateIOError( return SQLITE_ERROR ); |
| 30979 | UNUSED_PARAMETER(nFull); |
| 30980 | cygwin_conv_to_full_win32_path(zRelative, zFull); |
| 30981 | return SQLITE_OK; |
| 30982 | #endif |
| 30983 | |
| 30984 | #if SQLITE_OS_WINCE |
| 30985 | SimulateIOError( return SQLITE_ERROR ); |
| 30986 | UNUSED_PARAMETER(nFull); |
| 30987 | /* WinCE has no concept of a relative pathname, or so I am told. */ |
| 30988 | sqlite3_snprintf(pVfs->mxPathname, zFull, "%s", zRelative); |
| 30989 | return SQLITE_OK; |
| 30990 | #endif |
| @@ -30947,10 +30991,17 @@ | |
| 30991 | |
| 30992 | #if !SQLITE_OS_WINCE && !defined(__CYGWIN__) |
| 30993 | int nByte; |
| 30994 | void *zConverted; |
| 30995 | char *zOut; |
| 30996 | |
| 30997 | /* It's odd to simulate an io-error here, but really this is just |
| 30998 | ** using the io-error infrastructure to test that SQLite handles this |
| 30999 | ** function failing. This function could fail if, for example, the |
| 31000 | ** current working directory has been unlinked. |
| 31001 | */ |
| 31002 | SimulateIOError( return SQLITE_ERROR ); |
| 31003 | UNUSED_PARAMETER(nFull); |
| 31004 | zConverted = convertUtf8Filename(zRelative); |
| 31005 | if( isNT() ){ |
| 31006 | WCHAR *zTemp; |
| 31007 | nByte = GetFullPathNameW((WCHAR*)zConverted, 0, 0, 0) + 3; |
| @@ -31014,11 +31065,13 @@ | |
| 31065 | /* |
| 31066 | ** We need to get the full path name of the file |
| 31067 | ** to get the drive letter to look up the sector |
| 31068 | ** size. |
| 31069 | */ |
| 31070 | SimulateIOErrorBenign(1); |
| 31071 | rc = winFullPathname(pVfs, zRelative, MAX_PATH, zFullpath); |
| 31072 | SimulateIOErrorBenign(0); |
| 31073 | if( rc == SQLITE_OK ) |
| 31074 | { |
| 31075 | void *zConverted = convertUtf8Filename(zFullpath); |
| 31076 | if( zConverted ){ |
| 31077 | if( isNT() ){ |
| @@ -36166,10 +36219,11 @@ | |
| 36219 | |
| 36220 | /* Set the database size back to the value it was before the savepoint |
| 36221 | ** being reverted was opened. |
| 36222 | */ |
| 36223 | pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize; |
| 36224 | pPager->changeCountDone = pPager->tempFile; |
| 36225 | |
| 36226 | if( !pSavepoint && pagerUseWal(pPager) ){ |
| 36227 | return pagerRollbackWal(pPager); |
| 36228 | } |
| 36229 | |
| @@ -36983,11 +37037,12 @@ | |
| 37037 | } |
| 37038 | |
| 37039 | /* Before the first write, give the VFS a hint of what the final |
| 37040 | ** file size will be. |
| 37041 | */ |
| 37042 | assert( rc!=SQLITE_OK || isOpen(pPager->fd) ); |
| 37043 | if( rc==SQLITE_OK && pPager->dbSize>(pPager->dbOrigSize+1) ){ |
| 37044 | sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize; |
| 37045 | sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile); |
| 37046 | } |
| 37047 | |
| 37048 | while( rc==SQLITE_OK && pList ){ |
| @@ -40983,11 +41038,10 @@ | |
| 41038 | |
| 41039 | pRet->pVfs = pVfs; |
| 41040 | pRet->pWalFd = (sqlite3_file *)&pRet[1]; |
| 41041 | pRet->pDbFd = pDbFd; |
| 41042 | pRet->readLock = -1; |
| 41043 | pRet->zWalName = zWalName; |
| 41044 | rc = sqlite3OsShmOpen(pDbFd); |
| 41045 | |
| 41046 | /* Open file handle on the write-ahead log file. */ |
| 41047 | if( rc==SQLITE_OK ){ |
| @@ -42156,10 +42210,11 @@ | |
| 42210 | |
| 42211 | sqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN)); |
| 42212 | sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION); |
| 42213 | sqlite3Put4byte(&aWalHdr[8], szPage); |
| 42214 | sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt); |
| 42215 | sqlite3_randomness(8, pWal->hdr.aSalt); |
| 42216 | memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8); |
| 42217 | walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum); |
| 42218 | sqlite3Put4byte(&aWalHdr[24], aCksum[0]); |
| 42219 | sqlite3Put4byte(&aWalHdr[28], aCksum[1]); |
| 42220 | |
| @@ -63531,15 +63586,10 @@ | |
| 63586 | ** operation. No IO is required. |
| 63587 | ** |
| 63588 | ** If changing into or out of WAL mode the procedure is more complicated. |
| 63589 | ** |
| 63590 | ** Write a string containing the final journal-mode to register P2. |
| 63591 | */ |
| 63592 | case OP_JournalMode: { /* out2-prerelease */ |
| 63593 | #if 0 /* local variables moved into u.cd */ |
| 63594 | Btree *pBt; /* Btree to change journal mode of */ |
| 63595 | Pager *pPager; /* Pager associated with pBt */ |
| @@ -63635,11 +63685,10 @@ | |
| 63685 | } |
| 63686 | } |
| 63687 | #endif /* ifndef SQLITE_OMIT_WAL */ |
| 63688 | |
| 63689 | if( rc ){ |
| 63690 | u.cd.eNew = u.cd.eOld; |
| 63691 | } |
| 63692 | u.cd.eNew = sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63693 | |
| 63694 | pOut = &aMem[pOp->p2]; |
| @@ -71860,12 +71909,10 @@ | |
| 71909 | "attached databases must use the same text encoding as main database"); |
| 71910 | rc = SQLITE_ERROR; |
| 71911 | } |
| 71912 | pPager = sqlite3BtreePager(aNew->pBt); |
| 71913 | sqlite3PagerLockingMode(pPager, db->dfltLockMode); |
| 71914 | sqlite3BtreeSecureDelete(aNew->pBt, |
| 71915 | sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); |
| 71916 | } |
| 71917 | aNew->safety_level = 3; |
| 71918 | aNew->zName = sqlite3DbStrDup(db, zName); |
| @@ -72057,21 +72104,10 @@ | |
| 72104 | sqlite3VdbeAddOp3(v, OP_Function, 0, regArgs+3-pFunc->nArg, regArgs+3); |
| 72105 | assert( pFunc->nArg==-1 || (pFunc->nArg&0xff)==pFunc->nArg ); |
| 72106 | sqlite3VdbeChangeP5(v, (u8)(pFunc->nArg)); |
| 72107 | sqlite3VdbeChangeP4(v, -1, (char *)pFunc, P4_FUNCDEF); |
| 72108 | |
| 72109 | /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this |
| 72110 | ** statement only). For DETACH, set it to false (expire all existing |
| 72111 | ** statements). |
| 72112 | */ |
| 72113 | sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH)); |
| @@ -75944,11 +75980,10 @@ | |
| 75980 | assert( db->aDb[1].pSchema ); |
| 75981 | if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){ |
| 75982 | db->mallocFailed = 1; |
| 75983 | return 1; |
| 75984 | } |
| 75985 | } |
| 75986 | return 0; |
| 75987 | } |
| 75988 | |
| 75989 | /* |
| @@ -83613,62 +83648,49 @@ | |
| 83648 | ** PRAGMA [database.]journal_mode |
| 83649 | ** PRAGMA [database.]journal_mode = |
| 83650 | ** (delete|persist|off|truncate|memory|wal|off) |
| 83651 | */ |
| 83652 | if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){ |
| 83653 | int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */ |
| 83654 | int ii; /* Loop counter */ |
| 83655 | |
| 83656 | /* Force the schema to be loaded on all databases. This cases all |
| 83657 | ** database files to be opened and the journal_modes set. */ |
| 83658 | if( sqlite3ReadSchema(pParse) ){ |
| 83659 | goto pragma_out; |
| 83660 | } |
| 83661 | |
| 83662 | sqlite3VdbeSetNumCols(v, 1); |
| 83663 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC); |
| 83664 | |
| 83665 | if( zRight==0 ){ |
| 83666 | /* If there is no "=MODE" part of the pragma, do a query for the |
| 83667 | ** current mode */ |
| 83668 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83669 | }else{ |
| 83670 | const char *zMode; |
| 83671 | int n = sqlite3Strlen30(zRight); |
| 83672 | for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){ |
| 83673 | if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; |
| 83674 | } |
| 83675 | if( !zMode ){ |
| 83676 | /* If the "=MODE" part does not match any known journal mode, |
| 83677 | ** then do a query */ |
| 83678 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83679 | } |
| 83680 | } |
| 83681 | if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){ |
| 83682 | /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */ |
| 83683 | iDb = 0; |
| 83684 | pId2->n = 1; |
| 83685 | } |
| 83686 | for(ii=db->nDb-1; ii>=0; ii--){ |
| 83687 | if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){ |
| 83688 | sqlite3VdbeUsesBtree(v, ii); |
| 83689 | sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode); |
| 83690 | } |
| 83691 | } |
| 83692 | sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); |
| 83693 | }else |
| 83694 | |
| 83695 | /* |
| 83696 | ** PRAGMA [database.]journal_size_limit |
| 83697 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -107,11 +107,11 @@ | ||
| 107 | 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | 109 | */ |
| 110 | 110 | #define SQLITE_VERSION "3.7.0" |
| 111 | 111 | #define SQLITE_VERSION_NUMBER 3007000 |
| 112 | -#define SQLITE_SOURCE_ID "2010-07-07 14:45:41 8eefc287265443ec043bdab629597e79c9d22006" | |
| 112 | +#define SQLITE_SOURCE_ID "2010-07-08 17:40:38 e396184cd3bdb96e29ac33af5d1f631cac553341" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| 118 | 118 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.0" |
| 111 | #define SQLITE_VERSION_NUMBER 3007000 |
| 112 | #define SQLITE_SOURCE_ID "2010-07-07 14:45:41 8eefc287265443ec043bdab629597e79c9d22006" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| 118 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.0" |
| 111 | #define SQLITE_VERSION_NUMBER 3007000 |
| 112 | #define SQLITE_SOURCE_ID "2010-07-08 17:40:38 e396184cd3bdb96e29ac33af5d1f631cac553341" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| 118 |