Fossil SCM
Update the built-in SQLite to the latest 3.7.0 beta snapshot that includes fixes for large databases in WAL mode.
Commit
f0cd78c1a3d084764bcb898877ec54656355c15b
Parent
5acf61710413108…
2 files changed
+63
-34
+1
-1
+63
-34
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -509,10 +509,17 @@ | ||
| 509 | 509 | #else |
| 510 | 510 | # define ALWAYS(X) (X) |
| 511 | 511 | # define NEVER(X) (X) |
| 512 | 512 | #endif |
| 513 | 513 | |
| 514 | +/* | |
| 515 | +** Return true (non-zero) if the input is a integer that is too large | |
| 516 | +** to fit in 32-bits. This macro is used inside of various testcase() | |
| 517 | +** macros to verify that we have tested SQLite for large-file support. | |
| 518 | +*/ | |
| 519 | +#define IS_BIG_INT(X) (((X)&(i64)0xffffffff)!=0) | |
| 520 | + | |
| 514 | 521 | /* |
| 515 | 522 | ** The macro unlikely() is a hint that surrounds a boolean |
| 516 | 523 | ** expression that is usually false. Macro likely() surrounds |
| 517 | 524 | ** a boolean expression that is usually true. GCC is able to |
| 518 | 525 | ** use these hints to generate better code, sometimes. |
| @@ -636,11 +643,11 @@ | ||
| 636 | 643 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 637 | 644 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 638 | 645 | */ |
| 639 | 646 | #define SQLITE_VERSION "3.7.0" |
| 640 | 647 | #define SQLITE_VERSION_NUMBER 3007000 |
| 641 | -#define SQLITE_SOURCE_ID "2010-07-06 20:37:10 5621862b0e2fc945ded51f5926a6b4c9f07d0ab7" | |
| 648 | +#define SQLITE_SOURCE_ID "2010-07-07 14:45:41 8eefc287265443ec043bdab629597e79c9d22006" | |
| 642 | 649 | |
| 643 | 650 | /* |
| 644 | 651 | ** CAPI3REF: Run-Time Library Version Numbers |
| 645 | 652 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 646 | 653 | ** |
| @@ -11333,13 +11340,15 @@ | ||
| 11333 | 11340 | "OMIT_CAST", |
| 11334 | 11341 | #endif |
| 11335 | 11342 | #ifdef SQLITE_OMIT_CHECK |
| 11336 | 11343 | "OMIT_CHECK", |
| 11337 | 11344 | #endif |
| 11338 | -#ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS | |
| 11339 | - "OMIT_COMPILEOPTION_DIAGS", | |
| 11340 | -#endif | |
| 11345 | +/* // redundant | |
| 11346 | +** #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS | |
| 11347 | +** "OMIT_COMPILEOPTION_DIAGS", | |
| 11348 | +** #endif | |
| 11349 | +*/ | |
| 11341 | 11350 | #ifdef SQLITE_OMIT_COMPLETE |
| 11342 | 11351 | "OMIT_COMPLETE", |
| 11343 | 11352 | #endif |
| 11344 | 11353 | #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 11345 | 11354 | "OMIT_COMPOUND_SELECT", |
| @@ -11369,13 +11378,10 @@ | ||
| 11369 | 11378 | "OMIT_FOREIGN_KEY", |
| 11370 | 11379 | #endif |
| 11371 | 11380 | #ifdef SQLITE_OMIT_GET_TABLE |
| 11372 | 11381 | "OMIT_GET_TABLE", |
| 11373 | 11382 | #endif |
| 11374 | -#ifdef SQLITE_OMIT_GLOBALRECOVER | |
| 11375 | - "OMIT_GLOBALRECOVER", | |
| 11376 | -#endif | |
| 11377 | 11383 | #ifdef SQLITE_OMIT_INCRBLOB |
| 11378 | 11384 | "OMIT_INCRBLOB", |
| 11379 | 11385 | #endif |
| 11380 | 11386 | #ifdef SQLITE_OMIT_INTEGRITY_CHECK |
| 11381 | 11387 | "OMIT_INTEGRITY_CHECK", |
| @@ -11449,10 +11455,13 @@ | ||
| 11449 | 11455 | #ifdef SQLITE_OMIT_VIEW |
| 11450 | 11456 | "OMIT_VIEW", |
| 11451 | 11457 | #endif |
| 11452 | 11458 | #ifdef SQLITE_OMIT_VIRTUALTABLE |
| 11453 | 11459 | "OMIT_VIRTUALTABLE", |
| 11460 | +#endif | |
| 11461 | +#ifdef SQLITE_OMIT_WAL | |
| 11462 | + "OMIT_WAL", | |
| 11454 | 11463 | #endif |
| 11455 | 11464 | #ifdef SQLITE_OMIT_WSD |
| 11456 | 11465 | "OMIT_WSD", |
| 11457 | 11466 | #endif |
| 11458 | 11467 | #ifdef SQLITE_OMIT_XFER_OPT |
| @@ -30851,26 +30860,41 @@ | ||
| 30851 | 30860 | int flags, /* Type of test to make on this file */ |
| 30852 | 30861 | int *pResOut /* OUT: Result */ |
| 30853 | 30862 | ){ |
| 30854 | 30863 | DWORD attr; |
| 30855 | 30864 | int rc = 0; |
| 30856 | - void *zConverted = convertUtf8Filename(zFilename); | |
| 30865 | + void *zConverted; | |
| 30857 | 30866 | UNUSED_PARAMETER(pVfs); |
| 30867 | + | |
| 30868 | + SimulateIOError( return SQLITE_IOERR_ACCESS; ); | |
| 30869 | + zConverted = convertUtf8Filename(zFilename); | |
| 30858 | 30870 | if( zConverted==0 ){ |
| 30859 | 30871 | return SQLITE_NOMEM; |
| 30860 | 30872 | } |
| 30861 | 30873 | if( isNT() ){ |
| 30862 | 30874 | WIN32_FILE_ATTRIBUTE_DATA sAttrData; |
| 30863 | 30875 | memset(&sAttrData, 0, sizeof(sAttrData)); |
| 30864 | - attr = GetFileAttributesExW((WCHAR*)zConverted, | |
| 30865 | - GetFileExInfoStandard, &sAttrData); | |
| 30866 | - /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file | |
| 30867 | - ** as if it does not exist. | |
| 30868 | - */ | |
| 30869 | - if( flags==SQLITE_ACCESS_EXISTS && attr!=INVALID_FILE_ATTRIBUTES | |
| 30870 | - && sAttrData.nFileSizeHigh==0 && sAttrData.nFileSizeLow==0 ){ | |
| 30871 | - attr = INVALID_FILE_ATTRIBUTES; | |
| 30876 | + if( GetFileAttributesExW((WCHAR*)zConverted, | |
| 30877 | + GetFileExInfoStandard, | |
| 30878 | + &sAttrData) ){ | |
| 30879 | + /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file | |
| 30880 | + ** as if it does not exist. | |
| 30881 | + */ | |
| 30882 | + if( flags==SQLITE_ACCESS_EXISTS | |
| 30883 | + && sAttrData.nFileSizeHigh==0 | |
| 30884 | + && sAttrData.nFileSizeLow==0 ){ | |
| 30885 | + attr = INVALID_FILE_ATTRIBUTES; | |
| 30886 | + }else{ | |
| 30887 | + attr = sAttrData.dwFileAttributes; | |
| 30888 | + } | |
| 30889 | + }else{ | |
| 30890 | + if( GetLastError()!=ERROR_FILE_NOT_FOUND ){ | |
| 30891 | + free(zConverted); | |
| 30892 | + return SQLITE_IOERR_ACCESS; | |
| 30893 | + }else{ | |
| 30894 | + attr = INVALID_FILE_ATTRIBUTES; | |
| 30895 | + } | |
| 30872 | 30896 | } |
| 30873 | 30897 | /* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. |
| 30874 | 30898 | ** Since the ASCII version of these Windows API do not exist for WINCE, |
| 30875 | 30899 | ** it's important to not reference them for WINCE builds. |
| 30876 | 30900 | */ |
| @@ -36924,17 +36948,13 @@ | ||
| 36924 | 36948 | ** |
| 36925 | 36949 | ** If everything is successful, SQLITE_OK is returned. If an IO error |
| 36926 | 36950 | ** occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot |
| 36927 | 36951 | ** be obtained, SQLITE_BUSY is returned. |
| 36928 | 36952 | */ |
| 36929 | -static int pager_write_pagelist(PgHdr *pList){ | |
| 36930 | - Pager *pPager; /* Pager object */ | |
| 36953 | +static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ | |
| 36931 | 36954 | int rc; /* Return code */ |
| 36932 | 36955 | |
| 36933 | - if( NEVER(pList==0) ) return SQLITE_OK; | |
| 36934 | - pPager = pList->pPager; | |
| 36935 | - | |
| 36936 | 36956 | /* At this point there may be either a RESERVED or EXCLUSIVE lock on the |
| 36937 | 36957 | ** database file. If there is already an EXCLUSIVE lock, the following |
| 36938 | 36958 | ** call is a no-op. |
| 36939 | 36959 | ** |
| 36940 | 36960 | ** Moving the lock from RESERVED to EXCLUSIVE actually involves going |
| @@ -36947,11 +36967,11 @@ | ||
| 36947 | 36967 | ** is unchanged and we can rollback without having to playback the |
| 36948 | 36968 | ** journal into the original database file. Once we transition to |
| 36949 | 36969 | ** EXCLUSIVE, it means the database file has been changed and any rollback |
| 36950 | 36970 | ** will require a journal playback. |
| 36951 | 36971 | */ |
| 36952 | - assert( !pagerUseWal(pList->pPager) ); | |
| 36972 | + assert( !pagerUseWal(pPager) ); | |
| 36953 | 36973 | assert( pPager->state>=PAGER_RESERVED ); |
| 36954 | 36974 | rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK); |
| 36955 | 36975 | |
| 36956 | 36976 | /* If the file is a temp-file has not yet been opened, open it now. It |
| 36957 | 36977 | ** is not possible for rc to be other than SQLITE_OK if this branch |
| @@ -37192,11 +37212,11 @@ | ||
| 37192 | 37212 | rc = subjournalPage(pPg); |
| 37193 | 37213 | } |
| 37194 | 37214 | |
| 37195 | 37215 | /* Write the contents of the page out to the database file. */ |
| 37196 | 37216 | if( rc==SQLITE_OK ){ |
| 37197 | - rc = pager_write_pagelist(pPg); | |
| 37217 | + rc = pager_write_pagelist(pPager, pPg); | |
| 37198 | 37218 | } |
| 37199 | 37219 | } |
| 37200 | 37220 | |
| 37201 | 37221 | /* Mark the page as clean. */ |
| 37202 | 37222 | if( rc==SQLITE_OK ){ |
| @@ -38821,11 +38841,11 @@ | ||
| 38821 | 38841 | */ |
| 38822 | 38842 | rc = syncJournal(pPager); |
| 38823 | 38843 | if( rc!=SQLITE_OK ) goto commit_phase_one_exit; |
| 38824 | 38844 | |
| 38825 | 38845 | /* Write all dirty pages to the database file. */ |
| 38826 | - rc = pager_write_pagelist(sqlite3PcacheDirtyList(pPager->pPCache)); | |
| 38846 | + rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache)); | |
| 38827 | 38847 | if( rc!=SQLITE_OK ){ |
| 38828 | 38848 | assert( rc!=SQLITE_IOERR_BLOCKED ); |
| 38829 | 38849 | goto commit_phase_one_exit; |
| 38830 | 38850 | } |
| 38831 | 38851 | sqlite3PcacheCleanAll(pPager->pPCache); |
| @@ -40137,11 +40157,11 @@ | ||
| 40137 | 40157 | ** Return the offset of frame iFrame in the write-ahead log file, |
| 40138 | 40158 | ** assuming a database page size of szPage bytes. The offset returned |
| 40139 | 40159 | ** is to the start of the write-ahead log frame-header. |
| 40140 | 40160 | */ |
| 40141 | 40161 | #define walFrameOffset(iFrame, szPage) ( \ |
| 40142 | - WAL_HDRSIZE + ((iFrame)-1)*((szPage)+WAL_FRAME_HDRSIZE) \ | |
| 40162 | + WAL_HDRSIZE + ((iFrame)-1)*(i64)((szPage)+WAL_FRAME_HDRSIZE) \ | |
| 40143 | 40163 | ) |
| 40144 | 40164 | |
| 40145 | 40165 | /* |
| 40146 | 40166 | ** An open write-ahead log file is represented by an instance of the |
| 40147 | 40167 | ** following object. |
| @@ -41313,24 +41333,29 @@ | ||
| 41313 | 41333 | rc = sqlite3OsSync(pWal->pWalFd, sync_flags); |
| 41314 | 41334 | } |
| 41315 | 41335 | |
| 41316 | 41336 | /* Iterate through the contents of the WAL, copying data to the db file. */ |
| 41317 | 41337 | while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ |
| 41338 | + i64 iOffset; | |
| 41318 | 41339 | assert( walFramePgno(pWal, iFrame)==iDbpage ); |
| 41319 | 41340 | if( iFrame<=nBackfill || iFrame>mxSafeFrame ) continue; |
| 41320 | - rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, | |
| 41321 | - walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE | |
| 41322 | - ); | |
| 41341 | + iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; | |
| 41342 | + /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ | |
| 41343 | + rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); | |
| 41323 | 41344 | if( rc!=SQLITE_OK ) break; |
| 41324 | - rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, (iDbpage-1)*szPage); | |
| 41345 | + iOffset = (iDbpage-1)*(i64)szPage; | |
| 41346 | + testcase( IS_BIG_INT(iOffset) ); | |
| 41347 | + rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); | |
| 41325 | 41348 | if( rc!=SQLITE_OK ) break; |
| 41326 | 41349 | } |
| 41327 | 41350 | |
| 41328 | 41351 | /* If work was actually accomplished... */ |
| 41329 | 41352 | if( rc==SQLITE_OK ){ |
| 41330 | 41353 | if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ |
| 41331 | - rc = sqlite3OsTruncate(pWal->pDbFd, ((i64)pWal->hdr.nPage*(i64)szPage)); | |
| 41354 | + i64 szDb = pWal->hdr.nPage*(i64)szPage; | |
| 41355 | + testcase( IS_BIG_INT(szDb) ); | |
| 41356 | + rc = sqlite3OsTruncate(pWal->pDbFd, szDb); | |
| 41332 | 41357 | if( rc==SQLITE_OK && sync_flags ){ |
| 41333 | 41358 | rc = sqlite3OsSync(pWal->pDbFd, sync_flags); |
| 41334 | 41359 | } |
| 41335 | 41360 | } |
| 41336 | 41361 | if( rc==SQLITE_OK ){ |
| @@ -41864,10 +41889,11 @@ | ||
| 41864 | 41889 | ** required page. Read and return data from the log file. |
| 41865 | 41890 | */ |
| 41866 | 41891 | if( iRead ){ |
| 41867 | 41892 | i64 iOffset = walFrameOffset(iRead, pWal->hdr.szPage) + WAL_FRAME_HDRSIZE; |
| 41868 | 41893 | *pInWal = 1; |
| 41894 | + /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */ | |
| 41869 | 41895 | return sqlite3OsRead(pWal->pWalFd, pOut, nOut, iOffset); |
| 41870 | 41896 | } |
| 41871 | 41897 | |
| 41872 | 41898 | *pInWal = 0; |
| 41873 | 41899 | return SQLITE_OK; |
| @@ -42154,12 +42180,12 @@ | ||
| 42154 | 42180 | for(p=pList; p; p=p->pDirty){ |
| 42155 | 42181 | u32 nDbsize; /* Db-size field for frame header */ |
| 42156 | 42182 | i64 iOffset; /* Write offset in log file */ |
| 42157 | 42183 | void *pData; |
| 42158 | 42184 | |
| 42159 | - | |
| 42160 | 42185 | iOffset = walFrameOffset(++iFrame, szPage); |
| 42186 | + /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */ | |
| 42161 | 42187 | |
| 42162 | 42188 | /* Populate and write the frame header */ |
| 42163 | 42189 | nDbsize = (isCommit && p->pDirty==0) ? nTruncate : 0; |
| 42164 | 42190 | #if defined(SQLITE_HAS_CODEC) |
| 42165 | 42191 | if( (pData = sqlite3PagerCodec(p))==0 ) return SQLITE_NOMEM; |
| @@ -42195,10 +42221,11 @@ | ||
| 42195 | 42221 | if( (pData = sqlite3PagerCodec(pLast))==0 ) return SQLITE_NOMEM; |
| 42196 | 42222 | #else |
| 42197 | 42223 | pData = pLast->pData; |
| 42198 | 42224 | #endif |
| 42199 | 42225 | walEncodeFrame(pWal, pLast->pgno, nTruncate, pData, aFrame); |
| 42226 | + /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */ | |
| 42200 | 42227 | rc = sqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOffset); |
| 42201 | 42228 | if( rc!=SQLITE_OK ){ |
| 42202 | 42229 | return rc; |
| 42203 | 42230 | } |
| 42204 | 42231 | iOffset += WAL_FRAME_HDRSIZE; |
| @@ -83587,20 +83614,24 @@ | ||
| 83587 | 83614 | ** PRAGMA [database.]journal_mode = |
| 83588 | 83615 | ** (delete|persist|off|truncate|memory|wal|off) |
| 83589 | 83616 | */ |
| 83590 | 83617 | if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){ |
| 83591 | 83618 | int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */ |
| 83619 | + | |
| 83620 | + if( sqlite3ReadSchema(pParse) ){ | |
| 83621 | + goto pragma_out; | |
| 83622 | + } | |
| 83592 | 83623 | |
| 83593 | 83624 | sqlite3VdbeSetNumCols(v, 1); |
| 83594 | 83625 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC); |
| 83595 | 83626 | |
| 83596 | 83627 | if( zRight==0 ){ |
| 83597 | 83628 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83598 | 83629 | }else{ |
| 83599 | 83630 | const char *zMode; |
| 83600 | 83631 | int n = sqlite3Strlen30(zRight); |
| 83601 | - for(eMode=0; (zMode = sqlite3JournalModename(eMode)); eMode++){ | |
| 83632 | + for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){ | |
| 83602 | 83633 | if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; |
| 83603 | 83634 | } |
| 83604 | 83635 | if( !zMode ){ |
| 83605 | 83636 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83606 | 83637 | } |
| @@ -104129,20 +104160,18 @@ | ||
| 104129 | 104160 | sqlite3_mutex_leave(db->mutex); |
| 104130 | 104161 | return SQLITE_OK; |
| 104131 | 104162 | } |
| 104132 | 104163 | #endif /* SQLITE_OMIT_UTF16 */ |
| 104133 | 104164 | |
| 104134 | -#ifndef SQLITE_OMIT_GLOBALRECOVER | |
| 104135 | 104165 | #ifndef SQLITE_OMIT_DEPRECATED |
| 104136 | 104166 | /* |
| 104137 | 104167 | ** This function is now an anachronism. It used to be used to recover from a |
| 104138 | 104168 | ** malloc() failure, but SQLite now does this automatically. |
| 104139 | 104169 | */ |
| 104140 | 104170 | SQLITE_API int sqlite3_global_recover(void){ |
| 104141 | 104171 | return SQLITE_OK; |
| 104142 | 104172 | } |
| 104143 | -#endif | |
| 104144 | 104173 | #endif |
| 104145 | 104174 | |
| 104146 | 104175 | /* |
| 104147 | 104176 | ** Test to see whether or not the database connection is in autocommit |
| 104148 | 104177 | ** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on |
| 104149 | 104178 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -509,10 +509,17 @@ | |
| 509 | #else |
| 510 | # define ALWAYS(X) (X) |
| 511 | # define NEVER(X) (X) |
| 512 | #endif |
| 513 | |
| 514 | /* |
| 515 | ** The macro unlikely() is a hint that surrounds a boolean |
| 516 | ** expression that is usually false. Macro likely() surrounds |
| 517 | ** a boolean expression that is usually true. GCC is able to |
| 518 | ** use these hints to generate better code, sometimes. |
| @@ -636,11 +643,11 @@ | |
| 636 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 637 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 638 | */ |
| 639 | #define SQLITE_VERSION "3.7.0" |
| 640 | #define SQLITE_VERSION_NUMBER 3007000 |
| 641 | #define SQLITE_SOURCE_ID "2010-07-06 20:37:10 5621862b0e2fc945ded51f5926a6b4c9f07d0ab7" |
| 642 | |
| 643 | /* |
| 644 | ** CAPI3REF: Run-Time Library Version Numbers |
| 645 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 646 | ** |
| @@ -11333,13 +11340,15 @@ | |
| 11333 | "OMIT_CAST", |
| 11334 | #endif |
| 11335 | #ifdef SQLITE_OMIT_CHECK |
| 11336 | "OMIT_CHECK", |
| 11337 | #endif |
| 11338 | #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 11339 | "OMIT_COMPILEOPTION_DIAGS", |
| 11340 | #endif |
| 11341 | #ifdef SQLITE_OMIT_COMPLETE |
| 11342 | "OMIT_COMPLETE", |
| 11343 | #endif |
| 11344 | #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 11345 | "OMIT_COMPOUND_SELECT", |
| @@ -11369,13 +11378,10 @@ | |
| 11369 | "OMIT_FOREIGN_KEY", |
| 11370 | #endif |
| 11371 | #ifdef SQLITE_OMIT_GET_TABLE |
| 11372 | "OMIT_GET_TABLE", |
| 11373 | #endif |
| 11374 | #ifdef SQLITE_OMIT_GLOBALRECOVER |
| 11375 | "OMIT_GLOBALRECOVER", |
| 11376 | #endif |
| 11377 | #ifdef SQLITE_OMIT_INCRBLOB |
| 11378 | "OMIT_INCRBLOB", |
| 11379 | #endif |
| 11380 | #ifdef SQLITE_OMIT_INTEGRITY_CHECK |
| 11381 | "OMIT_INTEGRITY_CHECK", |
| @@ -11449,10 +11455,13 @@ | |
| 11449 | #ifdef SQLITE_OMIT_VIEW |
| 11450 | "OMIT_VIEW", |
| 11451 | #endif |
| 11452 | #ifdef SQLITE_OMIT_VIRTUALTABLE |
| 11453 | "OMIT_VIRTUALTABLE", |
| 11454 | #endif |
| 11455 | #ifdef SQLITE_OMIT_WSD |
| 11456 | "OMIT_WSD", |
| 11457 | #endif |
| 11458 | #ifdef SQLITE_OMIT_XFER_OPT |
| @@ -30851,26 +30860,41 @@ | |
| 30851 | int flags, /* Type of test to make on this file */ |
| 30852 | int *pResOut /* OUT: Result */ |
| 30853 | ){ |
| 30854 | DWORD attr; |
| 30855 | int rc = 0; |
| 30856 | void *zConverted = convertUtf8Filename(zFilename); |
| 30857 | UNUSED_PARAMETER(pVfs); |
| 30858 | if( zConverted==0 ){ |
| 30859 | return SQLITE_NOMEM; |
| 30860 | } |
| 30861 | if( isNT() ){ |
| 30862 | WIN32_FILE_ATTRIBUTE_DATA sAttrData; |
| 30863 | memset(&sAttrData, 0, sizeof(sAttrData)); |
| 30864 | attr = GetFileAttributesExW((WCHAR*)zConverted, |
| 30865 | GetFileExInfoStandard, &sAttrData); |
| 30866 | /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file |
| 30867 | ** as if it does not exist. |
| 30868 | */ |
| 30869 | if( flags==SQLITE_ACCESS_EXISTS && attr!=INVALID_FILE_ATTRIBUTES |
| 30870 | && sAttrData.nFileSizeHigh==0 && sAttrData.nFileSizeLow==0 ){ |
| 30871 | attr = INVALID_FILE_ATTRIBUTES; |
| 30872 | } |
| 30873 | /* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. |
| 30874 | ** Since the ASCII version of these Windows API do not exist for WINCE, |
| 30875 | ** it's important to not reference them for WINCE builds. |
| 30876 | */ |
| @@ -36924,17 +36948,13 @@ | |
| 36924 | ** |
| 36925 | ** If everything is successful, SQLITE_OK is returned. If an IO error |
| 36926 | ** occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot |
| 36927 | ** be obtained, SQLITE_BUSY is returned. |
| 36928 | */ |
| 36929 | static int pager_write_pagelist(PgHdr *pList){ |
| 36930 | Pager *pPager; /* Pager object */ |
| 36931 | int rc; /* Return code */ |
| 36932 | |
| 36933 | if( NEVER(pList==0) ) return SQLITE_OK; |
| 36934 | pPager = pList->pPager; |
| 36935 | |
| 36936 | /* At this point there may be either a RESERVED or EXCLUSIVE lock on the |
| 36937 | ** database file. If there is already an EXCLUSIVE lock, the following |
| 36938 | ** call is a no-op. |
| 36939 | ** |
| 36940 | ** Moving the lock from RESERVED to EXCLUSIVE actually involves going |
| @@ -36947,11 +36967,11 @@ | |
| 36947 | ** is unchanged and we can rollback without having to playback the |
| 36948 | ** journal into the original database file. Once we transition to |
| 36949 | ** EXCLUSIVE, it means the database file has been changed and any rollback |
| 36950 | ** will require a journal playback. |
| 36951 | */ |
| 36952 | assert( !pagerUseWal(pList->pPager) ); |
| 36953 | assert( pPager->state>=PAGER_RESERVED ); |
| 36954 | rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK); |
| 36955 | |
| 36956 | /* If the file is a temp-file has not yet been opened, open it now. It |
| 36957 | ** is not possible for rc to be other than SQLITE_OK if this branch |
| @@ -37192,11 +37212,11 @@ | |
| 37192 | rc = subjournalPage(pPg); |
| 37193 | } |
| 37194 | |
| 37195 | /* Write the contents of the page out to the database file. */ |
| 37196 | if( rc==SQLITE_OK ){ |
| 37197 | rc = pager_write_pagelist(pPg); |
| 37198 | } |
| 37199 | } |
| 37200 | |
| 37201 | /* Mark the page as clean. */ |
| 37202 | if( rc==SQLITE_OK ){ |
| @@ -38821,11 +38841,11 @@ | |
| 38821 | */ |
| 38822 | rc = syncJournal(pPager); |
| 38823 | if( rc!=SQLITE_OK ) goto commit_phase_one_exit; |
| 38824 | |
| 38825 | /* Write all dirty pages to the database file. */ |
| 38826 | rc = pager_write_pagelist(sqlite3PcacheDirtyList(pPager->pPCache)); |
| 38827 | if( rc!=SQLITE_OK ){ |
| 38828 | assert( rc!=SQLITE_IOERR_BLOCKED ); |
| 38829 | goto commit_phase_one_exit; |
| 38830 | } |
| 38831 | sqlite3PcacheCleanAll(pPager->pPCache); |
| @@ -40137,11 +40157,11 @@ | |
| 40137 | ** Return the offset of frame iFrame in the write-ahead log file, |
| 40138 | ** assuming a database page size of szPage bytes. The offset returned |
| 40139 | ** is to the start of the write-ahead log frame-header. |
| 40140 | */ |
| 40141 | #define walFrameOffset(iFrame, szPage) ( \ |
| 40142 | WAL_HDRSIZE + ((iFrame)-1)*((szPage)+WAL_FRAME_HDRSIZE) \ |
| 40143 | ) |
| 40144 | |
| 40145 | /* |
| 40146 | ** An open write-ahead log file is represented by an instance of the |
| 40147 | ** following object. |
| @@ -41313,24 +41333,29 @@ | |
| 41313 | rc = sqlite3OsSync(pWal->pWalFd, sync_flags); |
| 41314 | } |
| 41315 | |
| 41316 | /* Iterate through the contents of the WAL, copying data to the db file. */ |
| 41317 | while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ |
| 41318 | assert( walFramePgno(pWal, iFrame)==iDbpage ); |
| 41319 | if( iFrame<=nBackfill || iFrame>mxSafeFrame ) continue; |
| 41320 | rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, |
| 41321 | walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE |
| 41322 | ); |
| 41323 | if( rc!=SQLITE_OK ) break; |
| 41324 | rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, (iDbpage-1)*szPage); |
| 41325 | if( rc!=SQLITE_OK ) break; |
| 41326 | } |
| 41327 | |
| 41328 | /* If work was actually accomplished... */ |
| 41329 | if( rc==SQLITE_OK ){ |
| 41330 | if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ |
| 41331 | rc = sqlite3OsTruncate(pWal->pDbFd, ((i64)pWal->hdr.nPage*(i64)szPage)); |
| 41332 | if( rc==SQLITE_OK && sync_flags ){ |
| 41333 | rc = sqlite3OsSync(pWal->pDbFd, sync_flags); |
| 41334 | } |
| 41335 | } |
| 41336 | if( rc==SQLITE_OK ){ |
| @@ -41864,10 +41889,11 @@ | |
| 41864 | ** required page. Read and return data from the log file. |
| 41865 | */ |
| 41866 | if( iRead ){ |
| 41867 | i64 iOffset = walFrameOffset(iRead, pWal->hdr.szPage) + WAL_FRAME_HDRSIZE; |
| 41868 | *pInWal = 1; |
| 41869 | return sqlite3OsRead(pWal->pWalFd, pOut, nOut, iOffset); |
| 41870 | } |
| 41871 | |
| 41872 | *pInWal = 0; |
| 41873 | return SQLITE_OK; |
| @@ -42154,12 +42180,12 @@ | |
| 42154 | for(p=pList; p; p=p->pDirty){ |
| 42155 | u32 nDbsize; /* Db-size field for frame header */ |
| 42156 | i64 iOffset; /* Write offset in log file */ |
| 42157 | void *pData; |
| 42158 | |
| 42159 | |
| 42160 | iOffset = walFrameOffset(++iFrame, szPage); |
| 42161 | |
| 42162 | /* Populate and write the frame header */ |
| 42163 | nDbsize = (isCommit && p->pDirty==0) ? nTruncate : 0; |
| 42164 | #if defined(SQLITE_HAS_CODEC) |
| 42165 | if( (pData = sqlite3PagerCodec(p))==0 ) return SQLITE_NOMEM; |
| @@ -42195,10 +42221,11 @@ | |
| 42195 | if( (pData = sqlite3PagerCodec(pLast))==0 ) return SQLITE_NOMEM; |
| 42196 | #else |
| 42197 | pData = pLast->pData; |
| 42198 | #endif |
| 42199 | walEncodeFrame(pWal, pLast->pgno, nTruncate, pData, aFrame); |
| 42200 | rc = sqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOffset); |
| 42201 | if( rc!=SQLITE_OK ){ |
| 42202 | return rc; |
| 42203 | } |
| 42204 | iOffset += WAL_FRAME_HDRSIZE; |
| @@ -83587,20 +83614,24 @@ | |
| 83587 | ** PRAGMA [database.]journal_mode = |
| 83588 | ** (delete|persist|off|truncate|memory|wal|off) |
| 83589 | */ |
| 83590 | if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){ |
| 83591 | int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */ |
| 83592 | |
| 83593 | sqlite3VdbeSetNumCols(v, 1); |
| 83594 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC); |
| 83595 | |
| 83596 | if( zRight==0 ){ |
| 83597 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83598 | }else{ |
| 83599 | const char *zMode; |
| 83600 | int n = sqlite3Strlen30(zRight); |
| 83601 | for(eMode=0; (zMode = sqlite3JournalModename(eMode)); eMode++){ |
| 83602 | if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; |
| 83603 | } |
| 83604 | if( !zMode ){ |
| 83605 | eMode = PAGER_JOURNALMODE_QUERY; |
| 83606 | } |
| @@ -104129,20 +104160,18 @@ | |
| 104129 | sqlite3_mutex_leave(db->mutex); |
| 104130 | return SQLITE_OK; |
| 104131 | } |
| 104132 | #endif /* SQLITE_OMIT_UTF16 */ |
| 104133 | |
| 104134 | #ifndef SQLITE_OMIT_GLOBALRECOVER |
| 104135 | #ifndef SQLITE_OMIT_DEPRECATED |
| 104136 | /* |
| 104137 | ** This function is now an anachronism. It used to be used to recover from a |
| 104138 | ** malloc() failure, but SQLite now does this automatically. |
| 104139 | */ |
| 104140 | SQLITE_API int sqlite3_global_recover(void){ |
| 104141 | return SQLITE_OK; |
| 104142 | } |
| 104143 | #endif |
| 104144 | #endif |
| 104145 | |
| 104146 | /* |
| 104147 | ** Test to see whether or not the database connection is in autocommit |
| 104148 | ** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on |
| 104149 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -509,10 +509,17 @@ | |
| 509 | #else |
| 510 | # define ALWAYS(X) (X) |
| 511 | # define NEVER(X) (X) |
| 512 | #endif |
| 513 | |
| 514 | /* |
| 515 | ** Return true (non-zero) if the input is a integer that is too large |
| 516 | ** to fit in 32-bits. This macro is used inside of various testcase() |
| 517 | ** macros to verify that we have tested SQLite for large-file support. |
| 518 | */ |
| 519 | #define IS_BIG_INT(X) (((X)&(i64)0xffffffff)!=0) |
| 520 | |
| 521 | /* |
| 522 | ** The macro unlikely() is a hint that surrounds a boolean |
| 523 | ** expression that is usually false. Macro likely() surrounds |
| 524 | ** a boolean expression that is usually true. GCC is able to |
| 525 | ** use these hints to generate better code, sometimes. |
| @@ -636,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 | ** |
| @@ -11333,13 +11340,15 @@ | |
| 11340 | "OMIT_CAST", |
| 11341 | #endif |
| 11342 | #ifdef SQLITE_OMIT_CHECK |
| 11343 | "OMIT_CHECK", |
| 11344 | #endif |
| 11345 | /* // redundant |
| 11346 | ** #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 11347 | ** "OMIT_COMPILEOPTION_DIAGS", |
| 11348 | ** #endif |
| 11349 | */ |
| 11350 | #ifdef SQLITE_OMIT_COMPLETE |
| 11351 | "OMIT_COMPLETE", |
| 11352 | #endif |
| 11353 | #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 11354 | "OMIT_COMPOUND_SELECT", |
| @@ -11369,13 +11378,10 @@ | |
| 11378 | "OMIT_FOREIGN_KEY", |
| 11379 | #endif |
| 11380 | #ifdef SQLITE_OMIT_GET_TABLE |
| 11381 | "OMIT_GET_TABLE", |
| 11382 | #endif |
| 11383 | #ifdef SQLITE_OMIT_INCRBLOB |
| 11384 | "OMIT_INCRBLOB", |
| 11385 | #endif |
| 11386 | #ifdef SQLITE_OMIT_INTEGRITY_CHECK |
| 11387 | "OMIT_INTEGRITY_CHECK", |
| @@ -11449,10 +11455,13 @@ | |
| 11455 | #ifdef SQLITE_OMIT_VIEW |
| 11456 | "OMIT_VIEW", |
| 11457 | #endif |
| 11458 | #ifdef SQLITE_OMIT_VIRTUALTABLE |
| 11459 | "OMIT_VIRTUALTABLE", |
| 11460 | #endif |
| 11461 | #ifdef SQLITE_OMIT_WAL |
| 11462 | "OMIT_WAL", |
| 11463 | #endif |
| 11464 | #ifdef SQLITE_OMIT_WSD |
| 11465 | "OMIT_WSD", |
| 11466 | #endif |
| 11467 | #ifdef SQLITE_OMIT_XFER_OPT |
| @@ -30851,26 +30860,41 @@ | |
| 30860 | int flags, /* Type of test to make on this file */ |
| 30861 | int *pResOut /* OUT: Result */ |
| 30862 | ){ |
| 30863 | DWORD attr; |
| 30864 | int rc = 0; |
| 30865 | void *zConverted; |
| 30866 | UNUSED_PARAMETER(pVfs); |
| 30867 | |
| 30868 | SimulateIOError( return SQLITE_IOERR_ACCESS; ); |
| 30869 | zConverted = convertUtf8Filename(zFilename); |
| 30870 | if( zConverted==0 ){ |
| 30871 | return SQLITE_NOMEM; |
| 30872 | } |
| 30873 | if( isNT() ){ |
| 30874 | WIN32_FILE_ATTRIBUTE_DATA sAttrData; |
| 30875 | memset(&sAttrData, 0, sizeof(sAttrData)); |
| 30876 | if( GetFileAttributesExW((WCHAR*)zConverted, |
| 30877 | GetFileExInfoStandard, |
| 30878 | &sAttrData) ){ |
| 30879 | /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file |
| 30880 | ** as if it does not exist. |
| 30881 | */ |
| 30882 | if( flags==SQLITE_ACCESS_EXISTS |
| 30883 | && sAttrData.nFileSizeHigh==0 |
| 30884 | && sAttrData.nFileSizeLow==0 ){ |
| 30885 | attr = INVALID_FILE_ATTRIBUTES; |
| 30886 | }else{ |
| 30887 | attr = sAttrData.dwFileAttributes; |
| 30888 | } |
| 30889 | }else{ |
| 30890 | if( GetLastError()!=ERROR_FILE_NOT_FOUND ){ |
| 30891 | free(zConverted); |
| 30892 | return SQLITE_IOERR_ACCESS; |
| 30893 | }else{ |
| 30894 | attr = INVALID_FILE_ATTRIBUTES; |
| 30895 | } |
| 30896 | } |
| 30897 | /* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. |
| 30898 | ** Since the ASCII version of these Windows API do not exist for WINCE, |
| 30899 | ** it's important to not reference them for WINCE builds. |
| 30900 | */ |
| @@ -36924,17 +36948,13 @@ | |
| 36948 | ** |
| 36949 | ** If everything is successful, SQLITE_OK is returned. If an IO error |
| 36950 | ** occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot |
| 36951 | ** be obtained, SQLITE_BUSY is returned. |
| 36952 | */ |
| 36953 | static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ |
| 36954 | int rc; /* Return code */ |
| 36955 | |
| 36956 | /* At this point there may be either a RESERVED or EXCLUSIVE lock on the |
| 36957 | ** database file. If there is already an EXCLUSIVE lock, the following |
| 36958 | ** call is a no-op. |
| 36959 | ** |
| 36960 | ** Moving the lock from RESERVED to EXCLUSIVE actually involves going |
| @@ -36947,11 +36967,11 @@ | |
| 36967 | ** is unchanged and we can rollback without having to playback the |
| 36968 | ** journal into the original database file. Once we transition to |
| 36969 | ** EXCLUSIVE, it means the database file has been changed and any rollback |
| 36970 | ** will require a journal playback. |
| 36971 | */ |
| 36972 | assert( !pagerUseWal(pPager) ); |
| 36973 | assert( pPager->state>=PAGER_RESERVED ); |
| 36974 | rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK); |
| 36975 | |
| 36976 | /* If the file is a temp-file has not yet been opened, open it now. It |
| 36977 | ** is not possible for rc to be other than SQLITE_OK if this branch |
| @@ -37192,11 +37212,11 @@ | |
| 37212 | rc = subjournalPage(pPg); |
| 37213 | } |
| 37214 | |
| 37215 | /* Write the contents of the page out to the database file. */ |
| 37216 | if( rc==SQLITE_OK ){ |
| 37217 | rc = pager_write_pagelist(pPager, pPg); |
| 37218 | } |
| 37219 | } |
| 37220 | |
| 37221 | /* Mark the page as clean. */ |
| 37222 | if( rc==SQLITE_OK ){ |
| @@ -38821,11 +38841,11 @@ | |
| 38841 | */ |
| 38842 | rc = syncJournal(pPager); |
| 38843 | if( rc!=SQLITE_OK ) goto commit_phase_one_exit; |
| 38844 | |
| 38845 | /* Write all dirty pages to the database file. */ |
| 38846 | rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache)); |
| 38847 | if( rc!=SQLITE_OK ){ |
| 38848 | assert( rc!=SQLITE_IOERR_BLOCKED ); |
| 38849 | goto commit_phase_one_exit; |
| 38850 | } |
| 38851 | sqlite3PcacheCleanAll(pPager->pPCache); |
| @@ -40137,11 +40157,11 @@ | |
| 40157 | ** Return the offset of frame iFrame in the write-ahead log file, |
| 40158 | ** assuming a database page size of szPage bytes. The offset returned |
| 40159 | ** is to the start of the write-ahead log frame-header. |
| 40160 | */ |
| 40161 | #define walFrameOffset(iFrame, szPage) ( \ |
| 40162 | WAL_HDRSIZE + ((iFrame)-1)*(i64)((szPage)+WAL_FRAME_HDRSIZE) \ |
| 40163 | ) |
| 40164 | |
| 40165 | /* |
| 40166 | ** An open write-ahead log file is represented by an instance of the |
| 40167 | ** following object. |
| @@ -41313,24 +41333,29 @@ | |
| 41333 | rc = sqlite3OsSync(pWal->pWalFd, sync_flags); |
| 41334 | } |
| 41335 | |
| 41336 | /* Iterate through the contents of the WAL, copying data to the db file. */ |
| 41337 | while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ |
| 41338 | i64 iOffset; |
| 41339 | assert( walFramePgno(pWal, iFrame)==iDbpage ); |
| 41340 | if( iFrame<=nBackfill || iFrame>mxSafeFrame ) continue; |
| 41341 | iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; |
| 41342 | /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ |
| 41343 | rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); |
| 41344 | if( rc!=SQLITE_OK ) break; |
| 41345 | iOffset = (iDbpage-1)*(i64)szPage; |
| 41346 | testcase( IS_BIG_INT(iOffset) ); |
| 41347 | rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); |
| 41348 | if( rc!=SQLITE_OK ) break; |
| 41349 | } |
| 41350 | |
| 41351 | /* If work was actually accomplished... */ |
| 41352 | if( rc==SQLITE_OK ){ |
| 41353 | if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ |
| 41354 | i64 szDb = pWal->hdr.nPage*(i64)szPage; |
| 41355 | testcase( IS_BIG_INT(szDb) ); |
| 41356 | rc = sqlite3OsTruncate(pWal->pDbFd, szDb); |
| 41357 | if( rc==SQLITE_OK && sync_flags ){ |
| 41358 | rc = sqlite3OsSync(pWal->pDbFd, sync_flags); |
| 41359 | } |
| 41360 | } |
| 41361 | if( rc==SQLITE_OK ){ |
| @@ -41864,10 +41889,11 @@ | |
| 41889 | ** required page. Read and return data from the log file. |
| 41890 | */ |
| 41891 | if( iRead ){ |
| 41892 | i64 iOffset = walFrameOffset(iRead, pWal->hdr.szPage) + WAL_FRAME_HDRSIZE; |
| 41893 | *pInWal = 1; |
| 41894 | /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */ |
| 41895 | return sqlite3OsRead(pWal->pWalFd, pOut, nOut, iOffset); |
| 41896 | } |
| 41897 | |
| 41898 | *pInWal = 0; |
| 41899 | return SQLITE_OK; |
| @@ -42154,12 +42180,12 @@ | |
| 42180 | for(p=pList; p; p=p->pDirty){ |
| 42181 | u32 nDbsize; /* Db-size field for frame header */ |
| 42182 | i64 iOffset; /* Write offset in log file */ |
| 42183 | void *pData; |
| 42184 | |
| 42185 | iOffset = walFrameOffset(++iFrame, szPage); |
| 42186 | /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */ |
| 42187 | |
| 42188 | /* Populate and write the frame header */ |
| 42189 | nDbsize = (isCommit && p->pDirty==0) ? nTruncate : 0; |
| 42190 | #if defined(SQLITE_HAS_CODEC) |
| 42191 | if( (pData = sqlite3PagerCodec(p))==0 ) return SQLITE_NOMEM; |
| @@ -42195,10 +42221,11 @@ | |
| 42221 | if( (pData = sqlite3PagerCodec(pLast))==0 ) return SQLITE_NOMEM; |
| 42222 | #else |
| 42223 | pData = pLast->pData; |
| 42224 | #endif |
| 42225 | walEncodeFrame(pWal, pLast->pgno, nTruncate, pData, aFrame); |
| 42226 | /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */ |
| 42227 | rc = sqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOffset); |
| 42228 | if( rc!=SQLITE_OK ){ |
| 42229 | return rc; |
| 42230 | } |
| 42231 | iOffset += WAL_FRAME_HDRSIZE; |
| @@ -83587,20 +83614,24 @@ | |
| 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 | } |
| @@ -104129,20 +104160,18 @@ | |
| 104160 | sqlite3_mutex_leave(db->mutex); |
| 104161 | return SQLITE_OK; |
| 104162 | } |
| 104163 | #endif /* SQLITE_OMIT_UTF16 */ |
| 104164 | |
| 104165 | #ifndef SQLITE_OMIT_DEPRECATED |
| 104166 | /* |
| 104167 | ** This function is now an anachronism. It used to be used to recover from a |
| 104168 | ** malloc() failure, but SQLite now does this automatically. |
| 104169 | */ |
| 104170 | SQLITE_API int sqlite3_global_recover(void){ |
| 104171 | return SQLITE_OK; |
| 104172 | } |
| 104173 | #endif |
| 104174 | |
| 104175 | /* |
| 104176 | ** Test to see whether or not the database connection is in autocommit |
| 104177 | ** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on |
| 104178 |
+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-06 20:37:10 5621862b0e2fc945ded51f5926a6b4c9f07d0ab7" | |
| 112 | +#define SQLITE_SOURCE_ID "2010-07-07 14:45:41 8eefc287265443ec043bdab629597e79c9d22006" | |
| 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-06 20:37:10 5621862b0e2fc945ded51f5926a6b4c9f07d0ab7" |
| 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-07 14:45:41 8eefc287265443ec043bdab629597e79c9d22006" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| 118 |