| | @@ -1165,11 +1165,11 @@ |
| 1165 | 1165 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1166 | 1166 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1167 | 1167 | */ |
| 1168 | 1168 | #define SQLITE_VERSION "3.30.0" |
| 1169 | 1169 | #define SQLITE_VERSION_NUMBER 3030000 |
| 1170 | | -#define SQLITE_SOURCE_ID "2019-09-26 16:57:42 49073b7003330027303c4c776e9f85112f8b99b89f848fec3f953eba501d7505" |
| 1170 | +#define SQLITE_SOURCE_ID "2019-10-04 15:03:17 c20a35336432025445f9f7e289d0cc3e4003fb17f45a4ce74c6269c407c6e09f" |
| 1171 | 1171 | |
| 1172 | 1172 | /* |
| 1173 | 1173 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1174 | 1174 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1175 | 1175 | ** |
| | @@ -16171,10 +16171,11 @@ |
| 16171 | 16171 | #define sqlite3MutexInit() SQLITE_OK |
| 16172 | 16172 | #define sqlite3MutexEnd() |
| 16173 | 16173 | #define MUTEX_LOGIC(X) |
| 16174 | 16174 | #else |
| 16175 | 16175 | #define MUTEX_LOGIC(X) X |
| 16176 | +SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); |
| 16176 | 16177 | #endif /* defined(SQLITE_MUTEX_OMIT) */ |
| 16177 | 16178 | |
| 16178 | 16179 | /************** End of mutex.h ***********************************************/ |
| 16179 | 16180 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 16180 | 16181 | |
| | @@ -17174,12 +17175,15 @@ |
| 17174 | 17175 | sqlite3 *db; /* The database connection */ |
| 17175 | 17176 | u8 *aSortFlags; /* Sort order for each column. */ |
| 17176 | 17177 | CollSeq *aColl[1]; /* Collating sequence for each term of the key */ |
| 17177 | 17178 | }; |
| 17178 | 17179 | |
| 17179 | | -#define KEYINFO_ORDER_DESC 0x01 |
| 17180 | | -#define KEYINFO_ORDER_BIGNULL 0x02 |
| 17180 | +/* |
| 17181 | +** Allowed bit values for entries in the KeyInfo.aSortFlags[] array. |
| 17182 | +*/ |
| 17183 | +#define KEYINFO_ORDER_DESC 0x01 /* DESC sort order */ |
| 17184 | +#define KEYINFO_ORDER_BIGNULL 0x02 /* NULL is larger than any other value */ |
| 17181 | 17185 | |
| 17182 | 17186 | /* |
| 17183 | 17187 | ** This object holds a record which has been parsed out into individual |
| 17184 | 17188 | ** fields, for the purposes of doing a comparison. |
| 17185 | 17189 | ** |
| | @@ -17505,10 +17509,11 @@ |
| 17505 | 17509 | #endif |
| 17506 | 17510 | int iTable; /* TK_COLUMN: cursor number of table holding column |
| 17507 | 17511 | ** TK_REGISTER: register number |
| 17508 | 17512 | ** TK_TRIGGER: 1 -> new, 0 -> old |
| 17509 | 17513 | ** EP_Unlikely: 134217728 times likelihood |
| 17514 | + ** TK_IN: ephemerial table holding RHS |
| 17510 | 17515 | ** TK_SELECT_COLUMN: Number of columns on the LHS |
| 17511 | 17516 | ** TK_SELECT: 1st register of result vector */ |
| 17512 | 17517 | ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. |
| 17513 | 17518 | ** TK_VARIABLE: variable number (always >= 1). |
| 17514 | 17519 | ** TK_SELECT_COLUMN: column of the result vector */ |
| | @@ -29226,13 +29231,14 @@ |
| 29226 | 29231 | break; |
| 29227 | 29232 | } |
| 29228 | 29233 | |
| 29229 | 29234 | case TK_COLLATE: { |
| 29230 | 29235 | /* COLLATE operators without the EP_Collate flag are intended to |
| 29231 | | - ** emulate collation associated with a table column. Explicit |
| 29232 | | - ** COLLATE operators that appear in the original SQL always have |
| 29233 | | - ** the EP_Collate bit set */ |
| 29236 | + ** emulate collation associated with a table column. These show |
| 29237 | + ** up in the treeview output as "SOFT-COLLATE". Explicit COLLATE |
| 29238 | + ** operators that appear in the original SQL always have the |
| 29239 | + ** EP_Collate bit set and appear in treeview output as just "COLLATE" */ |
| 29234 | 29240 | sqlite3TreeViewLine(pView, "%sCOLLATE %Q%s", |
| 29235 | 29241 | !ExprHasProperty(pExpr, EP_Collate) ? "SOFT-" : "", |
| 29236 | 29242 | pExpr->u.zToken, zFlgs); |
| 29237 | 29243 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 29238 | 29244 | break; |
| | @@ -32583,17 +32589,33 @@ |
| 32583 | 32589 | /* # include <sys/ioctl.h> */ |
| 32584 | 32590 | # include <sys/file.h> |
| 32585 | 32591 | # include <sys/param.h> |
| 32586 | 32592 | #endif /* SQLITE_ENABLE_LOCKING_STYLE */ |
| 32587 | 32593 | |
| 32588 | | -#if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \ |
| 32589 | | - (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000)) |
| 32590 | | -# if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \ |
| 32591 | | - && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0)) |
| 32592 | | -# define HAVE_GETHOSTUUID 1 |
| 32593 | | -# else |
| 32594 | | -# warning "gethostuuid() is disabled." |
| 32594 | +/* |
| 32595 | +** Try to determine if gethostuuid() is available based on standard |
| 32596 | +** macros. This might sometimes compute the wrong value for some |
| 32597 | +** obscure platforms. For those cases, simply compile with one of |
| 32598 | +** the following: |
| 32599 | +** |
| 32600 | +** -DHAVE_GETHOSTUUID=0 |
| 32601 | +** -DHAVE_GETHOSTUUID=1 |
| 32602 | +** |
| 32603 | +** None if this matters except when building on Apple products with |
| 32604 | +** -DSQLITE_ENABLE_LOCKING_STYLE. |
| 32605 | +*/ |
| 32606 | +#ifndef HAVE_GETHOSTUUID |
| 32607 | +# define HAVE_GETHOSTUUID 0 |
| 32608 | +# if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \ |
| 32609 | + (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000)) |
| 32610 | +# if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \ |
| 32611 | + && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0)) |
| 32612 | +# undef HAVE_GETHOSTUUID |
| 32613 | +# define HAVE_GETHOSTUUID 1 |
| 32614 | +# else |
| 32615 | +# warning "gethostuuid() is disabled." |
| 32616 | +# endif |
| 32595 | 32617 | # endif |
| 32596 | 32618 | #endif |
| 32597 | 32619 | |
| 32598 | 32620 | |
| 32599 | 32621 | #if OS_VXWORKS |
| | @@ -39605,11 +39627,11 @@ |
| 39605 | 39627 | SQLITE_API int sqlite3_hostid_num = 0; |
| 39606 | 39628 | #endif |
| 39607 | 39629 | |
| 39608 | 39630 | #define PROXY_HOSTIDLEN 16 /* conch file host id length */ |
| 39609 | 39631 | |
| 39610 | | -#ifdef HAVE_GETHOSTUUID |
| 39632 | +#if HAVE_GETHOSTUUID |
| 39611 | 39633 | /* Not always defined in the headers as it ought to be */ |
| 39612 | 39634 | extern int gethostuuid(uuid_t id, const struct timespec *wait); |
| 39613 | 39635 | #endif |
| 39614 | 39636 | |
| 39615 | 39637 | /* get the host ID via gethostuuid(), pHostID must point to PROXY_HOSTIDLEN |
| | @@ -39616,11 +39638,11 @@ |
| 39616 | 39638 | ** bytes of writable memory. |
| 39617 | 39639 | */ |
| 39618 | 39640 | static int proxyGetHostID(unsigned char *pHostID, int *pError){ |
| 39619 | 39641 | assert(PROXY_HOSTIDLEN == sizeof(uuid_t)); |
| 39620 | 39642 | memset(pHostID, 0, PROXY_HOSTIDLEN); |
| 39621 | | -#ifdef HAVE_GETHOSTUUID |
| 39643 | +#if HAVE_GETHOSTUUID |
| 39622 | 39644 | { |
| 39623 | 39645 | struct timespec timeout = {1, 0}; /* 1 sec timeout */ |
| 39624 | 39646 | if( gethostuuid(pHostID, &timeout) ){ |
| 39625 | 39647 | int err = errno; |
| 39626 | 39648 | if( pError ){ |
| | @@ -84381,11 +84403,11 @@ |
| 84381 | 84403 | printf(" ir:%lld", p->u.i); |
| 84382 | 84404 | }else if( p->flags & MEM_Int ){ |
| 84383 | 84405 | printf(" i:%lld", p->u.i); |
| 84384 | 84406 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 84385 | 84407 | }else if( p->flags & MEM_Real ){ |
| 84386 | | - printf(" r:%g", p->u.r); |
| 84408 | + printf(" r:%.17g", p->u.r); |
| 84387 | 84409 | #endif |
| 84388 | 84410 | }else if( sqlite3VdbeMemIsRowSet(p) ){ |
| 84389 | 84411 | printf(" (rowset)"); |
| 84390 | 84412 | }else{ |
| 84391 | 84413 | char zBuf[200]; |
| | @@ -102445,11 +102467,12 @@ |
| 102445 | 102467 | && pA->op!=TK_TRUEFALSE |
| 102446 | 102468 | && (combinedFlags & EP_Reduced)==0 |
| 102447 | 102469 | ){ |
| 102448 | 102470 | if( pA->iColumn!=pB->iColumn ) return 2; |
| 102449 | 102471 | if( pA->op2!=pB->op2 ) return 2; |
| 102450 | | - if( pA->iTable!=pB->iTable |
| 102472 | + if( pA->op!=TK_IN |
| 102473 | + && pA->iTable!=pB->iTable |
| 102451 | 102474 | && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; |
| 102452 | 102475 | } |
| 102453 | 102476 | } |
| 102454 | 102477 | return 0; |
| 102455 | 102478 | } |
| | @@ -110436,11 +110459,12 @@ |
| 110436 | 110459 | goto exit_drop_table; |
| 110437 | 110460 | } |
| 110438 | 110461 | } |
| 110439 | 110462 | #endif |
| 110440 | 110463 | if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 |
| 110441 | | - && sqlite3StrNICmp(pTab->zName, "sqlite_stat", 11)!=0 ){ |
| 110464 | + && sqlite3StrNICmp(pTab->zName+7, "stat", 4)!=0 |
| 110465 | + && sqlite3StrNICmp(pTab->zName+7, "parameters", 10)!=0 ){ |
| 110442 | 110466 | sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName); |
| 110443 | 110467 | goto exit_drop_table; |
| 110444 | 110468 | } |
| 110445 | 110469 | |
| 110446 | 110470 | #ifndef SQLITE_OMIT_VIEW |
| | @@ -121079,11 +121103,15 @@ |
| 121079 | 121103 | #endif |
| 121080 | 121104 | /* Version 3.28.0 and later */ |
| 121081 | 121105 | sqlite3_stmt_isexplain, |
| 121082 | 121106 | sqlite3_value_frombind, |
| 121083 | 121107 | /* Version 3.30.0 and later */ |
| 121108 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 121084 | 121109 | sqlite3_drop_modules, |
| 121110 | +#else |
| 121111 | + 0, |
| 121112 | +#endif |
| 121085 | 121113 | }; |
| 121086 | 121114 | |
| 121087 | 121115 | /* |
| 121088 | 121116 | ** Attempt to load an SQLite extension library contained in the file |
| 121089 | 121117 | ** zFile. The entry point is zProc. zProc may be 0 in which case a |
| | @@ -162211,10 +162239,22 @@ |
| 162211 | 162239 | #ifndef SQLITE_CORE |
| 162212 | 162240 | /* # include "sqlite3ext.h" */ |
| 162213 | 162241 | SQLITE_EXTENSION_INIT1 |
| 162214 | 162242 | #endif |
| 162215 | 162243 | |
| 162244 | +/* |
| 162245 | +** The following are copied from sqliteInt.h. |
| 162246 | +** |
| 162247 | +** Constants for the largest and smallest possible 64-bit signed integers. |
| 162248 | +** These macros are designed to work correctly on both 32-bit and 64-bit |
| 162249 | +** compilers. |
| 162250 | +*/ |
| 162251 | +#ifndef SQLITE_AMALGAMATION |
| 162252 | +# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32)) |
| 162253 | +# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64) |
| 162254 | +#endif |
| 162255 | + |
| 162216 | 162256 | static int fts3EvalNext(Fts3Cursor *pCsr); |
| 162217 | 162257 | static int fts3EvalStart(Fts3Cursor *pCsr); |
| 162218 | 162258 | static int fts3TermSegReaderCursor( |
| 162219 | 162259 | Fts3Cursor *, const char *, int, int, Fts3MultiSegReader **); |
| 162220 | 162260 | |
| | @@ -163989,14 +164029,15 @@ |
| 163989 | 164029 | } |
| 163990 | 164030 | *ppPoslist = pEnd; |
| 163991 | 164031 | } |
| 163992 | 164032 | |
| 163993 | 164033 | /* |
| 163994 | | -** Value used to signify the end of an position-list. This is safe because |
| 163995 | | -** it is not possible to have a document with 2^31 terms. |
| 164034 | +** Value used to signify the end of an position-list. This must be |
| 164035 | +** as large or larger than any value that might appear on the |
| 164036 | +** position-list, even a position list that has been corrupted. |
| 163996 | 164037 | */ |
| 163997 | | -#define POSITION_LIST_END 0x7fffffff |
| 164038 | +#define POSITION_LIST_END LARGEST_INT64 |
| 163998 | 164039 | |
| 163999 | 164040 | /* |
| 164000 | 164041 | ** This function is used to help parse position-lists. When this function is |
| 164001 | 164042 | ** called, *pp may point to the start of the next varint in the position-list |
| 164002 | 164043 | ** being parsed, or it may point to 1 byte past the end of the position-list |
| | @@ -164068,18 +164109,18 @@ |
| 164068 | 164109 | |
| 164069 | 164110 | if( *p1==POS_COLUMN ){ |
| 164070 | 164111 | fts3GetVarint32(&p1[1], &iCol1); |
| 164071 | 164112 | if( iCol1==0 ) return FTS_CORRUPT_VTAB; |
| 164072 | 164113 | } |
| 164073 | | - else if( *p1==POS_END ) iCol1 = POSITION_LIST_END; |
| 164114 | + else if( *p1==POS_END ) iCol1 = 0x7fffffff; |
| 164074 | 164115 | else iCol1 = 0; |
| 164075 | 164116 | |
| 164076 | 164117 | if( *p2==POS_COLUMN ){ |
| 164077 | 164118 | fts3GetVarint32(&p2[1], &iCol2); |
| 164078 | 164119 | if( iCol2==0 ) return FTS_CORRUPT_VTAB; |
| 164079 | 164120 | } |
| 164080 | | - else if( *p2==POS_END ) iCol2 = POSITION_LIST_END; |
| 164121 | + else if( *p2==POS_END ) iCol2 = 0x7fffffff; |
| 164081 | 164122 | else iCol2 = 0; |
| 164082 | 164123 | |
| 164083 | 164124 | if( iCol1==iCol2 ){ |
| 164084 | 164125 | sqlite3_int64 i1 = 0; /* Last position from pp1 */ |
| 164085 | 164126 | sqlite3_int64 i2 = 0; /* Last position from pp2 */ |
| | @@ -165085,22 +165126,10 @@ |
| 165085 | 165126 | } |
| 165086 | 165127 | assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 ); |
| 165087 | 165128 | return rc; |
| 165088 | 165129 | } |
| 165089 | 165130 | |
| 165090 | | -/* |
| 165091 | | -** The following are copied from sqliteInt.h. |
| 165092 | | -** |
| 165093 | | -** Constants for the largest and smallest possible 64-bit signed integers. |
| 165094 | | -** These macros are designed to work correctly on both 32-bit and 64-bit |
| 165095 | | -** compilers. |
| 165096 | | -*/ |
| 165097 | | -#ifndef SQLITE_AMALGAMATION |
| 165098 | | -# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32)) |
| 165099 | | -# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64) |
| 165100 | | -#endif |
| 165101 | | - |
| 165102 | 165131 | /* |
| 165103 | 165132 | ** If the numeric type of argument pVal is "integer", then return it |
| 165104 | 165133 | ** converted to a 64-bit signed integer. Otherwise, return a copy of |
| 165105 | 165134 | ** the second parameter, iDefault. |
| 165106 | 165135 | */ |
| | @@ -175826,18 +175855,18 @@ |
| 175826 | 175855 | memset(p, 0, sizeof(NodeReader)); |
| 175827 | 175856 | p->aNode = aNode; |
| 175828 | 175857 | p->nNode = nNode; |
| 175829 | 175858 | |
| 175830 | 175859 | /* Figure out if this is a leaf or an internal node. */ |
| 175831 | | - if( p->aNode[0] ){ |
| 175860 | + if( aNode && aNode[0] ){ |
| 175832 | 175861 | /* An internal node. */ |
| 175833 | 175862 | p->iOff = 1 + sqlite3Fts3GetVarint(&p->aNode[1], &p->iChild); |
| 175834 | 175863 | }else{ |
| 175835 | 175864 | p->iOff = 1; |
| 175836 | 175865 | } |
| 175837 | 175866 | |
| 175838 | | - return nodeReaderNext(p); |
| 175867 | + return aNode ? nodeReaderNext(p) : SQLITE_OK; |
| 175839 | 175868 | } |
| 175840 | 175869 | |
| 175841 | 175870 | /* |
| 175842 | 175871 | ** This function is called while writing an FTS segment each time a leaf o |
| 175843 | 175872 | ** node is finished and written to disk. The key (zTerm/nTerm) is guaranteed |
| | @@ -176325,12 +176354,12 @@ |
| 176325 | 176354 | |
| 176326 | 176355 | for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){ |
| 176327 | 176356 | NodeReader reader; |
| 176328 | 176357 | pNode = &pWriter->aNodeWriter[i]; |
| 176329 | 176358 | |
| 176330 | | - rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n); |
| 176331 | | - if( reader.aNode ){ |
| 176359 | + if( pNode->block.a){ |
| 176360 | + rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n); |
| 176332 | 176361 | while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader); |
| 176333 | 176362 | blobGrowBuffer(&pNode->key, reader.term.n, &rc); |
| 176334 | 176363 | if( rc==SQLITE_OK ){ |
| 176335 | 176364 | memcpy(pNode->key.a, reader.term.a, reader.term.n); |
| 176336 | 176365 | pNode->key.n = reader.term.n; |
| | @@ -220236,11 +220265,11 @@ |
| 220236 | 220265 | int nArg, /* Number of args */ |
| 220237 | 220266 | sqlite3_value **apUnused /* Function arguments */ |
| 220238 | 220267 | ){ |
| 220239 | 220268 | assert( nArg==0 ); |
| 220240 | 220269 | UNUSED_PARAM2(nArg, apUnused); |
| 220241 | | - sqlite3_result_text(pCtx, "fts5: 2019-09-25 18:44:49 36d35dbd5a80dc4a149ed7409cc4b43712622fc4c6a8915b4fbb62fd1d6b7763", -1, SQLITE_TRANSIENT); |
| 220270 | + sqlite3_result_text(pCtx, "fts5: 2019-10-04 15:03:17 c20a35336432025445f9f7e289d0cc3e4003fb17f45a4ce74c6269c407c6e09f", -1, SQLITE_TRANSIENT); |
| 220242 | 220271 | } |
| 220243 | 220272 | |
| 220244 | 220273 | /* |
| 220245 | 220274 | ** Return true if zName is the extension on one of the shadow tables used |
| 220246 | 220275 | ** by this module. |
| | @@ -225004,12 +225033,12 @@ |
| 225004 | 225033 | } |
| 225005 | 225034 | #endif /* SQLITE_CORE */ |
| 225006 | 225035 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 225007 | 225036 | |
| 225008 | 225037 | /************** End of stmt.c ************************************************/ |
| 225009 | | -#if __LINE__!=225009 |
| 225038 | +#if __LINE__!=225038 |
| 225010 | 225039 | #undef SQLITE_SOURCE_ID |
| 225011 | | -#define SQLITE_SOURCE_ID "2019-09-26 16:57:42 49073b7003330027303c4c776e9f85112f8b99b89f848fec3f953eba501dalt2" |
| 225040 | +#define SQLITE_SOURCE_ID "2019-10-04 15:03:17 c20a35336432025445f9f7e289d0cc3e4003fb17f45a4ce74c6269c407c6alt2" |
| 225012 | 225041 | #endif |
| 225013 | 225042 | /* Return the source-id for this library */ |
| 225014 | 225043 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 225015 | 225044 | /************************** End of sqlite3.c ******************************/ |
| 225016 | 225045 | |