Fossil SCM
Update to the latest version of SQLite with WAL support.
Commit
ed1037e22592b5d9106ec5e47e4c0713c464b96c
Parent
83d6065c99a0683…
2 files changed
+120
-79
+13
-12
+120
-79
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -636,11 +636,11 @@ | ||
| 636 | 636 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 637 | 637 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 638 | 638 | */ |
| 639 | 639 | #define SQLITE_VERSION "3.7.0" |
| 640 | 640 | #define SQLITE_VERSION_NUMBER 3007000 |
| 641 | -#define SQLITE_SOURCE_ID "2010-06-16 12:30:11 ad3209572d0e6afe5c8b52313e334509661045e2" | |
| 641 | +#define SQLITE_SOURCE_ID "2010-06-21 12:47:41 ee0acef1faffd480fd2136f81fb2b6f6a17b5388" | |
| 642 | 642 | |
| 643 | 643 | /* |
| 644 | 644 | ** CAPI3REF: Run-Time Library Version Numbers |
| 645 | 645 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 646 | 646 | ** |
| @@ -1029,21 +1029,22 @@ | ||
| 1029 | 1029 | ** first then the size of the file is extended, never the other |
| 1030 | 1030 | ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that |
| 1031 | 1031 | ** information is written to disk in the same order as calls |
| 1032 | 1032 | ** to xWrite(). |
| 1033 | 1033 | */ |
| 1034 | -#define SQLITE_IOCAP_ATOMIC 0x00000001 | |
| 1035 | -#define SQLITE_IOCAP_ATOMIC512 0x00000002 | |
| 1036 | -#define SQLITE_IOCAP_ATOMIC1K 0x00000004 | |
| 1037 | -#define SQLITE_IOCAP_ATOMIC2K 0x00000008 | |
| 1038 | -#define SQLITE_IOCAP_ATOMIC4K 0x00000010 | |
| 1039 | -#define SQLITE_IOCAP_ATOMIC8K 0x00000020 | |
| 1040 | -#define SQLITE_IOCAP_ATOMIC16K 0x00000040 | |
| 1041 | -#define SQLITE_IOCAP_ATOMIC32K 0x00000080 | |
| 1042 | -#define SQLITE_IOCAP_ATOMIC64K 0x00000100 | |
| 1043 | -#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 | |
| 1044 | -#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 | |
| 1034 | +#define SQLITE_IOCAP_ATOMIC 0x00000001 | |
| 1035 | +#define SQLITE_IOCAP_ATOMIC512 0x00000002 | |
| 1036 | +#define SQLITE_IOCAP_ATOMIC1K 0x00000004 | |
| 1037 | +#define SQLITE_IOCAP_ATOMIC2K 0x00000008 | |
| 1038 | +#define SQLITE_IOCAP_ATOMIC4K 0x00000010 | |
| 1039 | +#define SQLITE_IOCAP_ATOMIC8K 0x00000020 | |
| 1040 | +#define SQLITE_IOCAP_ATOMIC16K 0x00000040 | |
| 1041 | +#define SQLITE_IOCAP_ATOMIC32K 0x00000080 | |
| 1042 | +#define SQLITE_IOCAP_ATOMIC64K 0x00000100 | |
| 1043 | +#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 | |
| 1044 | +#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 | |
| 1045 | +#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 | |
| 1045 | 1046 | |
| 1046 | 1047 | /* |
| 1047 | 1048 | ** CAPI3REF: File Locking Levels |
| 1048 | 1049 | ** |
| 1049 | 1050 | ** SQLite uses one of these integer values as the second |
| @@ -25680,23 +25681,25 @@ | ||
| 25680 | 25681 | p->pInode->pShmNode = 0; |
| 25681 | 25682 | sqlite3_free(p); |
| 25682 | 25683 | } |
| 25683 | 25684 | } |
| 25684 | 25685 | |
| 25685 | -/* Forward reference */ | |
| 25686 | -static const char *unixTempFileDir(int); | |
| 25687 | - | |
| 25688 | 25686 | /* |
| 25689 | -** Open a shared-memory area. This particular implementation uses | |
| 25690 | -** mmapped files. | |
| 25687 | +** Open a shared-memory area associated with open database file fd. | |
| 25688 | +** This particular implementation uses mmapped files. | |
| 25691 | 25689 | ** |
| 25692 | -** zName is a filename used to identify the shared-memory area. The | |
| 25693 | -** implementation does not (and perhaps should not) use this name | |
| 25694 | -** directly, but rather use it as a template for finding an appropriate | |
| 25695 | -** name for the shared-memory storage. In this implementation, the | |
| 25696 | -** string "-index" is appended to zName and used as the name of the | |
| 25697 | -** mmapped file. | |
| 25690 | +** The file used to implement shared-memory is in the same directory | |
| 25691 | +** as the open database file and has the same name as the open database | |
| 25692 | +** file with the "-shm" suffix added. For example, if the database file | |
| 25693 | +** is "/home/user1/config.db" then the file that is created and mmapped | |
| 25694 | +** for shared memory will be called "/home/user1/config.db-shm". We | |
| 25695 | +** experimented with using files in /dev/tmp or an some other tmpfs mount. | |
| 25696 | +** But if a file in a different directory from the database file is used, | |
| 25697 | +** then differing access permissions or a chroot() might cause two different | |
| 25698 | +** processes on the same database to end up using different files for | |
| 25699 | +** shared memory - meaning that their memory would not really be shared - | |
| 25700 | +** resulting in database corruption. | |
| 25698 | 25701 | ** |
| 25699 | 25702 | ** When opening a new shared-memory file, if no other instances of that |
| 25700 | 25703 | ** file are currently open, in this process or in other processes, then |
| 25701 | 25704 | ** the file must be truncated to zero length or have its header cleared. |
| 25702 | 25705 | */ |
| @@ -25706,12 +25709,12 @@ | ||
| 25706 | 25709 | struct unixShm *p = 0; /* The connection to be opened */ |
| 25707 | 25710 | struct unixShmNode *pShmNode = 0; /* The underlying mmapped file */ |
| 25708 | 25711 | int rc; /* Result code */ |
| 25709 | 25712 | struct unixFile *pDbFd; /* Underlying database file */ |
| 25710 | 25713 | unixInodeInfo *pInode; /* The inode of fd */ |
| 25711 | - const char *zTempDir; /* Directory for temporary files */ | |
| 25712 | - int nTempDir; /* Size of the zTempDir string */ | |
| 25714 | + char *zShmFilename; /* Name of the file used for SHM */ | |
| 25715 | + int nShmFilename; /* Size of the SHM filename in bytes */ | |
| 25713 | 25716 | |
| 25714 | 25717 | /* Allocate space for the new sqlite3_shm object. |
| 25715 | 25718 | */ |
| 25716 | 25719 | p = sqlite3_malloc( sizeof(*p) ); |
| 25717 | 25720 | if( p==0 ) return SQLITE_NOMEM; |
| @@ -25724,37 +25727,29 @@ | ||
| 25724 | 25727 | */ |
| 25725 | 25728 | unixEnterMutex(); |
| 25726 | 25729 | pInode = pDbFd->pInode; |
| 25727 | 25730 | pShmNode = pInode->pShmNode; |
| 25728 | 25731 | if( pShmNode==0 ){ |
| 25729 | - zTempDir = unixTempFileDir(1); | |
| 25730 | - if( zTempDir==0 ){ | |
| 25731 | - unixLeaveMutex(); | |
| 25732 | - sqlite3_free(p); | |
| 25733 | - return SQLITE_CANTOPEN_NOTEMPDIR; | |
| 25734 | - } | |
| 25735 | - nTempDir = strlen(zTempDir); | |
| 25736 | - pShmNode = sqlite3_malloc( sizeof(*pShmNode) + nTempDir + 50 ); | |
| 25732 | + nShmFilename = 5 + (int)strlen(pDbFd->zPath); | |
| 25733 | + pShmNode = sqlite3_malloc( sizeof(*pShmNode) + nShmFilename ); | |
| 25737 | 25734 | if( pShmNode==0 ){ |
| 25738 | 25735 | rc = SQLITE_NOMEM; |
| 25739 | 25736 | goto shm_open_err; |
| 25740 | 25737 | } |
| 25741 | 25738 | memset(pShmNode, 0, sizeof(*pShmNode)); |
| 25742 | - pShmNode->zFilename = (char*)&pShmNode[1]; | |
| 25743 | - sqlite3_snprintf(nTempDir+50, pShmNode->zFilename, | |
| 25744 | - "%s/sqlite-wi-%x-%x", zTempDir, | |
| 25745 | - (u32)pInode->fileId.dev, (u32)pInode->fileId.ino); | |
| 25739 | + zShmFilename = pShmNode->zFilename = (char*)&pShmNode[1]; | |
| 25740 | + sqlite3_snprintf(nShmFilename, zShmFilename, "%s-shm", pDbFd->zPath); | |
| 25746 | 25741 | pShmNode->h = -1; |
| 25747 | 25742 | pDbFd->pInode->pShmNode = pShmNode; |
| 25748 | 25743 | pShmNode->pInode = pDbFd->pInode; |
| 25749 | 25744 | pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); |
| 25750 | 25745 | if( pShmNode->mutex==0 ){ |
| 25751 | 25746 | rc = SQLITE_NOMEM; |
| 25752 | 25747 | goto shm_open_err; |
| 25753 | 25748 | } |
| 25754 | 25749 | |
| 25755 | - pShmNode->h = open(pShmNode->zFilename, O_RDWR|O_CREAT, 0664); | |
| 25750 | + pShmNode->h = open(zShmFilename, O_RDWR|O_CREAT, 0664); | |
| 25756 | 25751 | if( pShmNode->h<0 ){ |
| 25757 | 25752 | rc = SQLITE_CANTOPEN_BKPT; |
| 25758 | 25753 | goto shm_open_err; |
| 25759 | 25754 | } |
| 25760 | 25755 | |
| @@ -26563,11 +26558,11 @@ | ||
| 26563 | 26558 | |
| 26564 | 26559 | /* |
| 26565 | 26560 | ** Return the name of a directory in which to put temporary files. |
| 26566 | 26561 | ** If no suitable temporary file directory can be found, return NULL. |
| 26567 | 26562 | */ |
| 26568 | -static const char *unixTempFileDir(int allowShm){ | |
| 26563 | +static const char *unixTempFileDir(void){ | |
| 26569 | 26564 | static const char *azDirs[] = { |
| 26570 | 26565 | 0, |
| 26571 | 26566 | 0, |
| 26572 | 26567 | "/var/tmp", |
| 26573 | 26568 | "/usr/tmp", |
| @@ -26578,23 +26573,15 @@ | ||
| 26578 | 26573 | struct stat buf; |
| 26579 | 26574 | const char *zDir = 0; |
| 26580 | 26575 | |
| 26581 | 26576 | azDirs[0] = sqlite3_temp_directory; |
| 26582 | 26577 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 26583 | - | |
| 26584 | - if( allowShm ){ | |
| 26585 | - zDir = "/dev/shm"; | |
| 26586 | - i = 2; /* Skip the app-defined temp locations for shared-memory */ | |
| 26587 | - }else{ | |
| 26588 | - zDir = azDirs[0]; | |
| 26589 | - i = 1; | |
| 26590 | - } | |
| 26591 | - for(; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ | |
| 26578 | + for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ | |
| 26592 | 26579 | if( zDir==0 ) continue; |
| 26593 | 26580 | if( stat(zDir, &buf) ) continue; |
| 26594 | 26581 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 26595 | - if( !allowShm && access(zDir, 07) ) continue; | |
| 26582 | + if( access(zDir, 07) ) continue; | |
| 26596 | 26583 | break; |
| 26597 | 26584 | } |
| 26598 | 26585 | return zDir; |
| 26599 | 26586 | } |
| 26600 | 26587 | |
| @@ -26615,11 +26602,11 @@ | ||
| 26615 | 26602 | ** using the io-error infrastructure to test that SQLite handles this |
| 26616 | 26603 | ** function failing. |
| 26617 | 26604 | */ |
| 26618 | 26605 | SimulateIOError( return SQLITE_IOERR ); |
| 26619 | 26606 | |
| 26620 | - zDir = unixTempFileDir(0); | |
| 26607 | + zDir = unixTempFileDir(); | |
| 26621 | 26608 | if( zDir==0 ) zDir = "."; |
| 26622 | 26609 | |
| 26623 | 26610 | /* Check that the output buffer is large enough for the temporary file |
| 26624 | 26611 | ** name. If it is not, return SQLITE_ERROR. |
| 26625 | 26612 | */ |
| @@ -27024,10 +27011,16 @@ | ||
| 27024 | 27011 | |
| 27025 | 27012 | default: |
| 27026 | 27013 | assert(!"Invalid flags argument"); |
| 27027 | 27014 | } |
| 27028 | 27015 | *pResOut = (access(zPath, amode)==0); |
| 27016 | + if( flags==SQLITE_ACCESS_EXISTS && *pResOut ){ | |
| 27017 | + struct stat buf; | |
| 27018 | + if( 0==stat(zPath, &buf) && buf.st_size==0 ){ | |
| 27019 | + *pResOut = 0; | |
| 27020 | + } | |
| 27021 | + } | |
| 27029 | 27022 | return SQLITE_OK; |
| 27030 | 27023 | } |
| 27031 | 27024 | |
| 27032 | 27025 | |
| 27033 | 27026 | /* |
| @@ -29906,11 +29899,11 @@ | ||
| 29906 | 29899 | /* |
| 29907 | 29900 | ** Return a vector of device characteristics. |
| 29908 | 29901 | */ |
| 29909 | 29902 | static int winDeviceCharacteristics(sqlite3_file *id){ |
| 29910 | 29903 | UNUSED_PARAMETER(id); |
| 29911 | - return 0; | |
| 29904 | + return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; | |
| 29912 | 29905 | } |
| 29913 | 29906 | |
| 29914 | 29907 | /**************************************************************************** |
| 29915 | 29908 | ********************************* Shared Memory ***************************** |
| 29916 | 29909 | ** |
| @@ -34777,16 +34770,28 @@ | ||
| 34777 | 34770 | ** treated as a hot-journal and rolled back. |
| 34778 | 34771 | */ |
| 34779 | 34772 | static void pager_unlock(Pager *pPager){ |
| 34780 | 34773 | if( !pPager->exclusiveMode ){ |
| 34781 | 34774 | int rc = SQLITE_OK; /* Return code */ |
| 34775 | + int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0; | |
| 34782 | 34776 | |
| 34783 | 34777 | /* Always close the journal file when dropping the database lock. |
| 34784 | 34778 | ** Otherwise, another connection with journal_mode=delete might |
| 34785 | 34779 | ** delete the file out from under us. |
| 34786 | 34780 | */ |
| 34787 | - sqlite3OsClose(pPager->jfd); | |
| 34781 | + assert( (PAGER_JOURNALMODE_MEMORY & 5)!=1 ); | |
| 34782 | + assert( (PAGER_JOURNALMODE_OFF & 5)!=1 ); | |
| 34783 | + assert( (PAGER_JOURNALMODE_WAL & 5)!=1 ); | |
| 34784 | + assert( (PAGER_JOURNALMODE_DELETE & 5)!=1 ); | |
| 34785 | + assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 ); | |
| 34786 | + assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 ); | |
| 34787 | + if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN) | |
| 34788 | + || 1!=(pPager->journalMode & 5) | |
| 34789 | + ){ | |
| 34790 | + sqlite3OsClose(pPager->jfd); | |
| 34791 | + } | |
| 34792 | + | |
| 34788 | 34793 | sqlite3BitvecDestroy(pPager->pInJournal); |
| 34789 | 34794 | pPager->pInJournal = 0; |
| 34790 | 34795 | releaseAllSavepoints(pPager); |
| 34791 | 34796 | |
| 34792 | 34797 | /* If the file is unlocked, somebody else might change it. The |
| @@ -36673,10 +36678,11 @@ | ||
| 36673 | 36678 | } |
| 36674 | 36679 | sqlite3EndBenignMalloc(); |
| 36675 | 36680 | enable_simulated_io_errors(); |
| 36676 | 36681 | PAGERTRACE(("CLOSE %d\n", PAGERID(pPager))); |
| 36677 | 36682 | IOTRACE(("CLOSE %p\n", pPager)) |
| 36683 | + sqlite3OsClose(pPager->jfd); | |
| 36678 | 36684 | sqlite3OsClose(pPager->fd); |
| 36679 | 36685 | sqlite3PageFree(pTmp); |
| 36680 | 36686 | sqlite3PcacheClose(pPager->pPCache); |
| 36681 | 36687 | |
| 36682 | 36688 | #ifdef SQLITE_HAS_CODEC |
| @@ -37466,21 +37472,26 @@ | ||
| 37466 | 37472 | ** to determine whether or not a hot-journal file exists, the IO error |
| 37467 | 37473 | ** code is returned and the value of *pExists is undefined. |
| 37468 | 37474 | */ |
| 37469 | 37475 | static int hasHotJournal(Pager *pPager, int *pExists){ |
| 37470 | 37476 | sqlite3_vfs * const pVfs = pPager->pVfs; |
| 37471 | - int rc; /* Return code */ | |
| 37472 | - int exists; /* True if a journal file is present */ | |
| 37477 | + int rc = SQLITE_OK; /* Return code */ | |
| 37478 | + int exists = 1; /* True if a journal file is present */ | |
| 37479 | + int jrnlOpen = !!isOpen(pPager->jfd); | |
| 37473 | 37480 | |
| 37474 | 37481 | assert( pPager!=0 ); |
| 37475 | 37482 | assert( pPager->useJournal ); |
| 37476 | 37483 | assert( isOpen(pPager->fd) ); |
| 37477 | - assert( !isOpen(pPager->jfd) ); | |
| 37478 | 37484 | assert( pPager->state <= PAGER_SHARED ); |
| 37485 | + assert( jrnlOpen==0 || ( sqlite3OsDeviceCharacteristics(pPager->jfd) & | |
| 37486 | + SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN | |
| 37487 | + )); | |
| 37479 | 37488 | |
| 37480 | 37489 | *pExists = 0; |
| 37481 | - rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); | |
| 37490 | + if( !jrnlOpen ){ | |
| 37491 | + rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); | |
| 37492 | + } | |
| 37482 | 37493 | if( rc==SQLITE_OK && exists ){ |
| 37483 | 37494 | int locked; /* True if some process holds a RESERVED lock */ |
| 37484 | 37495 | |
| 37485 | 37496 | /* Race condition here: Another process might have been holding the |
| 37486 | 37497 | ** the RESERVED lock and have a journal open at the sqlite3OsAccess() |
| @@ -37514,19 +37525,23 @@ | ||
| 37514 | 37525 | ** or greater lock on the database file. Now check that there is |
| 37515 | 37526 | ** at least one non-zero bytes at the start of the journal file. |
| 37516 | 37527 | ** If there is, then we consider this journal to be hot. If not, |
| 37517 | 37528 | ** it can be ignored. |
| 37518 | 37529 | */ |
| 37519 | - int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL; | |
| 37520 | - rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f); | |
| 37530 | + if( !jrnlOpen ){ | |
| 37531 | + int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL; | |
| 37532 | + rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f); | |
| 37533 | + } | |
| 37521 | 37534 | if( rc==SQLITE_OK ){ |
| 37522 | 37535 | u8 first = 0; |
| 37523 | 37536 | rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0); |
| 37524 | 37537 | if( rc==SQLITE_IOERR_SHORT_READ ){ |
| 37525 | 37538 | rc = SQLITE_OK; |
| 37526 | 37539 | } |
| 37527 | - sqlite3OsClose(pPager->jfd); | |
| 37540 | + if( !jrnlOpen ){ | |
| 37541 | + sqlite3OsClose(pPager->jfd); | |
| 37542 | + } | |
| 37528 | 37543 | *pExists = (first!=0); |
| 37529 | 37544 | }else if( rc==SQLITE_CANTOPEN ){ |
| 37530 | 37545 | /* If we cannot open the rollback journal file in order to see if |
| 37531 | 37546 | ** its has a zero header, that might be due to an I/O error, or |
| 37532 | 37547 | ** it might be due to the race condition described above and in |
| @@ -39437,21 +39452,49 @@ | ||
| 39437 | 39452 | |
| 39438 | 39453 | /* Change the journal mode. */ |
| 39439 | 39454 | pPager->journalMode = (u8)eMode; |
| 39440 | 39455 | |
| 39441 | 39456 | /* When transistioning from TRUNCATE or PERSIST to any other journal |
| 39442 | - ** mode (and we are not in locking_mode=EXCLUSIVE) then delete the | |
| 39443 | - ** journal file. | |
| 39457 | + ** mode except WAL (and we are not in locking_mode=EXCLUSIVE) then | |
| 39458 | + ** delete the journal file. | |
| 39444 | 39459 | */ |
| 39445 | 39460 | assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 ); |
| 39446 | 39461 | assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 ); |
| 39447 | - assert( (PAGER_JOURNALMODE_DELETE & 5)!=1 ); | |
| 39448 | - assert( (PAGER_JOURNALMODE_MEMORY & 5)!=1 ); | |
| 39449 | - assert( (PAGER_JOURNALMODE_OFF & 5)!=1 ); | |
| 39450 | - assert( (PAGER_JOURNALMODE_WAL & 5)!=1 ); | |
| 39451 | - if( (eOld & 5)==1 && (eMode & 5)!=1 && !pPager->exclusiveMode ){ | |
| 39452 | - sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); | |
| 39462 | + assert( (PAGER_JOURNALMODE_DELETE & 5)==0 ); | |
| 39463 | + assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 ); | |
| 39464 | + assert( (PAGER_JOURNALMODE_OFF & 5)==0 ); | |
| 39465 | + assert( (PAGER_JOURNALMODE_WAL & 5)==5 ); | |
| 39466 | + | |
| 39467 | + assert( isOpen(pPager->fd) || pPager->exclusiveMode ); | |
| 39468 | + if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){ | |
| 39469 | + | |
| 39470 | + /* In this case we would like to delete the journal file. If it is | |
| 39471 | + ** not possible, then that is not a problem. Deleting the journal file | |
| 39472 | + ** here is an optimization only. | |
| 39473 | + ** | |
| 39474 | + ** Before deleting the journal file, obtain a RESERVED lock on the | |
| 39475 | + ** database file. This ensures that the journal file is not deleted | |
| 39476 | + ** while it is in use by some other client. | |
| 39477 | + */ | |
| 39478 | + int rc = SQLITE_OK; | |
| 39479 | + int state = pPager->state; | |
| 39480 | + if( state<PAGER_SHARED ){ | |
| 39481 | + rc = sqlite3PagerSharedLock(pPager); | |
| 39482 | + } | |
| 39483 | + if( pPager->state==PAGER_SHARED ){ | |
| 39484 | + assert( rc==SQLITE_OK ); | |
| 39485 | + rc = sqlite3OsLock(pPager->fd, RESERVED_LOCK); | |
| 39486 | + } | |
| 39487 | + if( rc==SQLITE_OK ){ | |
| 39488 | + sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); | |
| 39489 | + } | |
| 39490 | + if( rc==SQLITE_OK && state==PAGER_SHARED ){ | |
| 39491 | + sqlite3OsUnlock(pPager->fd, SHARED_LOCK); | |
| 39492 | + }else if( state==PAGER_UNLOCK ){ | |
| 39493 | + pager_unlock(pPager); | |
| 39494 | + } | |
| 39495 | + assert( state==pPager->state ); | |
| 39453 | 39496 | } |
| 39454 | 39497 | } |
| 39455 | 39498 | |
| 39456 | 39499 | /* Return the new journal mode */ |
| 39457 | 39500 | return (int)pPager->journalMode; |
| @@ -63307,36 +63350,30 @@ | ||
| 63307 | 63350 | ** after a successful return. |
| 63308 | 63351 | */ |
| 63309 | 63352 | rc = sqlite3PagerCloseWal(u.cd.pPager); |
| 63310 | 63353 | if( rc==SQLITE_OK ){ |
| 63311 | 63354 | sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63312 | - }else if( rc==SQLITE_BUSY && pOp->p5==0 ){ | |
| 63313 | - goto abort_due_to_error; | |
| 63314 | 63355 | } |
| 63315 | - }else{ | |
| 63316 | - sqlite3PagerSetJournalMode(u.cd.pPager, PAGER_JOURNALMODE_DELETE); | |
| 63317 | - rc = SQLITE_OK; | |
| 63318 | 63356 | } |
| 63319 | 63357 | |
| 63320 | 63358 | /* Open a transaction on the database file. Regardless of the journal |
| 63321 | 63359 | ** mode, this transaction always uses a rollback journal. |
| 63322 | 63360 | */ |
| 63323 | 63361 | assert( sqlite3BtreeIsInTrans(u.cd.pBt)==0 ); |
| 63324 | 63362 | if( rc==SQLITE_OK ){ |
| 63325 | - rc = sqlite3BtreeSetVersion(u.cd.pBt, | |
| 63326 | - (u.cd.eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); | |
| 63327 | - if( rc==SQLITE_BUSY && pOp->p5==0 ) goto abort_due_to_error; | |
| 63328 | - } | |
| 63329 | - if( rc==SQLITE_BUSY ){ | |
| 63330 | - u.cd.eNew = u.cd.eOld; | |
| 63331 | - rc = SQLITE_OK; | |
| 63363 | + rc = sqlite3BtreeSetVersion(u.cd.pBt, (u.cd.eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); | |
| 63332 | 63364 | } |
| 63333 | 63365 | } |
| 63334 | 63366 | } |
| 63335 | 63367 | #endif /* ifndef SQLITE_OMIT_WAL */ |
| 63336 | 63368 | |
| 63369 | + if( rc ){ | |
| 63370 | + if( rc==SQLITE_BUSY && pOp->p5!=0 ) rc = SQLITE_OK; | |
| 63371 | + u.cd.eNew = u.cd.eOld; | |
| 63372 | + } | |
| 63337 | 63373 | u.cd.eNew = sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63374 | + | |
| 63338 | 63375 | pOut = &aMem[pOp->p2]; |
| 63339 | 63376 | pOut->flags = MEM_Str|MEM_Static|MEM_Term; |
| 63340 | 63377 | pOut->z = (char *)sqlite3JournalModename(u.cd.eNew); |
| 63341 | 63378 | pOut->n = sqlite3Strlen30(pOut->z); |
| 63342 | 63379 | pOut->enc = SQLITE_UTF8; |
| @@ -64146,14 +64183,18 @@ | ||
| 64146 | 64183 | |
| 64147 | 64184 | /* Make sure a mutex is held on the table to be accessed */ |
| 64148 | 64185 | sqlite3VdbeUsesBtree(v, iDb); |
| 64149 | 64186 | |
| 64150 | 64187 | /* Configure the OP_TableLock instruction */ |
| 64188 | +#ifdef SQLITE_OMIT_SHARED_CACHE | |
| 64189 | + sqlite3VdbeChangeToNoop(v, 2, 1); | |
| 64190 | +#else | |
| 64151 | 64191 | sqlite3VdbeChangeP1(v, 2, iDb); |
| 64152 | 64192 | sqlite3VdbeChangeP2(v, 2, pTab->tnum); |
| 64153 | 64193 | sqlite3VdbeChangeP3(v, 2, flags); |
| 64154 | 64194 | sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT); |
| 64195 | +#endif | |
| 64155 | 64196 | |
| 64156 | 64197 | /* Remove either the OP_OpenWrite or OpenRead. Set the P2 |
| 64157 | 64198 | ** parameter of the other to pTab->tnum. */ |
| 64158 | 64199 | sqlite3VdbeChangeToNoop(v, 4 - flags, 1); |
| 64159 | 64200 | sqlite3VdbeChangeP2(v, 3 + flags, pTab->tnum); |
| 64160 | 64201 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -636,11 +636,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-06-16 12:30:11 ad3209572d0e6afe5c8b52313e334509661045e2" |
| 642 | |
| 643 | /* |
| 644 | ** CAPI3REF: Run-Time Library Version Numbers |
| 645 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 646 | ** |
| @@ -1029,21 +1029,22 @@ | |
| 1029 | ** first then the size of the file is extended, never the other |
| 1030 | ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that |
| 1031 | ** information is written to disk in the same order as calls |
| 1032 | ** to xWrite(). |
| 1033 | */ |
| 1034 | #define SQLITE_IOCAP_ATOMIC 0x00000001 |
| 1035 | #define SQLITE_IOCAP_ATOMIC512 0x00000002 |
| 1036 | #define SQLITE_IOCAP_ATOMIC1K 0x00000004 |
| 1037 | #define SQLITE_IOCAP_ATOMIC2K 0x00000008 |
| 1038 | #define SQLITE_IOCAP_ATOMIC4K 0x00000010 |
| 1039 | #define SQLITE_IOCAP_ATOMIC8K 0x00000020 |
| 1040 | #define SQLITE_IOCAP_ATOMIC16K 0x00000040 |
| 1041 | #define SQLITE_IOCAP_ATOMIC32K 0x00000080 |
| 1042 | #define SQLITE_IOCAP_ATOMIC64K 0x00000100 |
| 1043 | #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 |
| 1044 | #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 |
| 1045 | |
| 1046 | /* |
| 1047 | ** CAPI3REF: File Locking Levels |
| 1048 | ** |
| 1049 | ** SQLite uses one of these integer values as the second |
| @@ -25680,23 +25681,25 @@ | |
| 25680 | p->pInode->pShmNode = 0; |
| 25681 | sqlite3_free(p); |
| 25682 | } |
| 25683 | } |
| 25684 | |
| 25685 | /* Forward reference */ |
| 25686 | static const char *unixTempFileDir(int); |
| 25687 | |
| 25688 | /* |
| 25689 | ** Open a shared-memory area. This particular implementation uses |
| 25690 | ** mmapped files. |
| 25691 | ** |
| 25692 | ** zName is a filename used to identify the shared-memory area. The |
| 25693 | ** implementation does not (and perhaps should not) use this name |
| 25694 | ** directly, but rather use it as a template for finding an appropriate |
| 25695 | ** name for the shared-memory storage. In this implementation, the |
| 25696 | ** string "-index" is appended to zName and used as the name of the |
| 25697 | ** mmapped file. |
| 25698 | ** |
| 25699 | ** When opening a new shared-memory file, if no other instances of that |
| 25700 | ** file are currently open, in this process or in other processes, then |
| 25701 | ** the file must be truncated to zero length or have its header cleared. |
| 25702 | */ |
| @@ -25706,12 +25709,12 @@ | |
| 25706 | struct unixShm *p = 0; /* The connection to be opened */ |
| 25707 | struct unixShmNode *pShmNode = 0; /* The underlying mmapped file */ |
| 25708 | int rc; /* Result code */ |
| 25709 | struct unixFile *pDbFd; /* Underlying database file */ |
| 25710 | unixInodeInfo *pInode; /* The inode of fd */ |
| 25711 | const char *zTempDir; /* Directory for temporary files */ |
| 25712 | int nTempDir; /* Size of the zTempDir string */ |
| 25713 | |
| 25714 | /* Allocate space for the new sqlite3_shm object. |
| 25715 | */ |
| 25716 | p = sqlite3_malloc( sizeof(*p) ); |
| 25717 | if( p==0 ) return SQLITE_NOMEM; |
| @@ -25724,37 +25727,29 @@ | |
| 25724 | */ |
| 25725 | unixEnterMutex(); |
| 25726 | pInode = pDbFd->pInode; |
| 25727 | pShmNode = pInode->pShmNode; |
| 25728 | if( pShmNode==0 ){ |
| 25729 | zTempDir = unixTempFileDir(1); |
| 25730 | if( zTempDir==0 ){ |
| 25731 | unixLeaveMutex(); |
| 25732 | sqlite3_free(p); |
| 25733 | return SQLITE_CANTOPEN_NOTEMPDIR; |
| 25734 | } |
| 25735 | nTempDir = strlen(zTempDir); |
| 25736 | pShmNode = sqlite3_malloc( sizeof(*pShmNode) + nTempDir + 50 ); |
| 25737 | if( pShmNode==0 ){ |
| 25738 | rc = SQLITE_NOMEM; |
| 25739 | goto shm_open_err; |
| 25740 | } |
| 25741 | memset(pShmNode, 0, sizeof(*pShmNode)); |
| 25742 | pShmNode->zFilename = (char*)&pShmNode[1]; |
| 25743 | sqlite3_snprintf(nTempDir+50, pShmNode->zFilename, |
| 25744 | "%s/sqlite-wi-%x-%x", zTempDir, |
| 25745 | (u32)pInode->fileId.dev, (u32)pInode->fileId.ino); |
| 25746 | pShmNode->h = -1; |
| 25747 | pDbFd->pInode->pShmNode = pShmNode; |
| 25748 | pShmNode->pInode = pDbFd->pInode; |
| 25749 | pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); |
| 25750 | if( pShmNode->mutex==0 ){ |
| 25751 | rc = SQLITE_NOMEM; |
| 25752 | goto shm_open_err; |
| 25753 | } |
| 25754 | |
| 25755 | pShmNode->h = open(pShmNode->zFilename, O_RDWR|O_CREAT, 0664); |
| 25756 | if( pShmNode->h<0 ){ |
| 25757 | rc = SQLITE_CANTOPEN_BKPT; |
| 25758 | goto shm_open_err; |
| 25759 | } |
| 25760 | |
| @@ -26563,11 +26558,11 @@ | |
| 26563 | |
| 26564 | /* |
| 26565 | ** Return the name of a directory in which to put temporary files. |
| 26566 | ** If no suitable temporary file directory can be found, return NULL. |
| 26567 | */ |
| 26568 | static const char *unixTempFileDir(int allowShm){ |
| 26569 | static const char *azDirs[] = { |
| 26570 | 0, |
| 26571 | 0, |
| 26572 | "/var/tmp", |
| 26573 | "/usr/tmp", |
| @@ -26578,23 +26573,15 @@ | |
| 26578 | struct stat buf; |
| 26579 | const char *zDir = 0; |
| 26580 | |
| 26581 | azDirs[0] = sqlite3_temp_directory; |
| 26582 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 26583 | |
| 26584 | if( allowShm ){ |
| 26585 | zDir = "/dev/shm"; |
| 26586 | i = 2; /* Skip the app-defined temp locations for shared-memory */ |
| 26587 | }else{ |
| 26588 | zDir = azDirs[0]; |
| 26589 | i = 1; |
| 26590 | } |
| 26591 | for(; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ |
| 26592 | if( zDir==0 ) continue; |
| 26593 | if( stat(zDir, &buf) ) continue; |
| 26594 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 26595 | if( !allowShm && access(zDir, 07) ) continue; |
| 26596 | break; |
| 26597 | } |
| 26598 | return zDir; |
| 26599 | } |
| 26600 | |
| @@ -26615,11 +26602,11 @@ | |
| 26615 | ** using the io-error infrastructure to test that SQLite handles this |
| 26616 | ** function failing. |
| 26617 | */ |
| 26618 | SimulateIOError( return SQLITE_IOERR ); |
| 26619 | |
| 26620 | zDir = unixTempFileDir(0); |
| 26621 | if( zDir==0 ) zDir = "."; |
| 26622 | |
| 26623 | /* Check that the output buffer is large enough for the temporary file |
| 26624 | ** name. If it is not, return SQLITE_ERROR. |
| 26625 | */ |
| @@ -27024,10 +27011,16 @@ | |
| 27024 | |
| 27025 | default: |
| 27026 | assert(!"Invalid flags argument"); |
| 27027 | } |
| 27028 | *pResOut = (access(zPath, amode)==0); |
| 27029 | return SQLITE_OK; |
| 27030 | } |
| 27031 | |
| 27032 | |
| 27033 | /* |
| @@ -29906,11 +29899,11 @@ | |
| 29906 | /* |
| 29907 | ** Return a vector of device characteristics. |
| 29908 | */ |
| 29909 | static int winDeviceCharacteristics(sqlite3_file *id){ |
| 29910 | UNUSED_PARAMETER(id); |
| 29911 | return 0; |
| 29912 | } |
| 29913 | |
| 29914 | /**************************************************************************** |
| 29915 | ********************************* Shared Memory ***************************** |
| 29916 | ** |
| @@ -34777,16 +34770,28 @@ | |
| 34777 | ** treated as a hot-journal and rolled back. |
| 34778 | */ |
| 34779 | static void pager_unlock(Pager *pPager){ |
| 34780 | if( !pPager->exclusiveMode ){ |
| 34781 | int rc = SQLITE_OK; /* Return code */ |
| 34782 | |
| 34783 | /* Always close the journal file when dropping the database lock. |
| 34784 | ** Otherwise, another connection with journal_mode=delete might |
| 34785 | ** delete the file out from under us. |
| 34786 | */ |
| 34787 | sqlite3OsClose(pPager->jfd); |
| 34788 | sqlite3BitvecDestroy(pPager->pInJournal); |
| 34789 | pPager->pInJournal = 0; |
| 34790 | releaseAllSavepoints(pPager); |
| 34791 | |
| 34792 | /* If the file is unlocked, somebody else might change it. The |
| @@ -36673,10 +36678,11 @@ | |
| 36673 | } |
| 36674 | sqlite3EndBenignMalloc(); |
| 36675 | enable_simulated_io_errors(); |
| 36676 | PAGERTRACE(("CLOSE %d\n", PAGERID(pPager))); |
| 36677 | IOTRACE(("CLOSE %p\n", pPager)) |
| 36678 | sqlite3OsClose(pPager->fd); |
| 36679 | sqlite3PageFree(pTmp); |
| 36680 | sqlite3PcacheClose(pPager->pPCache); |
| 36681 | |
| 36682 | #ifdef SQLITE_HAS_CODEC |
| @@ -37466,21 +37472,26 @@ | |
| 37466 | ** to determine whether or not a hot-journal file exists, the IO error |
| 37467 | ** code is returned and the value of *pExists is undefined. |
| 37468 | */ |
| 37469 | static int hasHotJournal(Pager *pPager, int *pExists){ |
| 37470 | sqlite3_vfs * const pVfs = pPager->pVfs; |
| 37471 | int rc; /* Return code */ |
| 37472 | int exists; /* True if a journal file is present */ |
| 37473 | |
| 37474 | assert( pPager!=0 ); |
| 37475 | assert( pPager->useJournal ); |
| 37476 | assert( isOpen(pPager->fd) ); |
| 37477 | assert( !isOpen(pPager->jfd) ); |
| 37478 | assert( pPager->state <= PAGER_SHARED ); |
| 37479 | |
| 37480 | *pExists = 0; |
| 37481 | rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); |
| 37482 | if( rc==SQLITE_OK && exists ){ |
| 37483 | int locked; /* True if some process holds a RESERVED lock */ |
| 37484 | |
| 37485 | /* Race condition here: Another process might have been holding the |
| 37486 | ** the RESERVED lock and have a journal open at the sqlite3OsAccess() |
| @@ -37514,19 +37525,23 @@ | |
| 37514 | ** or greater lock on the database file. Now check that there is |
| 37515 | ** at least one non-zero bytes at the start of the journal file. |
| 37516 | ** If there is, then we consider this journal to be hot. If not, |
| 37517 | ** it can be ignored. |
| 37518 | */ |
| 37519 | int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL; |
| 37520 | rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f); |
| 37521 | if( rc==SQLITE_OK ){ |
| 37522 | u8 first = 0; |
| 37523 | rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0); |
| 37524 | if( rc==SQLITE_IOERR_SHORT_READ ){ |
| 37525 | rc = SQLITE_OK; |
| 37526 | } |
| 37527 | sqlite3OsClose(pPager->jfd); |
| 37528 | *pExists = (first!=0); |
| 37529 | }else if( rc==SQLITE_CANTOPEN ){ |
| 37530 | /* If we cannot open the rollback journal file in order to see if |
| 37531 | ** its has a zero header, that might be due to an I/O error, or |
| 37532 | ** it might be due to the race condition described above and in |
| @@ -39437,21 +39452,49 @@ | |
| 39437 | |
| 39438 | /* Change the journal mode. */ |
| 39439 | pPager->journalMode = (u8)eMode; |
| 39440 | |
| 39441 | /* When transistioning from TRUNCATE or PERSIST to any other journal |
| 39442 | ** mode (and we are not in locking_mode=EXCLUSIVE) then delete the |
| 39443 | ** journal file. |
| 39444 | */ |
| 39445 | assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 ); |
| 39446 | assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 ); |
| 39447 | assert( (PAGER_JOURNALMODE_DELETE & 5)!=1 ); |
| 39448 | assert( (PAGER_JOURNALMODE_MEMORY & 5)!=1 ); |
| 39449 | assert( (PAGER_JOURNALMODE_OFF & 5)!=1 ); |
| 39450 | assert( (PAGER_JOURNALMODE_WAL & 5)!=1 ); |
| 39451 | if( (eOld & 5)==1 && (eMode & 5)!=1 && !pPager->exclusiveMode ){ |
| 39452 | sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); |
| 39453 | } |
| 39454 | } |
| 39455 | |
| 39456 | /* Return the new journal mode */ |
| 39457 | return (int)pPager->journalMode; |
| @@ -63307,36 +63350,30 @@ | |
| 63307 | ** after a successful return. |
| 63308 | */ |
| 63309 | rc = sqlite3PagerCloseWal(u.cd.pPager); |
| 63310 | if( rc==SQLITE_OK ){ |
| 63311 | sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63312 | }else if( rc==SQLITE_BUSY && pOp->p5==0 ){ |
| 63313 | goto abort_due_to_error; |
| 63314 | } |
| 63315 | }else{ |
| 63316 | sqlite3PagerSetJournalMode(u.cd.pPager, PAGER_JOURNALMODE_DELETE); |
| 63317 | rc = SQLITE_OK; |
| 63318 | } |
| 63319 | |
| 63320 | /* Open a transaction on the database file. Regardless of the journal |
| 63321 | ** mode, this transaction always uses a rollback journal. |
| 63322 | */ |
| 63323 | assert( sqlite3BtreeIsInTrans(u.cd.pBt)==0 ); |
| 63324 | if( rc==SQLITE_OK ){ |
| 63325 | rc = sqlite3BtreeSetVersion(u.cd.pBt, |
| 63326 | (u.cd.eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); |
| 63327 | if( rc==SQLITE_BUSY && pOp->p5==0 ) goto abort_due_to_error; |
| 63328 | } |
| 63329 | if( rc==SQLITE_BUSY ){ |
| 63330 | u.cd.eNew = u.cd.eOld; |
| 63331 | rc = SQLITE_OK; |
| 63332 | } |
| 63333 | } |
| 63334 | } |
| 63335 | #endif /* ifndef SQLITE_OMIT_WAL */ |
| 63336 | |
| 63337 | u.cd.eNew = sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63338 | pOut = &aMem[pOp->p2]; |
| 63339 | pOut->flags = MEM_Str|MEM_Static|MEM_Term; |
| 63340 | pOut->z = (char *)sqlite3JournalModename(u.cd.eNew); |
| 63341 | pOut->n = sqlite3Strlen30(pOut->z); |
| 63342 | pOut->enc = SQLITE_UTF8; |
| @@ -64146,14 +64183,18 @@ | |
| 64146 | |
| 64147 | /* Make sure a mutex is held on the table to be accessed */ |
| 64148 | sqlite3VdbeUsesBtree(v, iDb); |
| 64149 | |
| 64150 | /* Configure the OP_TableLock instruction */ |
| 64151 | sqlite3VdbeChangeP1(v, 2, iDb); |
| 64152 | sqlite3VdbeChangeP2(v, 2, pTab->tnum); |
| 64153 | sqlite3VdbeChangeP3(v, 2, flags); |
| 64154 | sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT); |
| 64155 | |
| 64156 | /* Remove either the OP_OpenWrite or OpenRead. Set the P2 |
| 64157 | ** parameter of the other to pTab->tnum. */ |
| 64158 | sqlite3VdbeChangeToNoop(v, 4 - flags, 1); |
| 64159 | sqlite3VdbeChangeP2(v, 3 + flags, pTab->tnum); |
| 64160 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -636,11 +636,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-06-21 12:47:41 ee0acef1faffd480fd2136f81fb2b6f6a17b5388" |
| 642 | |
| 643 | /* |
| 644 | ** CAPI3REF: Run-Time Library Version Numbers |
| 645 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 646 | ** |
| @@ -1029,21 +1029,22 @@ | |
| 1029 | ** first then the size of the file is extended, never the other |
| 1030 | ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that |
| 1031 | ** information is written to disk in the same order as calls |
| 1032 | ** to xWrite(). |
| 1033 | */ |
| 1034 | #define SQLITE_IOCAP_ATOMIC 0x00000001 |
| 1035 | #define SQLITE_IOCAP_ATOMIC512 0x00000002 |
| 1036 | #define SQLITE_IOCAP_ATOMIC1K 0x00000004 |
| 1037 | #define SQLITE_IOCAP_ATOMIC2K 0x00000008 |
| 1038 | #define SQLITE_IOCAP_ATOMIC4K 0x00000010 |
| 1039 | #define SQLITE_IOCAP_ATOMIC8K 0x00000020 |
| 1040 | #define SQLITE_IOCAP_ATOMIC16K 0x00000040 |
| 1041 | #define SQLITE_IOCAP_ATOMIC32K 0x00000080 |
| 1042 | #define SQLITE_IOCAP_ATOMIC64K 0x00000100 |
| 1043 | #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 |
| 1044 | #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 |
| 1045 | #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 |
| 1046 | |
| 1047 | /* |
| 1048 | ** CAPI3REF: File Locking Levels |
| 1049 | ** |
| 1050 | ** SQLite uses one of these integer values as the second |
| @@ -25680,23 +25681,25 @@ | |
| 25681 | p->pInode->pShmNode = 0; |
| 25682 | sqlite3_free(p); |
| 25683 | } |
| 25684 | } |
| 25685 | |
| 25686 | /* |
| 25687 | ** Open a shared-memory area associated with open database file fd. |
| 25688 | ** This particular implementation uses mmapped files. |
| 25689 | ** |
| 25690 | ** The file used to implement shared-memory is in the same directory |
| 25691 | ** as the open database file and has the same name as the open database |
| 25692 | ** file with the "-shm" suffix added. For example, if the database file |
| 25693 | ** is "/home/user1/config.db" then the file that is created and mmapped |
| 25694 | ** for shared memory will be called "/home/user1/config.db-shm". We |
| 25695 | ** experimented with using files in /dev/tmp or an some other tmpfs mount. |
| 25696 | ** But if a file in a different directory from the database file is used, |
| 25697 | ** then differing access permissions or a chroot() might cause two different |
| 25698 | ** processes on the same database to end up using different files for |
| 25699 | ** shared memory - meaning that their memory would not really be shared - |
| 25700 | ** resulting in database corruption. |
| 25701 | ** |
| 25702 | ** When opening a new shared-memory file, if no other instances of that |
| 25703 | ** file are currently open, in this process or in other processes, then |
| 25704 | ** the file must be truncated to zero length or have its header cleared. |
| 25705 | */ |
| @@ -25706,12 +25709,12 @@ | |
| 25709 | struct unixShm *p = 0; /* The connection to be opened */ |
| 25710 | struct unixShmNode *pShmNode = 0; /* The underlying mmapped file */ |
| 25711 | int rc; /* Result code */ |
| 25712 | struct unixFile *pDbFd; /* Underlying database file */ |
| 25713 | unixInodeInfo *pInode; /* The inode of fd */ |
| 25714 | char *zShmFilename; /* Name of the file used for SHM */ |
| 25715 | int nShmFilename; /* Size of the SHM filename in bytes */ |
| 25716 | |
| 25717 | /* Allocate space for the new sqlite3_shm object. |
| 25718 | */ |
| 25719 | p = sqlite3_malloc( sizeof(*p) ); |
| 25720 | if( p==0 ) return SQLITE_NOMEM; |
| @@ -25724,37 +25727,29 @@ | |
| 25727 | */ |
| 25728 | unixEnterMutex(); |
| 25729 | pInode = pDbFd->pInode; |
| 25730 | pShmNode = pInode->pShmNode; |
| 25731 | if( pShmNode==0 ){ |
| 25732 | nShmFilename = 5 + (int)strlen(pDbFd->zPath); |
| 25733 | pShmNode = sqlite3_malloc( sizeof(*pShmNode) + nShmFilename ); |
| 25734 | if( pShmNode==0 ){ |
| 25735 | rc = SQLITE_NOMEM; |
| 25736 | goto shm_open_err; |
| 25737 | } |
| 25738 | memset(pShmNode, 0, sizeof(*pShmNode)); |
| 25739 | zShmFilename = pShmNode->zFilename = (char*)&pShmNode[1]; |
| 25740 | sqlite3_snprintf(nShmFilename, zShmFilename, "%s-shm", pDbFd->zPath); |
| 25741 | pShmNode->h = -1; |
| 25742 | pDbFd->pInode->pShmNode = pShmNode; |
| 25743 | pShmNode->pInode = pDbFd->pInode; |
| 25744 | pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); |
| 25745 | if( pShmNode->mutex==0 ){ |
| 25746 | rc = SQLITE_NOMEM; |
| 25747 | goto shm_open_err; |
| 25748 | } |
| 25749 | |
| 25750 | pShmNode->h = open(zShmFilename, O_RDWR|O_CREAT, 0664); |
| 25751 | if( pShmNode->h<0 ){ |
| 25752 | rc = SQLITE_CANTOPEN_BKPT; |
| 25753 | goto shm_open_err; |
| 25754 | } |
| 25755 | |
| @@ -26563,11 +26558,11 @@ | |
| 26558 | |
| 26559 | /* |
| 26560 | ** Return the name of a directory in which to put temporary files. |
| 26561 | ** If no suitable temporary file directory can be found, return NULL. |
| 26562 | */ |
| 26563 | static const char *unixTempFileDir(void){ |
| 26564 | static const char *azDirs[] = { |
| 26565 | 0, |
| 26566 | 0, |
| 26567 | "/var/tmp", |
| 26568 | "/usr/tmp", |
| @@ -26578,23 +26573,15 @@ | |
| 26573 | struct stat buf; |
| 26574 | const char *zDir = 0; |
| 26575 | |
| 26576 | azDirs[0] = sqlite3_temp_directory; |
| 26577 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 26578 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ |
| 26579 | if( zDir==0 ) continue; |
| 26580 | if( stat(zDir, &buf) ) continue; |
| 26581 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 26582 | if( access(zDir, 07) ) continue; |
| 26583 | break; |
| 26584 | } |
| 26585 | return zDir; |
| 26586 | } |
| 26587 | |
| @@ -26615,11 +26602,11 @@ | |
| 26602 | ** using the io-error infrastructure to test that SQLite handles this |
| 26603 | ** function failing. |
| 26604 | */ |
| 26605 | SimulateIOError( return SQLITE_IOERR ); |
| 26606 | |
| 26607 | zDir = unixTempFileDir(); |
| 26608 | if( zDir==0 ) zDir = "."; |
| 26609 | |
| 26610 | /* Check that the output buffer is large enough for the temporary file |
| 26611 | ** name. If it is not, return SQLITE_ERROR. |
| 26612 | */ |
| @@ -27024,10 +27011,16 @@ | |
| 27011 | |
| 27012 | default: |
| 27013 | assert(!"Invalid flags argument"); |
| 27014 | } |
| 27015 | *pResOut = (access(zPath, amode)==0); |
| 27016 | if( flags==SQLITE_ACCESS_EXISTS && *pResOut ){ |
| 27017 | struct stat buf; |
| 27018 | if( 0==stat(zPath, &buf) && buf.st_size==0 ){ |
| 27019 | *pResOut = 0; |
| 27020 | } |
| 27021 | } |
| 27022 | return SQLITE_OK; |
| 27023 | } |
| 27024 | |
| 27025 | |
| 27026 | /* |
| @@ -29906,11 +29899,11 @@ | |
| 29899 | /* |
| 29900 | ** Return a vector of device characteristics. |
| 29901 | */ |
| 29902 | static int winDeviceCharacteristics(sqlite3_file *id){ |
| 29903 | UNUSED_PARAMETER(id); |
| 29904 | return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; |
| 29905 | } |
| 29906 | |
| 29907 | /**************************************************************************** |
| 29908 | ********************************* Shared Memory ***************************** |
| 29909 | ** |
| @@ -34777,16 +34770,28 @@ | |
| 34770 | ** treated as a hot-journal and rolled back. |
| 34771 | */ |
| 34772 | static void pager_unlock(Pager *pPager){ |
| 34773 | if( !pPager->exclusiveMode ){ |
| 34774 | int rc = SQLITE_OK; /* Return code */ |
| 34775 | int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0; |
| 34776 | |
| 34777 | /* Always close the journal file when dropping the database lock. |
| 34778 | ** Otherwise, another connection with journal_mode=delete might |
| 34779 | ** delete the file out from under us. |
| 34780 | */ |
| 34781 | assert( (PAGER_JOURNALMODE_MEMORY & 5)!=1 ); |
| 34782 | assert( (PAGER_JOURNALMODE_OFF & 5)!=1 ); |
| 34783 | assert( (PAGER_JOURNALMODE_WAL & 5)!=1 ); |
| 34784 | assert( (PAGER_JOURNALMODE_DELETE & 5)!=1 ); |
| 34785 | assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 ); |
| 34786 | assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 ); |
| 34787 | if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN) |
| 34788 | || 1!=(pPager->journalMode & 5) |
| 34789 | ){ |
| 34790 | sqlite3OsClose(pPager->jfd); |
| 34791 | } |
| 34792 | |
| 34793 | sqlite3BitvecDestroy(pPager->pInJournal); |
| 34794 | pPager->pInJournal = 0; |
| 34795 | releaseAllSavepoints(pPager); |
| 34796 | |
| 34797 | /* If the file is unlocked, somebody else might change it. The |
| @@ -36673,10 +36678,11 @@ | |
| 36678 | } |
| 36679 | sqlite3EndBenignMalloc(); |
| 36680 | enable_simulated_io_errors(); |
| 36681 | PAGERTRACE(("CLOSE %d\n", PAGERID(pPager))); |
| 36682 | IOTRACE(("CLOSE %p\n", pPager)) |
| 36683 | sqlite3OsClose(pPager->jfd); |
| 36684 | sqlite3OsClose(pPager->fd); |
| 36685 | sqlite3PageFree(pTmp); |
| 36686 | sqlite3PcacheClose(pPager->pPCache); |
| 36687 | |
| 36688 | #ifdef SQLITE_HAS_CODEC |
| @@ -37466,21 +37472,26 @@ | |
| 37472 | ** to determine whether or not a hot-journal file exists, the IO error |
| 37473 | ** code is returned and the value of *pExists is undefined. |
| 37474 | */ |
| 37475 | static int hasHotJournal(Pager *pPager, int *pExists){ |
| 37476 | sqlite3_vfs * const pVfs = pPager->pVfs; |
| 37477 | int rc = SQLITE_OK; /* Return code */ |
| 37478 | int exists = 1; /* True if a journal file is present */ |
| 37479 | int jrnlOpen = !!isOpen(pPager->jfd); |
| 37480 | |
| 37481 | assert( pPager!=0 ); |
| 37482 | assert( pPager->useJournal ); |
| 37483 | assert( isOpen(pPager->fd) ); |
| 37484 | assert( pPager->state <= PAGER_SHARED ); |
| 37485 | assert( jrnlOpen==0 || ( sqlite3OsDeviceCharacteristics(pPager->jfd) & |
| 37486 | SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |
| 37487 | )); |
| 37488 | |
| 37489 | *pExists = 0; |
| 37490 | if( !jrnlOpen ){ |
| 37491 | rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); |
| 37492 | } |
| 37493 | if( rc==SQLITE_OK && exists ){ |
| 37494 | int locked; /* True if some process holds a RESERVED lock */ |
| 37495 | |
| 37496 | /* Race condition here: Another process might have been holding the |
| 37497 | ** the RESERVED lock and have a journal open at the sqlite3OsAccess() |
| @@ -37514,19 +37525,23 @@ | |
| 37525 | ** or greater lock on the database file. Now check that there is |
| 37526 | ** at least one non-zero bytes at the start of the journal file. |
| 37527 | ** If there is, then we consider this journal to be hot. If not, |
| 37528 | ** it can be ignored. |
| 37529 | */ |
| 37530 | if( !jrnlOpen ){ |
| 37531 | int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL; |
| 37532 | rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f); |
| 37533 | } |
| 37534 | if( rc==SQLITE_OK ){ |
| 37535 | u8 first = 0; |
| 37536 | rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0); |
| 37537 | if( rc==SQLITE_IOERR_SHORT_READ ){ |
| 37538 | rc = SQLITE_OK; |
| 37539 | } |
| 37540 | if( !jrnlOpen ){ |
| 37541 | sqlite3OsClose(pPager->jfd); |
| 37542 | } |
| 37543 | *pExists = (first!=0); |
| 37544 | }else if( rc==SQLITE_CANTOPEN ){ |
| 37545 | /* If we cannot open the rollback journal file in order to see if |
| 37546 | ** its has a zero header, that might be due to an I/O error, or |
| 37547 | ** it might be due to the race condition described above and in |
| @@ -39437,21 +39452,49 @@ | |
| 39452 | |
| 39453 | /* Change the journal mode. */ |
| 39454 | pPager->journalMode = (u8)eMode; |
| 39455 | |
| 39456 | /* When transistioning from TRUNCATE or PERSIST to any other journal |
| 39457 | ** mode except WAL (and we are not in locking_mode=EXCLUSIVE) then |
| 39458 | ** delete the journal file. |
| 39459 | */ |
| 39460 | assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 ); |
| 39461 | assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 ); |
| 39462 | assert( (PAGER_JOURNALMODE_DELETE & 5)==0 ); |
| 39463 | assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 ); |
| 39464 | assert( (PAGER_JOURNALMODE_OFF & 5)==0 ); |
| 39465 | assert( (PAGER_JOURNALMODE_WAL & 5)==5 ); |
| 39466 | |
| 39467 | assert( isOpen(pPager->fd) || pPager->exclusiveMode ); |
| 39468 | if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){ |
| 39469 | |
| 39470 | /* In this case we would like to delete the journal file. If it is |
| 39471 | ** not possible, then that is not a problem. Deleting the journal file |
| 39472 | ** here is an optimization only. |
| 39473 | ** |
| 39474 | ** Before deleting the journal file, obtain a RESERVED lock on the |
| 39475 | ** database file. This ensures that the journal file is not deleted |
| 39476 | ** while it is in use by some other client. |
| 39477 | */ |
| 39478 | int rc = SQLITE_OK; |
| 39479 | int state = pPager->state; |
| 39480 | if( state<PAGER_SHARED ){ |
| 39481 | rc = sqlite3PagerSharedLock(pPager); |
| 39482 | } |
| 39483 | if( pPager->state==PAGER_SHARED ){ |
| 39484 | assert( rc==SQLITE_OK ); |
| 39485 | rc = sqlite3OsLock(pPager->fd, RESERVED_LOCK); |
| 39486 | } |
| 39487 | if( rc==SQLITE_OK ){ |
| 39488 | sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); |
| 39489 | } |
| 39490 | if( rc==SQLITE_OK && state==PAGER_SHARED ){ |
| 39491 | sqlite3OsUnlock(pPager->fd, SHARED_LOCK); |
| 39492 | }else if( state==PAGER_UNLOCK ){ |
| 39493 | pager_unlock(pPager); |
| 39494 | } |
| 39495 | assert( state==pPager->state ); |
| 39496 | } |
| 39497 | } |
| 39498 | |
| 39499 | /* Return the new journal mode */ |
| 39500 | return (int)pPager->journalMode; |
| @@ -63307,36 +63350,30 @@ | |
| 63350 | ** after a successful return. |
| 63351 | */ |
| 63352 | rc = sqlite3PagerCloseWal(u.cd.pPager); |
| 63353 | if( rc==SQLITE_OK ){ |
| 63354 | sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63355 | } |
| 63356 | } |
| 63357 | |
| 63358 | /* Open a transaction on the database file. Regardless of the journal |
| 63359 | ** mode, this transaction always uses a rollback journal. |
| 63360 | */ |
| 63361 | assert( sqlite3BtreeIsInTrans(u.cd.pBt)==0 ); |
| 63362 | if( rc==SQLITE_OK ){ |
| 63363 | rc = sqlite3BtreeSetVersion(u.cd.pBt, (u.cd.eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); |
| 63364 | } |
| 63365 | } |
| 63366 | } |
| 63367 | #endif /* ifndef SQLITE_OMIT_WAL */ |
| 63368 | |
| 63369 | if( rc ){ |
| 63370 | if( rc==SQLITE_BUSY && pOp->p5!=0 ) rc = SQLITE_OK; |
| 63371 | u.cd.eNew = u.cd.eOld; |
| 63372 | } |
| 63373 | u.cd.eNew = sqlite3PagerSetJournalMode(u.cd.pPager, u.cd.eNew); |
| 63374 | |
| 63375 | pOut = &aMem[pOp->p2]; |
| 63376 | pOut->flags = MEM_Str|MEM_Static|MEM_Term; |
| 63377 | pOut->z = (char *)sqlite3JournalModename(u.cd.eNew); |
| 63378 | pOut->n = sqlite3Strlen30(pOut->z); |
| 63379 | pOut->enc = SQLITE_UTF8; |
| @@ -64146,14 +64183,18 @@ | |
| 64183 | |
| 64184 | /* Make sure a mutex is held on the table to be accessed */ |
| 64185 | sqlite3VdbeUsesBtree(v, iDb); |
| 64186 | |
| 64187 | /* Configure the OP_TableLock instruction */ |
| 64188 | #ifdef SQLITE_OMIT_SHARED_CACHE |
| 64189 | sqlite3VdbeChangeToNoop(v, 2, 1); |
| 64190 | #else |
| 64191 | sqlite3VdbeChangeP1(v, 2, iDb); |
| 64192 | sqlite3VdbeChangeP2(v, 2, pTab->tnum); |
| 64193 | sqlite3VdbeChangeP3(v, 2, flags); |
| 64194 | sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT); |
| 64195 | #endif |
| 64196 | |
| 64197 | /* Remove either the OP_OpenWrite or OpenRead. Set the P2 |
| 64198 | ** parameter of the other to pTab->tnum. */ |
| 64199 | sqlite3VdbeChangeToNoop(v, 4 - flags, 1); |
| 64200 | sqlite3VdbeChangeP2(v, 3 + flags, pTab->tnum); |
| 64201 |
+13
-12
| --- 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-06-16 12:30:11 ad3209572d0e6afe5c8b52313e334509661045e2" | |
| 112 | +#define SQLITE_SOURCE_ID "2010-06-21 12:47:41 ee0acef1faffd480fd2136f81fb2b6f6a17b5388" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| @@ -500,21 +500,22 @@ | ||
| 500 | 500 | ** first then the size of the file is extended, never the other |
| 501 | 501 | ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that |
| 502 | 502 | ** information is written to disk in the same order as calls |
| 503 | 503 | ** to xWrite(). |
| 504 | 504 | */ |
| 505 | -#define SQLITE_IOCAP_ATOMIC 0x00000001 | |
| 506 | -#define SQLITE_IOCAP_ATOMIC512 0x00000002 | |
| 507 | -#define SQLITE_IOCAP_ATOMIC1K 0x00000004 | |
| 508 | -#define SQLITE_IOCAP_ATOMIC2K 0x00000008 | |
| 509 | -#define SQLITE_IOCAP_ATOMIC4K 0x00000010 | |
| 510 | -#define SQLITE_IOCAP_ATOMIC8K 0x00000020 | |
| 511 | -#define SQLITE_IOCAP_ATOMIC16K 0x00000040 | |
| 512 | -#define SQLITE_IOCAP_ATOMIC32K 0x00000080 | |
| 513 | -#define SQLITE_IOCAP_ATOMIC64K 0x00000100 | |
| 514 | -#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 | |
| 515 | -#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 | |
| 505 | +#define SQLITE_IOCAP_ATOMIC 0x00000001 | |
| 506 | +#define SQLITE_IOCAP_ATOMIC512 0x00000002 | |
| 507 | +#define SQLITE_IOCAP_ATOMIC1K 0x00000004 | |
| 508 | +#define SQLITE_IOCAP_ATOMIC2K 0x00000008 | |
| 509 | +#define SQLITE_IOCAP_ATOMIC4K 0x00000010 | |
| 510 | +#define SQLITE_IOCAP_ATOMIC8K 0x00000020 | |
| 511 | +#define SQLITE_IOCAP_ATOMIC16K 0x00000040 | |
| 512 | +#define SQLITE_IOCAP_ATOMIC32K 0x00000080 | |
| 513 | +#define SQLITE_IOCAP_ATOMIC64K 0x00000100 | |
| 514 | +#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 | |
| 515 | +#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 | |
| 516 | +#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 | |
| 516 | 517 | |
| 517 | 518 | /* |
| 518 | 519 | ** CAPI3REF: File Locking Levels |
| 519 | 520 | ** |
| 520 | 521 | ** SQLite uses one of these integer values as the second |
| 521 | 522 |
| --- 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-06-16 12:30:11 ad3209572d0e6afe5c8b52313e334509661045e2" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -500,21 +500,22 @@ | |
| 500 | ** first then the size of the file is extended, never the other |
| 501 | ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that |
| 502 | ** information is written to disk in the same order as calls |
| 503 | ** to xWrite(). |
| 504 | */ |
| 505 | #define SQLITE_IOCAP_ATOMIC 0x00000001 |
| 506 | #define SQLITE_IOCAP_ATOMIC512 0x00000002 |
| 507 | #define SQLITE_IOCAP_ATOMIC1K 0x00000004 |
| 508 | #define SQLITE_IOCAP_ATOMIC2K 0x00000008 |
| 509 | #define SQLITE_IOCAP_ATOMIC4K 0x00000010 |
| 510 | #define SQLITE_IOCAP_ATOMIC8K 0x00000020 |
| 511 | #define SQLITE_IOCAP_ATOMIC16K 0x00000040 |
| 512 | #define SQLITE_IOCAP_ATOMIC32K 0x00000080 |
| 513 | #define SQLITE_IOCAP_ATOMIC64K 0x00000100 |
| 514 | #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 |
| 515 | #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 |
| 516 | |
| 517 | /* |
| 518 | ** CAPI3REF: File Locking Levels |
| 519 | ** |
| 520 | ** SQLite uses one of these integer values as the second |
| 521 |
| --- 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-06-21 12:47:41 ee0acef1faffd480fd2136f81fb2b6f6a17b5388" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -500,21 +500,22 @@ | |
| 500 | ** first then the size of the file is extended, never the other |
| 501 | ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that |
| 502 | ** information is written to disk in the same order as calls |
| 503 | ** to xWrite(). |
| 504 | */ |
| 505 | #define SQLITE_IOCAP_ATOMIC 0x00000001 |
| 506 | #define SQLITE_IOCAP_ATOMIC512 0x00000002 |
| 507 | #define SQLITE_IOCAP_ATOMIC1K 0x00000004 |
| 508 | #define SQLITE_IOCAP_ATOMIC2K 0x00000008 |
| 509 | #define SQLITE_IOCAP_ATOMIC4K 0x00000010 |
| 510 | #define SQLITE_IOCAP_ATOMIC8K 0x00000020 |
| 511 | #define SQLITE_IOCAP_ATOMIC16K 0x00000040 |
| 512 | #define SQLITE_IOCAP_ATOMIC32K 0x00000080 |
| 513 | #define SQLITE_IOCAP_ATOMIC64K 0x00000100 |
| 514 | #define SQLITE_IOCAP_SAFE_APPEND 0x00000200 |
| 515 | #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 |
| 516 | #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 |
| 517 | |
| 518 | /* |
| 519 | ** CAPI3REF: File Locking Levels |
| 520 | ** |
| 521 | ** SQLite uses one of these integer values as the second |
| 522 |