Fossil SCM
Update the built-in SQLite to the latest 3.21.0 alpha that includes the enhancements to the Windows VFS that help it better deal with read-only repository files.
Commit
e97d4443d5628702df5ffc533de91827e1dd7fc76a3b6e452bc601601732ecf8
Parent
b20f6cbaf4aabb5…
2 files changed
+63
-55
+1
-1
+63
-55
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -1147,11 +1147,11 @@ | ||
| 1147 | 1147 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1148 | 1148 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1149 | 1149 | */ |
| 1150 | 1150 | #define SQLITE_VERSION "3.21.0" |
| 1151 | 1151 | #define SQLITE_VERSION_NUMBER 3021000 |
| 1152 | -#define SQLITE_SOURCE_ID "2017-09-20 10:47:10 fd7743d96ebeacce621dc79a4de408fbda6a9b35657628e71ac6e3c12595c9d0" | |
| 1152 | +#define SQLITE_SOURCE_ID "2017-09-21 20:43:48 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43" | |
| 1153 | 1153 | |
| 1154 | 1154 | /* |
| 1155 | 1155 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1156 | 1156 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1157 | 1157 | ** |
| @@ -43098,10 +43098,18 @@ | ||
| 43098 | 43098 | #endif |
| 43099 | 43099 | } |
| 43100 | 43100 | return (attr!=INVALID_FILE_ATTRIBUTES) && (attr&FILE_ATTRIBUTE_DIRECTORY); |
| 43101 | 43101 | } |
| 43102 | 43102 | |
| 43103 | +/* forward reference */ | |
| 43104 | +static int winAccess( | |
| 43105 | + sqlite3_vfs *pVfs, /* Not used on win32 */ | |
| 43106 | + const char *zFilename, /* Name of file to check */ | |
| 43107 | + int flags, /* Type of test to make on this file */ | |
| 43108 | + int *pResOut /* OUT: Result */ | |
| 43109 | +); | |
| 43110 | + | |
| 43103 | 43111 | /* |
| 43104 | 43112 | ** Open a file. |
| 43105 | 43113 | */ |
| 43106 | 43114 | static int winOpen( |
| 43107 | 43115 | sqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */ |
| @@ -43283,19 +43291,24 @@ | ||
| 43283 | 43291 | &extendedParameters))==INVALID_HANDLE_VALUE && |
| 43284 | 43292 | winRetryIoerr(&cnt, &lastErrno) ){ |
| 43285 | 43293 | /* Noop */ |
| 43286 | 43294 | } |
| 43287 | 43295 | #else |
| 43288 | - while( (h = osCreateFileW((LPCWSTR)zConverted, | |
| 43289 | - dwDesiredAccess, | |
| 43290 | - dwShareMode, NULL, | |
| 43291 | - dwCreationDisposition, | |
| 43292 | - dwFlagsAndAttributes, | |
| 43293 | - NULL))==INVALID_HANDLE_VALUE && | |
| 43294 | - winRetryIoerr(&cnt, &lastErrno) ){ | |
| 43295 | - /* Noop */ | |
| 43296 | - } | |
| 43296 | + do{ | |
| 43297 | + h = osCreateFileW((LPCWSTR)zConverted, | |
| 43298 | + dwDesiredAccess, | |
| 43299 | + dwShareMode, NULL, | |
| 43300 | + dwCreationDisposition, | |
| 43301 | + dwFlagsAndAttributes, | |
| 43302 | + NULL); | |
| 43303 | + if( h!=INVALID_HANDLE_VALUE ) break; | |
| 43304 | + if( isReadWrite ){ | |
| 43305 | + int isRO = 0; | |
| 43306 | + int rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO); | |
| 43307 | + if( rc2==SQLITE_OK && isRO ) break; | |
| 43308 | + } | |
| 43309 | + }while( winRetryIoerr(&cnt, &lastErrno) ); | |
| 43297 | 43310 | #endif |
| 43298 | 43311 | } |
| 43299 | 43312 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 43300 | 43313 | else{ |
| 43301 | 43314 | while( (h = osCreateFileA((LPCSTR)zConverted, |
| @@ -43313,20 +43326,20 @@ | ||
| 43313 | 43326 | |
| 43314 | 43327 | OSTRACE(("OPEN file=%p, name=%s, access=%lx, rc=%s\n", h, zUtf8Name, |
| 43315 | 43328 | dwDesiredAccess, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); |
| 43316 | 43329 | |
| 43317 | 43330 | if( h==INVALID_HANDLE_VALUE ){ |
| 43318 | - pFile->lastErrno = lastErrno; | |
| 43319 | - winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name); | |
| 43320 | 43331 | sqlite3_free(zConverted); |
| 43321 | 43332 | sqlite3_free(zTmpname); |
| 43322 | 43333 | if( isReadWrite && !isExclusive ){ |
| 43323 | 43334 | return winOpen(pVfs, zName, id, |
| 43324 | 43335 | ((flags|SQLITE_OPEN_READONLY) & |
| 43325 | 43336 | ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)), |
| 43326 | 43337 | pOutFlags); |
| 43327 | 43338 | }else{ |
| 43339 | + pFile->lastErrno = lastErrno; | |
| 43340 | + winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name); | |
| 43328 | 43341 | return SQLITE_CANTOPEN_BKPT; |
| 43329 | 43342 | } |
| 43330 | 43343 | } |
| 43331 | 43344 | |
| 43332 | 43345 | if( pOutFlags ){ |
| @@ -70512,11 +70525,11 @@ | ||
| 70512 | 70525 | testcase( bPreserve && pMem->z==0 ); |
| 70513 | 70526 | |
| 70514 | 70527 | assert( pMem->szMalloc==0 |
| 70515 | 70528 | || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) ); |
| 70516 | 70529 | if( n<32 ) n = 32; |
| 70517 | - if( bPreserve && pMem->szMalloc>0 && pMem->z==pMem->zMalloc ){ | |
| 70530 | + if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){ | |
| 70518 | 70531 | pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n); |
| 70519 | 70532 | bPreserve = 0; |
| 70520 | 70533 | }else{ |
| 70521 | 70534 | if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc); |
| 70522 | 70535 | pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n); |
| @@ -70528,11 +70541,12 @@ | ||
| 70528 | 70541 | return SQLITE_NOMEM_BKPT; |
| 70529 | 70542 | }else{ |
| 70530 | 70543 | pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc); |
| 70531 | 70544 | } |
| 70532 | 70545 | |
| 70533 | - if( bPreserve && pMem->z && ALWAYS(pMem->z!=pMem->zMalloc) ){ | |
| 70546 | + if( bPreserve && pMem->z ){ | |
| 70547 | + assert( pMem->z!=pMem->zMalloc ); | |
| 70534 | 70548 | memcpy(pMem->zMalloc, pMem->z, pMem->n); |
| 70535 | 70549 | } |
| 70536 | 70550 | if( (pMem->flags&MEM_Dyn)!=0 ){ |
| 70537 | 70551 | assert( pMem->xDel!=0 && pMem->xDel!=SQLITE_DYNAMIC ); |
| 70538 | 70552 | pMem->xDel((void *)(pMem->z)); |
| @@ -70565,10 +70579,24 @@ | ||
| 70565 | 70579 | assert( (pMem->flags & MEM_Dyn)==0 ); |
| 70566 | 70580 | pMem->z = pMem->zMalloc; |
| 70567 | 70581 | pMem->flags &= (MEM_Null|MEM_Int|MEM_Real); |
| 70568 | 70582 | return SQLITE_OK; |
| 70569 | 70583 | } |
| 70584 | + | |
| 70585 | +/* | |
| 70586 | +** It is already known that pMem contains an unterminated string. | |
| 70587 | +** Add the zero terminator. | |
| 70588 | +*/ | |
| 70589 | +static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){ | |
| 70590 | + if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){ | |
| 70591 | + return SQLITE_NOMEM_BKPT; | |
| 70592 | + } | |
| 70593 | + pMem->z[pMem->n] = 0; | |
| 70594 | + pMem->z[pMem->n+1] = 0; | |
| 70595 | + pMem->flags |= MEM_Term; | |
| 70596 | + return SQLITE_OK; | |
| 70597 | +} | |
| 70570 | 70598 | |
| 70571 | 70599 | /* |
| 70572 | 70600 | ** Change pMem so that its MEM_Str or MEM_Blob value is stored in |
| 70573 | 70601 | ** MEM.zMalloc, where it can be safely written. |
| 70574 | 70602 | ** |
| @@ -70578,16 +70606,12 @@ | ||
| 70578 | 70606 | assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); |
| 70579 | 70607 | assert( (pMem->flags&MEM_RowSet)==0 ); |
| 70580 | 70608 | if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){ |
| 70581 | 70609 | if( ExpandBlob(pMem) ) return SQLITE_NOMEM; |
| 70582 | 70610 | if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){ |
| 70583 | - if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){ | |
| 70584 | - return SQLITE_NOMEM_BKPT; | |
| 70585 | - } | |
| 70586 | - pMem->z[pMem->n] = 0; | |
| 70587 | - pMem->z[pMem->n+1] = 0; | |
| 70588 | - pMem->flags |= MEM_Term; | |
| 70611 | + int rc = vdbeMemAddTerminator(pMem); | |
| 70612 | + if( rc ) return rc; | |
| 70589 | 70613 | } |
| 70590 | 70614 | } |
| 70591 | 70615 | pMem->flags &= ~MEM_Ephem; |
| 70592 | 70616 | #ifdef SQLITE_DEBUG |
| 70593 | 70617 | pMem->pScopyFrom = 0; |
| @@ -70622,24 +70646,10 @@ | ||
| 70622 | 70646 | pMem->flags &= ~(MEM_Zero|MEM_Term); |
| 70623 | 70647 | return SQLITE_OK; |
| 70624 | 70648 | } |
| 70625 | 70649 | #endif |
| 70626 | 70650 | |
| 70627 | -/* | |
| 70628 | -** It is already known that pMem contains an unterminated string. | |
| 70629 | -** Add the zero terminator. | |
| 70630 | -*/ | |
| 70631 | -static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){ | |
| 70632 | - if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){ | |
| 70633 | - return SQLITE_NOMEM_BKPT; | |
| 70634 | - } | |
| 70635 | - pMem->z[pMem->n] = 0; | |
| 70636 | - pMem->z[pMem->n+1] = 0; | |
| 70637 | - pMem->flags |= MEM_Term; | |
| 70638 | - return SQLITE_OK; | |
| 70639 | -} | |
| 70640 | - | |
| 70641 | 70651 | /* |
| 70642 | 70652 | ** Make sure the given Mem is \u0000 terminated. |
| 70643 | 70653 | */ |
| 70644 | 70654 | SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){ |
| 70645 | 70655 | assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); |
| @@ -71373,16 +71383,14 @@ | ||
| 71373 | 71383 | u32 amt, /* Number of bytes to return. */ |
| 71374 | 71384 | Mem *pMem /* OUT: Return data in this Mem structure. */ |
| 71375 | 71385 | ){ |
| 71376 | 71386 | int rc; |
| 71377 | 71387 | pMem->flags = MEM_Null; |
| 71378 | - if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+2)) ){ | |
| 71388 | + if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt)) ){ | |
| 71379 | 71389 | rc = sqlite3BtreePayload(pCur, offset, amt, pMem->z); |
| 71380 | 71390 | if( rc==SQLITE_OK ){ |
| 71381 | - pMem->z[amt] = 0; | |
| 71382 | - pMem->z[amt+1] = 0; | |
| 71383 | - pMem->flags = MEM_Blob|MEM_Term; | |
| 71391 | + pMem->flags = MEM_Blob; | |
| 71384 | 71392 | pMem->n = (int)amt; |
| 71385 | 71393 | }else{ |
| 71386 | 71394 | sqlite3VdbeMemRelease(pMem); |
| 71387 | 71395 | } |
| 71388 | 71396 | } |
| @@ -73522,11 +73530,11 @@ | ||
| 73522 | 73530 | case P4_INTARRAY: { |
| 73523 | 73531 | int i; |
| 73524 | 73532 | int *ai = pOp->p4.ai; |
| 73525 | 73533 | int n = ai[0]; /* The first element of an INTARRAY is always the |
| 73526 | 73534 | ** count of the number of elements to follow */ |
| 73527 | - for(i=1; i<n; i++){ | |
| 73535 | + for(i=1; i<=n; i++){ | |
| 73528 | 73536 | sqlite3XPrintf(&x, ",%d", ai[i]); |
| 73529 | 73537 | } |
| 73530 | 73538 | zTemp[0] = '['; |
| 73531 | 73539 | sqlite3StrAccumAppend(&x, "]", 1); |
| 73532 | 73540 | break; |
| @@ -84772,19 +84780,19 @@ | ||
| 84772 | 84780 | |
| 84773 | 84781 | assert( p->bIsReader ); |
| 84774 | 84782 | nRoot = pOp->p2; |
| 84775 | 84783 | aRoot = pOp->p4.ai; |
| 84776 | 84784 | assert( nRoot>0 ); |
| 84777 | - assert( aRoot[nRoot]==0 ); | |
| 84785 | + assert( aRoot[0]==nRoot ); | |
| 84778 | 84786 | assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); |
| 84779 | 84787 | pnErr = &aMem[pOp->p3]; |
| 84780 | 84788 | assert( (pnErr->flags & MEM_Int)!=0 ); |
| 84781 | 84789 | assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 ); |
| 84782 | 84790 | pIn1 = &aMem[pOp->p1]; |
| 84783 | 84791 | assert( pOp->p5<db->nDb ); |
| 84784 | 84792 | assert( DbMaskTest(p->btreeMask, pOp->p5) ); |
| 84785 | - z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot, | |
| 84793 | + z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, &aRoot[1], nRoot, | |
| 84786 | 84794 | (int)pnErr->u.i+1, &nErr); |
| 84787 | 84795 | sqlite3VdbeMemSetNull(pIn1); |
| 84788 | 84796 | if( nErr==0 ){ |
| 84789 | 84797 | assert( z==0 ); |
| 84790 | 84798 | }else if( z==0 ){ |
| @@ -115746,16 +115754,16 @@ | ||
| 115746 | 115754 | aRoot = sqlite3DbMallocRawNN(db, sizeof(int)*(cnt+1)); |
| 115747 | 115755 | if( aRoot==0 ) break; |
| 115748 | 115756 | for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ |
| 115749 | 115757 | Table *pTab = sqliteHashData(x); |
| 115750 | 115758 | Index *pIdx; |
| 115751 | - if( HasRowid(pTab) ) aRoot[cnt++] = pTab->tnum; | |
| 115759 | + if( HasRowid(pTab) ) aRoot[++cnt] = pTab->tnum; | |
| 115752 | 115760 | for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
| 115753 | - aRoot[cnt++] = pIdx->tnum; | |
| 115761 | + aRoot[++cnt] = pIdx->tnum; | |
| 115754 | 115762 | } |
| 115755 | 115763 | } |
| 115756 | - aRoot[cnt] = 0; | |
| 115764 | + aRoot[0] = cnt; | |
| 115757 | 115765 | |
| 115758 | 115766 | /* Make sure sufficient number of registers have been allocated */ |
| 115759 | 115767 | pParse->nMem = MAX( pParse->nMem, 8+mxIdx ); |
| 115760 | 115768 | sqlite3ClearTempRegCache(pParse); |
| 115761 | 115769 | |
| @@ -168376,11 +168384,11 @@ | ||
| 168376 | 168384 | */ |
| 168377 | 168385 | static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ |
| 168378 | 168386 | int rc; /* Return code */ |
| 168379 | 168387 | RtreeNode *pLeaf = 0; /* Leaf node containing record iDelete */ |
| 168380 | 168388 | int iCell; /* Index of iDelete cell in pLeaf */ |
| 168381 | - RtreeNode *pRoot; /* Root node of rtree structure */ | |
| 168389 | + RtreeNode *pRoot = 0; /* Root node of rtree structure */ | |
| 168382 | 168390 | |
| 168383 | 168391 | |
| 168384 | 168392 | /* Obtain a reference to the root node to initialize Rtree.iDepth */ |
| 168385 | 168393 | rc = nodeAcquire(pRtree, 1, 0, &pRoot); |
| 168386 | 168394 | |
| @@ -169404,19 +169412,19 @@ | ||
| 169404 | 169412 | static int icuLikeCompare( |
| 169405 | 169413 | const uint8_t *zPattern, /* LIKE pattern */ |
| 169406 | 169414 | const uint8_t *zString, /* The UTF-8 string to compare against */ |
| 169407 | 169415 | const UChar32 uEsc /* The escape character */ |
| 169408 | 169416 | ){ |
| 169409 | - static const int MATCH_ONE = (UChar32)'_'; | |
| 169410 | - static const int MATCH_ALL = (UChar32)'%'; | |
| 169417 | + static const uint32_t MATCH_ONE = (uint32_t)'_'; | |
| 169418 | + static const uint32_t MATCH_ALL = (uint32_t)'%'; | |
| 169411 | 169419 | |
| 169412 | 169420 | int prevEscape = 0; /* True if the previous character was uEsc */ |
| 169413 | 169421 | |
| 169414 | 169422 | while( 1 ){ |
| 169415 | 169423 | |
| 169416 | 169424 | /* Read (and consume) the next character from the input pattern. */ |
| 169417 | - UChar32 uPattern; | |
| 169425 | + uint32_t uPattern; | |
| 169418 | 169426 | SQLITE_ICU_READ_UTF8(zPattern, uPattern); |
| 169419 | 169427 | if( uPattern==0 ) break; |
| 169420 | 169428 | |
| 169421 | 169429 | /* There are now 4 possibilities: |
| 169422 | 169430 | ** |
| @@ -169454,20 +169462,20 @@ | ||
| 169454 | 169462 | }else if( !prevEscape && uPattern==MATCH_ONE ){ |
| 169455 | 169463 | /* Case 2. */ |
| 169456 | 169464 | if( *zString==0 ) return 0; |
| 169457 | 169465 | SQLITE_ICU_SKIP_UTF8(zString); |
| 169458 | 169466 | |
| 169459 | - }else if( !prevEscape && uPattern==uEsc){ | |
| 169467 | + }else if( !prevEscape && uPattern==(uint32_t)uEsc){ | |
| 169460 | 169468 | /* Case 3. */ |
| 169461 | 169469 | prevEscape = 1; |
| 169462 | 169470 | |
| 169463 | 169471 | }else{ |
| 169464 | 169472 | /* Case 4. */ |
| 169465 | - UChar32 uString; | |
| 169473 | + uint32_t uString; | |
| 169466 | 169474 | SQLITE_ICU_READ_UTF8(zString, uString); |
| 169467 | - uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT); | |
| 169468 | - uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT); | |
| 169475 | + uString = (uint32_t)u_foldCase((UChar32)uString, U_FOLD_CASE_DEFAULT); | |
| 169476 | + uPattern = (uint32_t)u_foldCase((UChar32)uPattern, U_FOLD_CASE_DEFAULT); | |
| 169469 | 169477 | if( uString!=uPattern ){ |
| 169470 | 169478 | return 0; |
| 169471 | 169479 | } |
| 169472 | 169480 | prevEscape = 0; |
| 169473 | 169481 | } |
| @@ -200624,11 +200632,11 @@ | ||
| 200624 | 200632 | int nArg, /* Number of args */ |
| 200625 | 200633 | sqlite3_value **apUnused /* Function arguments */ |
| 200626 | 200634 | ){ |
| 200627 | 200635 | assert( nArg==0 ); |
| 200628 | 200636 | UNUSED_PARAM2(nArg, apUnused); |
| 200629 | - sqlite3_result_text(pCtx, "fts5: 2017-09-20 10:47:10 7f2bd4ff45fba29528c18cac6da983bd9b164303525d3965056f5b40f85dc83f", -1, SQLITE_TRANSIENT); | |
| 200637 | + sqlite3_result_text(pCtx, "fts5: 2017-09-21 20:43:48 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43", -1, SQLITE_TRANSIENT); | |
| 200630 | 200638 | } |
| 200631 | 200639 | |
| 200632 | 200640 | static int fts5Init(sqlite3 *db){ |
| 200633 | 200641 | static const sqlite3_module fts5Mod = { |
| 200634 | 200642 | /* iVersion */ 2, |
| @@ -204893,12 +204901,12 @@ | ||
| 204893 | 204901 | } |
| 204894 | 204902 | #endif /* SQLITE_CORE */ |
| 204895 | 204903 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 204896 | 204904 | |
| 204897 | 204905 | /************** End of stmt.c ************************************************/ |
| 204898 | -#if __LINE__!=204898 | |
| 204906 | +#if __LINE__!=204906 | |
| 204899 | 204907 | #undef SQLITE_SOURCE_ID |
| 204900 | -#define SQLITE_SOURCE_ID "2017-09-20 10:47:10 fd7743d96ebeacce621dc79a4de408fbda6a9b35657628e71ac6e3c12595alt2" | |
| 204908 | +#define SQLITE_SOURCE_ID "2017-09-21 20:43:48 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c14alt2" | |
| 204901 | 204909 | #endif |
| 204902 | 204910 | /* Return the source-id for this library */ |
| 204903 | 204911 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 204904 | 204912 | /************************** End of sqlite3.c ******************************/ |
| 204905 | 204913 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -1147,11 +1147,11 @@ | |
| 1147 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1148 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1149 | */ |
| 1150 | #define SQLITE_VERSION "3.21.0" |
| 1151 | #define SQLITE_VERSION_NUMBER 3021000 |
| 1152 | #define SQLITE_SOURCE_ID "2017-09-20 10:47:10 fd7743d96ebeacce621dc79a4de408fbda6a9b35657628e71ac6e3c12595c9d0" |
| 1153 | |
| 1154 | /* |
| 1155 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1156 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1157 | ** |
| @@ -43098,10 +43098,18 @@ | |
| 43098 | #endif |
| 43099 | } |
| 43100 | return (attr!=INVALID_FILE_ATTRIBUTES) && (attr&FILE_ATTRIBUTE_DIRECTORY); |
| 43101 | } |
| 43102 | |
| 43103 | /* |
| 43104 | ** Open a file. |
| 43105 | */ |
| 43106 | static int winOpen( |
| 43107 | sqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */ |
| @@ -43283,19 +43291,24 @@ | |
| 43283 | &extendedParameters))==INVALID_HANDLE_VALUE && |
| 43284 | winRetryIoerr(&cnt, &lastErrno) ){ |
| 43285 | /* Noop */ |
| 43286 | } |
| 43287 | #else |
| 43288 | while( (h = osCreateFileW((LPCWSTR)zConverted, |
| 43289 | dwDesiredAccess, |
| 43290 | dwShareMode, NULL, |
| 43291 | dwCreationDisposition, |
| 43292 | dwFlagsAndAttributes, |
| 43293 | NULL))==INVALID_HANDLE_VALUE && |
| 43294 | winRetryIoerr(&cnt, &lastErrno) ){ |
| 43295 | /* Noop */ |
| 43296 | } |
| 43297 | #endif |
| 43298 | } |
| 43299 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 43300 | else{ |
| 43301 | while( (h = osCreateFileA((LPCSTR)zConverted, |
| @@ -43313,20 +43326,20 @@ | |
| 43313 | |
| 43314 | OSTRACE(("OPEN file=%p, name=%s, access=%lx, rc=%s\n", h, zUtf8Name, |
| 43315 | dwDesiredAccess, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); |
| 43316 | |
| 43317 | if( h==INVALID_HANDLE_VALUE ){ |
| 43318 | pFile->lastErrno = lastErrno; |
| 43319 | winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name); |
| 43320 | sqlite3_free(zConverted); |
| 43321 | sqlite3_free(zTmpname); |
| 43322 | if( isReadWrite && !isExclusive ){ |
| 43323 | return winOpen(pVfs, zName, id, |
| 43324 | ((flags|SQLITE_OPEN_READONLY) & |
| 43325 | ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)), |
| 43326 | pOutFlags); |
| 43327 | }else{ |
| 43328 | return SQLITE_CANTOPEN_BKPT; |
| 43329 | } |
| 43330 | } |
| 43331 | |
| 43332 | if( pOutFlags ){ |
| @@ -70512,11 +70525,11 @@ | |
| 70512 | testcase( bPreserve && pMem->z==0 ); |
| 70513 | |
| 70514 | assert( pMem->szMalloc==0 |
| 70515 | || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) ); |
| 70516 | if( n<32 ) n = 32; |
| 70517 | if( bPreserve && pMem->szMalloc>0 && pMem->z==pMem->zMalloc ){ |
| 70518 | pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n); |
| 70519 | bPreserve = 0; |
| 70520 | }else{ |
| 70521 | if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc); |
| 70522 | pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n); |
| @@ -70528,11 +70541,12 @@ | |
| 70528 | return SQLITE_NOMEM_BKPT; |
| 70529 | }else{ |
| 70530 | pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc); |
| 70531 | } |
| 70532 | |
| 70533 | if( bPreserve && pMem->z && ALWAYS(pMem->z!=pMem->zMalloc) ){ |
| 70534 | memcpy(pMem->zMalloc, pMem->z, pMem->n); |
| 70535 | } |
| 70536 | if( (pMem->flags&MEM_Dyn)!=0 ){ |
| 70537 | assert( pMem->xDel!=0 && pMem->xDel!=SQLITE_DYNAMIC ); |
| 70538 | pMem->xDel((void *)(pMem->z)); |
| @@ -70565,10 +70579,24 @@ | |
| 70565 | assert( (pMem->flags & MEM_Dyn)==0 ); |
| 70566 | pMem->z = pMem->zMalloc; |
| 70567 | pMem->flags &= (MEM_Null|MEM_Int|MEM_Real); |
| 70568 | return SQLITE_OK; |
| 70569 | } |
| 70570 | |
| 70571 | /* |
| 70572 | ** Change pMem so that its MEM_Str or MEM_Blob value is stored in |
| 70573 | ** MEM.zMalloc, where it can be safely written. |
| 70574 | ** |
| @@ -70578,16 +70606,12 @@ | |
| 70578 | assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); |
| 70579 | assert( (pMem->flags&MEM_RowSet)==0 ); |
| 70580 | if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){ |
| 70581 | if( ExpandBlob(pMem) ) return SQLITE_NOMEM; |
| 70582 | if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){ |
| 70583 | if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){ |
| 70584 | return SQLITE_NOMEM_BKPT; |
| 70585 | } |
| 70586 | pMem->z[pMem->n] = 0; |
| 70587 | pMem->z[pMem->n+1] = 0; |
| 70588 | pMem->flags |= MEM_Term; |
| 70589 | } |
| 70590 | } |
| 70591 | pMem->flags &= ~MEM_Ephem; |
| 70592 | #ifdef SQLITE_DEBUG |
| 70593 | pMem->pScopyFrom = 0; |
| @@ -70622,24 +70646,10 @@ | |
| 70622 | pMem->flags &= ~(MEM_Zero|MEM_Term); |
| 70623 | return SQLITE_OK; |
| 70624 | } |
| 70625 | #endif |
| 70626 | |
| 70627 | /* |
| 70628 | ** It is already known that pMem contains an unterminated string. |
| 70629 | ** Add the zero terminator. |
| 70630 | */ |
| 70631 | static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){ |
| 70632 | if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){ |
| 70633 | return SQLITE_NOMEM_BKPT; |
| 70634 | } |
| 70635 | pMem->z[pMem->n] = 0; |
| 70636 | pMem->z[pMem->n+1] = 0; |
| 70637 | pMem->flags |= MEM_Term; |
| 70638 | return SQLITE_OK; |
| 70639 | } |
| 70640 | |
| 70641 | /* |
| 70642 | ** Make sure the given Mem is \u0000 terminated. |
| 70643 | */ |
| 70644 | SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){ |
| 70645 | assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); |
| @@ -71373,16 +71383,14 @@ | |
| 71373 | u32 amt, /* Number of bytes to return. */ |
| 71374 | Mem *pMem /* OUT: Return data in this Mem structure. */ |
| 71375 | ){ |
| 71376 | int rc; |
| 71377 | pMem->flags = MEM_Null; |
| 71378 | if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+2)) ){ |
| 71379 | rc = sqlite3BtreePayload(pCur, offset, amt, pMem->z); |
| 71380 | if( rc==SQLITE_OK ){ |
| 71381 | pMem->z[amt] = 0; |
| 71382 | pMem->z[amt+1] = 0; |
| 71383 | pMem->flags = MEM_Blob|MEM_Term; |
| 71384 | pMem->n = (int)amt; |
| 71385 | }else{ |
| 71386 | sqlite3VdbeMemRelease(pMem); |
| 71387 | } |
| 71388 | } |
| @@ -73522,11 +73530,11 @@ | |
| 73522 | case P4_INTARRAY: { |
| 73523 | int i; |
| 73524 | int *ai = pOp->p4.ai; |
| 73525 | int n = ai[0]; /* The first element of an INTARRAY is always the |
| 73526 | ** count of the number of elements to follow */ |
| 73527 | for(i=1; i<n; i++){ |
| 73528 | sqlite3XPrintf(&x, ",%d", ai[i]); |
| 73529 | } |
| 73530 | zTemp[0] = '['; |
| 73531 | sqlite3StrAccumAppend(&x, "]", 1); |
| 73532 | break; |
| @@ -84772,19 +84780,19 @@ | |
| 84772 | |
| 84773 | assert( p->bIsReader ); |
| 84774 | nRoot = pOp->p2; |
| 84775 | aRoot = pOp->p4.ai; |
| 84776 | assert( nRoot>0 ); |
| 84777 | assert( aRoot[nRoot]==0 ); |
| 84778 | assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); |
| 84779 | pnErr = &aMem[pOp->p3]; |
| 84780 | assert( (pnErr->flags & MEM_Int)!=0 ); |
| 84781 | assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 ); |
| 84782 | pIn1 = &aMem[pOp->p1]; |
| 84783 | assert( pOp->p5<db->nDb ); |
| 84784 | assert( DbMaskTest(p->btreeMask, pOp->p5) ); |
| 84785 | z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot, |
| 84786 | (int)pnErr->u.i+1, &nErr); |
| 84787 | sqlite3VdbeMemSetNull(pIn1); |
| 84788 | if( nErr==0 ){ |
| 84789 | assert( z==0 ); |
| 84790 | }else if( z==0 ){ |
| @@ -115746,16 +115754,16 @@ | |
| 115746 | aRoot = sqlite3DbMallocRawNN(db, sizeof(int)*(cnt+1)); |
| 115747 | if( aRoot==0 ) break; |
| 115748 | for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ |
| 115749 | Table *pTab = sqliteHashData(x); |
| 115750 | Index *pIdx; |
| 115751 | if( HasRowid(pTab) ) aRoot[cnt++] = pTab->tnum; |
| 115752 | for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
| 115753 | aRoot[cnt++] = pIdx->tnum; |
| 115754 | } |
| 115755 | } |
| 115756 | aRoot[cnt] = 0; |
| 115757 | |
| 115758 | /* Make sure sufficient number of registers have been allocated */ |
| 115759 | pParse->nMem = MAX( pParse->nMem, 8+mxIdx ); |
| 115760 | sqlite3ClearTempRegCache(pParse); |
| 115761 | |
| @@ -168376,11 +168384,11 @@ | |
| 168376 | */ |
| 168377 | static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ |
| 168378 | int rc; /* Return code */ |
| 168379 | RtreeNode *pLeaf = 0; /* Leaf node containing record iDelete */ |
| 168380 | int iCell; /* Index of iDelete cell in pLeaf */ |
| 168381 | RtreeNode *pRoot; /* Root node of rtree structure */ |
| 168382 | |
| 168383 | |
| 168384 | /* Obtain a reference to the root node to initialize Rtree.iDepth */ |
| 168385 | rc = nodeAcquire(pRtree, 1, 0, &pRoot); |
| 168386 | |
| @@ -169404,19 +169412,19 @@ | |
| 169404 | static int icuLikeCompare( |
| 169405 | const uint8_t *zPattern, /* LIKE pattern */ |
| 169406 | const uint8_t *zString, /* The UTF-8 string to compare against */ |
| 169407 | const UChar32 uEsc /* The escape character */ |
| 169408 | ){ |
| 169409 | static const int MATCH_ONE = (UChar32)'_'; |
| 169410 | static const int MATCH_ALL = (UChar32)'%'; |
| 169411 | |
| 169412 | int prevEscape = 0; /* True if the previous character was uEsc */ |
| 169413 | |
| 169414 | while( 1 ){ |
| 169415 | |
| 169416 | /* Read (and consume) the next character from the input pattern. */ |
| 169417 | UChar32 uPattern; |
| 169418 | SQLITE_ICU_READ_UTF8(zPattern, uPattern); |
| 169419 | if( uPattern==0 ) break; |
| 169420 | |
| 169421 | /* There are now 4 possibilities: |
| 169422 | ** |
| @@ -169454,20 +169462,20 @@ | |
| 169454 | }else if( !prevEscape && uPattern==MATCH_ONE ){ |
| 169455 | /* Case 2. */ |
| 169456 | if( *zString==0 ) return 0; |
| 169457 | SQLITE_ICU_SKIP_UTF8(zString); |
| 169458 | |
| 169459 | }else if( !prevEscape && uPattern==uEsc){ |
| 169460 | /* Case 3. */ |
| 169461 | prevEscape = 1; |
| 169462 | |
| 169463 | }else{ |
| 169464 | /* Case 4. */ |
| 169465 | UChar32 uString; |
| 169466 | SQLITE_ICU_READ_UTF8(zString, uString); |
| 169467 | uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT); |
| 169468 | uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT); |
| 169469 | if( uString!=uPattern ){ |
| 169470 | return 0; |
| 169471 | } |
| 169472 | prevEscape = 0; |
| 169473 | } |
| @@ -200624,11 +200632,11 @@ | |
| 200624 | int nArg, /* Number of args */ |
| 200625 | sqlite3_value **apUnused /* Function arguments */ |
| 200626 | ){ |
| 200627 | assert( nArg==0 ); |
| 200628 | UNUSED_PARAM2(nArg, apUnused); |
| 200629 | sqlite3_result_text(pCtx, "fts5: 2017-09-20 10:47:10 7f2bd4ff45fba29528c18cac6da983bd9b164303525d3965056f5b40f85dc83f", -1, SQLITE_TRANSIENT); |
| 200630 | } |
| 200631 | |
| 200632 | static int fts5Init(sqlite3 *db){ |
| 200633 | static const sqlite3_module fts5Mod = { |
| 200634 | /* iVersion */ 2, |
| @@ -204893,12 +204901,12 @@ | |
| 204893 | } |
| 204894 | #endif /* SQLITE_CORE */ |
| 204895 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 204896 | |
| 204897 | /************** End of stmt.c ************************************************/ |
| 204898 | #if __LINE__!=204898 |
| 204899 | #undef SQLITE_SOURCE_ID |
| 204900 | #define SQLITE_SOURCE_ID "2017-09-20 10:47:10 fd7743d96ebeacce621dc79a4de408fbda6a9b35657628e71ac6e3c12595alt2" |
| 204901 | #endif |
| 204902 | /* Return the source-id for this library */ |
| 204903 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 204904 | /************************** End of sqlite3.c ******************************/ |
| 204905 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -1147,11 +1147,11 @@ | |
| 1147 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1148 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1149 | */ |
| 1150 | #define SQLITE_VERSION "3.21.0" |
| 1151 | #define SQLITE_VERSION_NUMBER 3021000 |
| 1152 | #define SQLITE_SOURCE_ID "2017-09-21 20:43:48 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43" |
| 1153 | |
| 1154 | /* |
| 1155 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1156 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1157 | ** |
| @@ -43098,10 +43098,18 @@ | |
| 43098 | #endif |
| 43099 | } |
| 43100 | return (attr!=INVALID_FILE_ATTRIBUTES) && (attr&FILE_ATTRIBUTE_DIRECTORY); |
| 43101 | } |
| 43102 | |
| 43103 | /* forward reference */ |
| 43104 | static int winAccess( |
| 43105 | sqlite3_vfs *pVfs, /* Not used on win32 */ |
| 43106 | const char *zFilename, /* Name of file to check */ |
| 43107 | int flags, /* Type of test to make on this file */ |
| 43108 | int *pResOut /* OUT: Result */ |
| 43109 | ); |
| 43110 | |
| 43111 | /* |
| 43112 | ** Open a file. |
| 43113 | */ |
| 43114 | static int winOpen( |
| 43115 | sqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */ |
| @@ -43283,19 +43291,24 @@ | |
| 43291 | &extendedParameters))==INVALID_HANDLE_VALUE && |
| 43292 | winRetryIoerr(&cnt, &lastErrno) ){ |
| 43293 | /* Noop */ |
| 43294 | } |
| 43295 | #else |
| 43296 | do{ |
| 43297 | h = osCreateFileW((LPCWSTR)zConverted, |
| 43298 | dwDesiredAccess, |
| 43299 | dwShareMode, NULL, |
| 43300 | dwCreationDisposition, |
| 43301 | dwFlagsAndAttributes, |
| 43302 | NULL); |
| 43303 | if( h!=INVALID_HANDLE_VALUE ) break; |
| 43304 | if( isReadWrite ){ |
| 43305 | int isRO = 0; |
| 43306 | int rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO); |
| 43307 | if( rc2==SQLITE_OK && isRO ) break; |
| 43308 | } |
| 43309 | }while( winRetryIoerr(&cnt, &lastErrno) ); |
| 43310 | #endif |
| 43311 | } |
| 43312 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 43313 | else{ |
| 43314 | while( (h = osCreateFileA((LPCSTR)zConverted, |
| @@ -43313,20 +43326,20 @@ | |
| 43326 | |
| 43327 | OSTRACE(("OPEN file=%p, name=%s, access=%lx, rc=%s\n", h, zUtf8Name, |
| 43328 | dwDesiredAccess, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); |
| 43329 | |
| 43330 | if( h==INVALID_HANDLE_VALUE ){ |
| 43331 | sqlite3_free(zConverted); |
| 43332 | sqlite3_free(zTmpname); |
| 43333 | if( isReadWrite && !isExclusive ){ |
| 43334 | return winOpen(pVfs, zName, id, |
| 43335 | ((flags|SQLITE_OPEN_READONLY) & |
| 43336 | ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)), |
| 43337 | pOutFlags); |
| 43338 | }else{ |
| 43339 | pFile->lastErrno = lastErrno; |
| 43340 | winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name); |
| 43341 | return SQLITE_CANTOPEN_BKPT; |
| 43342 | } |
| 43343 | } |
| 43344 | |
| 43345 | if( pOutFlags ){ |
| @@ -70512,11 +70525,11 @@ | |
| 70525 | testcase( bPreserve && pMem->z==0 ); |
| 70526 | |
| 70527 | assert( pMem->szMalloc==0 |
| 70528 | || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) ); |
| 70529 | if( n<32 ) n = 32; |
| 70530 | if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){ |
| 70531 | pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n); |
| 70532 | bPreserve = 0; |
| 70533 | }else{ |
| 70534 | if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc); |
| 70535 | pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n); |
| @@ -70528,11 +70541,12 @@ | |
| 70541 | return SQLITE_NOMEM_BKPT; |
| 70542 | }else{ |
| 70543 | pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc); |
| 70544 | } |
| 70545 | |
| 70546 | if( bPreserve && pMem->z ){ |
| 70547 | assert( pMem->z!=pMem->zMalloc ); |
| 70548 | memcpy(pMem->zMalloc, pMem->z, pMem->n); |
| 70549 | } |
| 70550 | if( (pMem->flags&MEM_Dyn)!=0 ){ |
| 70551 | assert( pMem->xDel!=0 && pMem->xDel!=SQLITE_DYNAMIC ); |
| 70552 | pMem->xDel((void *)(pMem->z)); |
| @@ -70565,10 +70579,24 @@ | |
| 70579 | assert( (pMem->flags & MEM_Dyn)==0 ); |
| 70580 | pMem->z = pMem->zMalloc; |
| 70581 | pMem->flags &= (MEM_Null|MEM_Int|MEM_Real); |
| 70582 | return SQLITE_OK; |
| 70583 | } |
| 70584 | |
| 70585 | /* |
| 70586 | ** It is already known that pMem contains an unterminated string. |
| 70587 | ** Add the zero terminator. |
| 70588 | */ |
| 70589 | static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){ |
| 70590 | if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){ |
| 70591 | return SQLITE_NOMEM_BKPT; |
| 70592 | } |
| 70593 | pMem->z[pMem->n] = 0; |
| 70594 | pMem->z[pMem->n+1] = 0; |
| 70595 | pMem->flags |= MEM_Term; |
| 70596 | return SQLITE_OK; |
| 70597 | } |
| 70598 | |
| 70599 | /* |
| 70600 | ** Change pMem so that its MEM_Str or MEM_Blob value is stored in |
| 70601 | ** MEM.zMalloc, where it can be safely written. |
| 70602 | ** |
| @@ -70578,16 +70606,12 @@ | |
| 70606 | assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); |
| 70607 | assert( (pMem->flags&MEM_RowSet)==0 ); |
| 70608 | if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){ |
| 70609 | if( ExpandBlob(pMem) ) return SQLITE_NOMEM; |
| 70610 | if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){ |
| 70611 | int rc = vdbeMemAddTerminator(pMem); |
| 70612 | if( rc ) return rc; |
| 70613 | } |
| 70614 | } |
| 70615 | pMem->flags &= ~MEM_Ephem; |
| 70616 | #ifdef SQLITE_DEBUG |
| 70617 | pMem->pScopyFrom = 0; |
| @@ -70622,24 +70646,10 @@ | |
| 70646 | pMem->flags &= ~(MEM_Zero|MEM_Term); |
| 70647 | return SQLITE_OK; |
| 70648 | } |
| 70649 | #endif |
| 70650 | |
| 70651 | /* |
| 70652 | ** Make sure the given Mem is \u0000 terminated. |
| 70653 | */ |
| 70654 | SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){ |
| 70655 | assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); |
| @@ -71373,16 +71383,14 @@ | |
| 71383 | u32 amt, /* Number of bytes to return. */ |
| 71384 | Mem *pMem /* OUT: Return data in this Mem structure. */ |
| 71385 | ){ |
| 71386 | int rc; |
| 71387 | pMem->flags = MEM_Null; |
| 71388 | if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt)) ){ |
| 71389 | rc = sqlite3BtreePayload(pCur, offset, amt, pMem->z); |
| 71390 | if( rc==SQLITE_OK ){ |
| 71391 | pMem->flags = MEM_Blob; |
| 71392 | pMem->n = (int)amt; |
| 71393 | }else{ |
| 71394 | sqlite3VdbeMemRelease(pMem); |
| 71395 | } |
| 71396 | } |
| @@ -73522,11 +73530,11 @@ | |
| 73530 | case P4_INTARRAY: { |
| 73531 | int i; |
| 73532 | int *ai = pOp->p4.ai; |
| 73533 | int n = ai[0]; /* The first element of an INTARRAY is always the |
| 73534 | ** count of the number of elements to follow */ |
| 73535 | for(i=1; i<=n; i++){ |
| 73536 | sqlite3XPrintf(&x, ",%d", ai[i]); |
| 73537 | } |
| 73538 | zTemp[0] = '['; |
| 73539 | sqlite3StrAccumAppend(&x, "]", 1); |
| 73540 | break; |
| @@ -84772,19 +84780,19 @@ | |
| 84780 | |
| 84781 | assert( p->bIsReader ); |
| 84782 | nRoot = pOp->p2; |
| 84783 | aRoot = pOp->p4.ai; |
| 84784 | assert( nRoot>0 ); |
| 84785 | assert( aRoot[0]==nRoot ); |
| 84786 | assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); |
| 84787 | pnErr = &aMem[pOp->p3]; |
| 84788 | assert( (pnErr->flags & MEM_Int)!=0 ); |
| 84789 | assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 ); |
| 84790 | pIn1 = &aMem[pOp->p1]; |
| 84791 | assert( pOp->p5<db->nDb ); |
| 84792 | assert( DbMaskTest(p->btreeMask, pOp->p5) ); |
| 84793 | z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, &aRoot[1], nRoot, |
| 84794 | (int)pnErr->u.i+1, &nErr); |
| 84795 | sqlite3VdbeMemSetNull(pIn1); |
| 84796 | if( nErr==0 ){ |
| 84797 | assert( z==0 ); |
| 84798 | }else if( z==0 ){ |
| @@ -115746,16 +115754,16 @@ | |
| 115754 | aRoot = sqlite3DbMallocRawNN(db, sizeof(int)*(cnt+1)); |
| 115755 | if( aRoot==0 ) break; |
| 115756 | for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ |
| 115757 | Table *pTab = sqliteHashData(x); |
| 115758 | Index *pIdx; |
| 115759 | if( HasRowid(pTab) ) aRoot[++cnt] = pTab->tnum; |
| 115760 | for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
| 115761 | aRoot[++cnt] = pIdx->tnum; |
| 115762 | } |
| 115763 | } |
| 115764 | aRoot[0] = cnt; |
| 115765 | |
| 115766 | /* Make sure sufficient number of registers have been allocated */ |
| 115767 | pParse->nMem = MAX( pParse->nMem, 8+mxIdx ); |
| 115768 | sqlite3ClearTempRegCache(pParse); |
| 115769 | |
| @@ -168376,11 +168384,11 @@ | |
| 168384 | */ |
| 168385 | static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ |
| 168386 | int rc; /* Return code */ |
| 168387 | RtreeNode *pLeaf = 0; /* Leaf node containing record iDelete */ |
| 168388 | int iCell; /* Index of iDelete cell in pLeaf */ |
| 168389 | RtreeNode *pRoot = 0; /* Root node of rtree structure */ |
| 168390 | |
| 168391 | |
| 168392 | /* Obtain a reference to the root node to initialize Rtree.iDepth */ |
| 168393 | rc = nodeAcquire(pRtree, 1, 0, &pRoot); |
| 168394 | |
| @@ -169404,19 +169412,19 @@ | |
| 169412 | static int icuLikeCompare( |
| 169413 | const uint8_t *zPattern, /* LIKE pattern */ |
| 169414 | const uint8_t *zString, /* The UTF-8 string to compare against */ |
| 169415 | const UChar32 uEsc /* The escape character */ |
| 169416 | ){ |
| 169417 | static const uint32_t MATCH_ONE = (uint32_t)'_'; |
| 169418 | static const uint32_t MATCH_ALL = (uint32_t)'%'; |
| 169419 | |
| 169420 | int prevEscape = 0; /* True if the previous character was uEsc */ |
| 169421 | |
| 169422 | while( 1 ){ |
| 169423 | |
| 169424 | /* Read (and consume) the next character from the input pattern. */ |
| 169425 | uint32_t uPattern; |
| 169426 | SQLITE_ICU_READ_UTF8(zPattern, uPattern); |
| 169427 | if( uPattern==0 ) break; |
| 169428 | |
| 169429 | /* There are now 4 possibilities: |
| 169430 | ** |
| @@ -169454,20 +169462,20 @@ | |
| 169462 | }else if( !prevEscape && uPattern==MATCH_ONE ){ |
| 169463 | /* Case 2. */ |
| 169464 | if( *zString==0 ) return 0; |
| 169465 | SQLITE_ICU_SKIP_UTF8(zString); |
| 169466 | |
| 169467 | }else if( !prevEscape && uPattern==(uint32_t)uEsc){ |
| 169468 | /* Case 3. */ |
| 169469 | prevEscape = 1; |
| 169470 | |
| 169471 | }else{ |
| 169472 | /* Case 4. */ |
| 169473 | uint32_t uString; |
| 169474 | SQLITE_ICU_READ_UTF8(zString, uString); |
| 169475 | uString = (uint32_t)u_foldCase((UChar32)uString, U_FOLD_CASE_DEFAULT); |
| 169476 | uPattern = (uint32_t)u_foldCase((UChar32)uPattern, U_FOLD_CASE_DEFAULT); |
| 169477 | if( uString!=uPattern ){ |
| 169478 | return 0; |
| 169479 | } |
| 169480 | prevEscape = 0; |
| 169481 | } |
| @@ -200624,11 +200632,11 @@ | |
| 200632 | int nArg, /* Number of args */ |
| 200633 | sqlite3_value **apUnused /* Function arguments */ |
| 200634 | ){ |
| 200635 | assert( nArg==0 ); |
| 200636 | UNUSED_PARAM2(nArg, apUnused); |
| 200637 | sqlite3_result_text(pCtx, "fts5: 2017-09-21 20:43:48 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43", -1, SQLITE_TRANSIENT); |
| 200638 | } |
| 200639 | |
| 200640 | static int fts5Init(sqlite3 *db){ |
| 200641 | static const sqlite3_module fts5Mod = { |
| 200642 | /* iVersion */ 2, |
| @@ -204893,12 +204901,12 @@ | |
| 204901 | } |
| 204902 | #endif /* SQLITE_CORE */ |
| 204903 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 204904 | |
| 204905 | /************** End of stmt.c ************************************************/ |
| 204906 | #if __LINE__!=204906 |
| 204907 | #undef SQLITE_SOURCE_ID |
| 204908 | #define SQLITE_SOURCE_ID "2017-09-21 20:43:48 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c14alt2" |
| 204909 | #endif |
| 204910 | /* Return the source-id for this library */ |
| 204911 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 204912 | /************************** End of sqlite3.c ******************************/ |
| 204913 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -123,11 +123,11 @@ | ||
| 123 | 123 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 124 | 124 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 125 | 125 | */ |
| 126 | 126 | #define SQLITE_VERSION "3.21.0" |
| 127 | 127 | #define SQLITE_VERSION_NUMBER 3021000 |
| 128 | -#define SQLITE_SOURCE_ID "2017-09-20 10:47:10 fd7743d96ebeacce621dc79a4de408fbda6a9b35657628e71ac6e3c12595c9d0" | |
| 128 | +#define SQLITE_SOURCE_ID "2017-09-21 20:43:48 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43" | |
| 129 | 129 | |
| 130 | 130 | /* |
| 131 | 131 | ** CAPI3REF: Run-Time Library Version Numbers |
| 132 | 132 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 133 | 133 | ** |
| 134 | 134 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -123,11 +123,11 @@ | |
| 123 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 124 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 125 | */ |
| 126 | #define SQLITE_VERSION "3.21.0" |
| 127 | #define SQLITE_VERSION_NUMBER 3021000 |
| 128 | #define SQLITE_SOURCE_ID "2017-09-20 10:47:10 fd7743d96ebeacce621dc79a4de408fbda6a9b35657628e71ac6e3c12595c9d0" |
| 129 | |
| 130 | /* |
| 131 | ** CAPI3REF: Run-Time Library Version Numbers |
| 132 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 133 | ** |
| 134 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -123,11 +123,11 @@ | |
| 123 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 124 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 125 | */ |
| 126 | #define SQLITE_VERSION "3.21.0" |
| 127 | #define SQLITE_VERSION_NUMBER 3021000 |
| 128 | #define SQLITE_SOURCE_ID "2017-09-21 20:43:48 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43" |
| 129 | |
| 130 | /* |
| 131 | ** CAPI3REF: Run-Time Library Version Numbers |
| 132 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 133 | ** |
| 134 |