Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge the 3.8.7 changes into the apple-osx branch. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | apple-osx |
Files: | files | file ages | folders |
SHA1: | aa7bbed10b63078dcd3468b7b47c3004 |
User & Date: | drh 2014-10-17 12:11:07 |
Context
2014-10-27
| ||
18:42 | Merge latest enhancements, including the SQLITE_ENABLE_API_ARMOR patch, from trunk. check-in: 10aaf3b1 user: drh tags: apple-osx | |
2014-10-17
| ||
12:11 | Merge the 3.8.7 changes into the apple-osx branch. check-in: aa7bbed1 user: drh tags: apple-osx | |
11:24 | Version 3.8.7 check-in: e4ab094f user: drh tags: trunk, release, version-3.8.7 | |
2014-10-14
| ||
14:17 | Merge from trunk recent micro-optimizations and the fix for the DESC index GROUP BY ORDER BY bug. check-in: 880df756 user: drh tags: apple-osx | |
Changes
Changes to src/btree.c.
2110 2110 #else 2111 2111 return 1; 2112 2112 #endif 2113 2113 } 2114 2114 2115 2115 /* 2116 2116 ** Make sure pBt->pTmpSpace points to an allocation of 2117 -** MX_CELL_SIZE(pBt) bytes. 2117 +** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child 2118 +** pointer. 2118 2119 */ 2119 2120 static void allocateTempSpace(BtShared *pBt){ 2120 2121 if( !pBt->pTmpSpace ){ 2121 2122 pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize ); 2122 2123 2123 2124 /* One of the uses of pBt->pTmpSpace is to format cells before 2124 2125 ** inserting them into a leaf page (function fillInCell()). If ................................................................................ 2125 2126 ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes 2126 2127 ** by the various routines that manipulate binary cells. Which 2127 2128 ** can mean that fillInCell() only initializes the first 2 or 3 2128 2129 ** bytes of pTmpSpace, but that the first 4 bytes are copied from 2129 2130 ** it into a database page. This is not actually a problem, but it 2130 2131 ** does cause a valgrind error when the 1 or 2 bytes of unitialized 2131 2132 ** data is passed to system call write(). So to avoid this error, 2132 - ** zero the first 4 bytes of temp space here. */ 2133 - if( pBt->pTmpSpace ) memset(pBt->pTmpSpace, 0, 4); 2133 + ** zero the first 4 bytes of temp space here. 2134 + ** 2135 + ** Also: Provide four bytes of initialized space before the 2136 + ** beginning of pTmpSpace as an area available to prepend the 2137 + ** left-child pointer to the beginning of a cell. 2138 + */ 2139 + if( pBt->pTmpSpace ){ 2140 + memset(pBt->pTmpSpace, 0, 8); 2141 + pBt->pTmpSpace += 4; 2142 + } 2134 2143 } 2135 2144 } 2136 2145 2137 2146 /* 2138 2147 ** Free the pBt->pTmpSpace allocation 2139 2148 */ 2140 2149 static void freeTempSpace(BtShared *pBt){ 2141 - sqlite3PageFree( pBt->pTmpSpace); 2142 - pBt->pTmpSpace = 0; 2150 + if( pBt->pTmpSpace ){ 2151 + pBt->pTmpSpace -= 4; 2152 + sqlite3PageFree(pBt->pTmpSpace); 2153 + pBt->pTmpSpace = 0; 2154 + } 2143 2155 } 2144 2156 2145 2157 /* 2146 2158 ** Close an open database and invalidate all cursors. 2147 2159 */ 2148 2160 int sqlite3BtreeClose(Btree *p){ 2149 2161 BtShared *pBt = p->pBt;
Changes to src/btreeInt.h.
432 432 Bitvec *pHasContent; /* Set of pages moved to free-list this transaction */ 433 433 #ifndef SQLITE_OMIT_SHARED_CACHE 434 434 int nRef; /* Number of references to this structure */ 435 435 BtShared *pNext; /* Next on a list of sharable BtShared structs */ 436 436 BtLock *pLock; /* List of locks held on this shared-btree struct */ 437 437 Btree *pWriter; /* Btree with currently open write transaction */ 438 438 #endif 439 - u8 *pTmpSpace; /* BtShared.pageSize bytes of space for tmp use */ 439 + u8 *pTmpSpace; /* Temp space sufficient to hold a single cell */ 440 440 }; 441 441 442 442 /* 443 443 ** Allowed values for BtShared.btsFlags 444 444 */ 445 445 #define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */ 446 446 #define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */
Changes to src/os_win.c.
939 939 #else 940 940 { "WaitForSingleObject", (SYSCALL)0, 0 }, 941 941 #endif 942 942 943 943 #define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \ 944 944 DWORD))aSyscall[63].pCurrent) 945 945 946 +#if !SQLITE_OS_WINCE 946 947 { "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 }, 948 +#else 949 + { "WaitForSingleObjectEx", (SYSCALL)0, 0 }, 950 +#endif 947 951 948 952 #define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \ 949 953 BOOL))aSyscall[64].pCurrent) 950 954 951 955 #if SQLITE_OS_WINRT 952 956 { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 }, 953 957 #else ................................................................................ 1282 1286 assert( sleepObj!=NULL ); 1283 1287 osWaitForSingleObjectEx(sleepObj, milliseconds, FALSE); 1284 1288 #else 1285 1289 osSleep(milliseconds); 1286 1290 #endif 1287 1291 } 1288 1292 1289 -#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINRT && SQLITE_THREADSAFE>0 1293 +#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \ 1294 + SQLITE_THREADSAFE>0 1290 1295 DWORD sqlite3Win32Wait(HANDLE hObject){ 1291 1296 DWORD rc; 1292 1297 while( (rc = osWaitForSingleObjectEx(hObject, INFINITE, 1293 1298 TRUE))==WAIT_IO_COMPLETION ){} 1294 1299 return rc; 1295 1300 } 1296 1301 #endif
Changes to src/threads.c.
94 94 } 95 95 96 96 #endif /* SQLITE_OS_UNIX && defined(SQLITE_MUTEX_PTHREADS) */ 97 97 /******************************** End Unix Pthreads *************************/ 98 98 99 99 100 100 /********************************* Win32 Threads ****************************/ 101 -#if SQLITE_OS_WIN && !SQLITE_OS_WINRT && SQLITE_THREADSAFE>0 101 +#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_THREADSAFE>0 102 102 103 103 #define SQLITE_THREADS_IMPLEMENTED 1 /* Prevent the single-thread code below */ 104 104 #include <process.h> 105 105 106 106 /* A running thread */ 107 107 struct SQLiteThread { 108 108 void *tid; /* The thread handle */ ................................................................................ 187 187 assert( bRc ); 188 188 } 189 189 if( rc==WAIT_OBJECT_0 ) *ppOut = p->pResult; 190 190 sqlite3_free(p); 191 191 return (rc==WAIT_OBJECT_0) ? SQLITE_OK : SQLITE_ERROR; 192 192 } 193 193 194 -#endif /* SQLITE_OS_WIN && !SQLITE_OS_WINRT */ 194 +#endif /* SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT */ 195 195 /******************************** End Win32 Threads *************************/ 196 196 197 197 198 198 /********************************* Single-Threaded **************************/ 199 199 #ifndef SQLITE_THREADS_IMPLEMENTED 200 200 /* 201 201 ** This implementation does not actually create a new thread. It does the
Changes to src/vdbemem.c.
139 139 pMem->szMalloc = 0; 140 140 return SQLITE_NOMEM; 141 141 }else{ 142 142 pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc); 143 143 } 144 144 } 145 145 146 - if( pMem->z && bPreserve && pMem->z!=pMem->zMalloc ){ 146 + if( bPreserve && pMem->z && pMem->z!=pMem->zMalloc ){ 147 147 memcpy(pMem->zMalloc, pMem->z, pMem->n); 148 148 } 149 149 if( (pMem->flags&MEM_Dyn)!=0 ){ 150 150 assert( pMem->xDel!=0 && pMem->xDel!=SQLITE_DYNAMIC ); 151 151 pMem->xDel((void *)(pMem->z)); 152 152 } 153 153
Changes to src/vdbesort.c.
2288 2288 2289 2289 rc = vdbeSorterMergeTreeBuild(pSorter, &pMain); 2290 2290 if( rc==SQLITE_OK ){ 2291 2291 #if SQLITE_MAX_WORKER_THREADS 2292 2292 assert( pSorter->bUseThreads==0 || pSorter->nTask>1 ); 2293 2293 if( pSorter->bUseThreads ){ 2294 2294 int iTask; 2295 - PmaReader *pReadr; 2295 + PmaReader *pReadr = 0; 2296 2296 SortSubtask *pLast = &pSorter->aTask[pSorter->nTask-1]; 2297 2297 rc = vdbeSortAllocUnpacked(pLast); 2298 2298 if( rc==SQLITE_OK ){ 2299 2299 pReadr = (PmaReader*)sqlite3DbMallocZero(db, sizeof(PmaReader)); 2300 2300 pSorter->pReader = pReadr; 2301 2301 if( pReadr==0 ) rc = SQLITE_NOMEM; 2302 2302 }
Changes to src/vtab.c.
515 515 *pzErr = sqlite3MPrintf(db, "%s", zErr); 516 516 sqlite3_free(zErr); 517 517 } 518 518 sqlite3DbFree(db, pVTable); 519 519 }else if( ALWAYS(pVTable->pVtab) ){ 520 520 /* Justification of ALWAYS(): A correct vtab constructor must allocate 521 521 ** the sqlite3_vtab object if successful. */ 522 + memset(pVTable->pVtab, 0, sizeof(pVTable->pVtab[0])); 522 523 pVTable->pVtab->pModule = pMod->pModule; 523 524 pVTable->nRef = 1; 524 525 if( sCtx.pTab ){ 525 526 const char *zFormat = "vtable constructor did not declare schema: %s"; 526 527 *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName); 527 528 sqlite3VtabUnlock(pVTable); 528 529 rc = SQLITE_ERROR;
Changes to test/lock5.test.
172 172 execsql { 173 173 BEGIN; 174 174 SELECT * FROM t1; 175 175 } db2 176 176 } {1 2} 177 177 do_test lock5-none.5 { 178 178 execsql COMMIT 179 + } 180 + do_test lock5-none.6 { 181 + sqlite3_release_memory 1000000 179 182 execsql {SELECT * FROM t1} db2 180 183 } {1 2} 181 184 182 185 ifcapable memorymanage { 183 186 do_test lock5-none.6 { 184 187 sqlite3_release_memory 1000000 185 188 execsql {SELECT * FROM t1} db2
Changes to test/releasetest.tcl.
192 192 "Secure-Delete" test 193 193 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" 194 194 "Update-Delete-Limit" test 195 195 "Extra-Robustness" test 196 196 "Device-Two" test 197 197 "Ftrapv" test 198 198 "No-lookaside" test 199 - "Default" "threadtest test" 199 + "Devkit" test 200 + "Default" "threadtest fulltest" 200 201 "Device-One" fulltest 201 202 } 202 203 Linux-i686 { 203 204 "Devkit" test 204 205 "Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test" 205 206 "Device-One" test 206 207 "Device-Two" test
Changes to test/sort.test.
11 11 # 12 12 # This file implements regression tests for SQLite library. The 13 13 # focus of this file is testing the sorter (code in vdbesort.c). 14 14 # 15 15 16 16 set testdir [file dirname $argv0] 17 17 source $testdir/tester.tcl 18 +set testprefix sort 18 19 19 20 # Create a bunch of data to sort against 20 21 # 21 22 do_test sort-1.0 { 22 23 execsql { 23 24 CREATE TABLE t1( 24 25 n int,
Changes to tool/vdbe-compress.tcl.
106 106 append afterUnion $line\n 107 107 set vlist {} 108 108 } elseif {[llength $vlist]>0} { 109 109 append line " " 110 110 foreach v $vlist { 111 111 regsub -all "(\[^a-zA-Z0-9>.\])${v}(\\W)" $line "\\1u.$sname.$v\\2" line 112 112 regsub -all "(\[^a-zA-Z0-9>.\])${v}(\\W)" $line "\\1u.$sname.$v\\2" line 113 + 114 + # The expressions above fail to catch instance of variable "abc" in 115 + # expressions like (32>abc). The following expression makes those 116 + # substitutions. 117 + regsub -all "(\[^-\])>${v}(\\W)" $line "\\1>u.$sname.$v\\2" line 113 118 } 114 119 append afterUnion [string trimright $line]\n 115 120 } elseif {$line=="" && [eof stdin]} { 116 121 # no-op 117 122 } else { 118 123 append afterUnion $line\n 119 124 }