| | @@ -1162,11 +1162,11 @@ |
| 1162 | 1162 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1163 | 1163 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1164 | 1164 | */ |
| 1165 | 1165 | #define SQLITE_VERSION "3.32.0" |
| 1166 | 1166 | #define SQLITE_VERSION_NUMBER 3032000 |
| 1167 | | -#define SQLITE_SOURCE_ID "2020-05-13 18:03:34 fce173cd211b15867369b6a54fad48168352fc83981a722ce98e57299b88608a" |
| 1167 | +#define SQLITE_SOURCE_ID "2020-05-17 13:47:28 69e149f76853d196c8855fedfc98848b60fb116ac36bc08824b1a122469f8ece" |
| 1168 | 1168 | |
| 1169 | 1169 | /* |
| 1170 | 1170 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1171 | 1171 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1172 | 1172 | ** |
| | @@ -6532,11 +6532,11 @@ |
| 6532 | 6532 | ** when first called if N is less than or equal to zero or if a memory |
| 6533 | 6533 | ** allocate error occurs. |
| 6534 | 6534 | ** |
| 6535 | 6535 | ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is |
| 6536 | 6536 | ** determined by the N parameter on first successful call. Changing the |
| 6537 | | -** value of N in any subsequents call to sqlite3_aggregate_context() within |
| 6537 | +** value of N in any subsequent call to sqlite3_aggregate_context() within |
| 6538 | 6538 | ** the same aggregate function instance will not resize the memory |
| 6539 | 6539 | ** allocation.)^ Within the xFinal callback, it is customary to set |
| 6540 | 6540 | ** N=0 in calls to sqlite3_aggregate_context(C,N) so that no |
| 6541 | 6541 | ** pointless memory allocations occur. |
| 6542 | 6542 | ** |
| | @@ -20065,12 +20065,14 @@ |
| 20065 | 20065 | # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) |
| 20066 | 20066 | #endif |
| 20067 | 20067 | SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db); |
| 20068 | 20068 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 20069 | 20069 | SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName); |
| 20070 | +SQLITE_PRIVATE int sqlite3IsShadowTableOf(sqlite3*,Table*,const char*); |
| 20070 | 20071 | #else |
| 20071 | 20072 | # define sqlite3ShadowTableName(A,B) 0 |
| 20073 | +# define sqlite3IsShadowTableOf(A,B,C) 0 |
| 20072 | 20074 | #endif |
| 20073 | 20075 | SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*); |
| 20074 | 20076 | SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*); |
| 20075 | 20077 | SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*); |
| 20076 | 20078 | SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int); |
| | @@ -27925,11 +27927,11 @@ |
| 27925 | 27927 | } |
| 27926 | 27928 | }else{ |
| 27927 | 27929 | assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); |
| 27928 | 27930 | assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); |
| 27929 | 27931 | sqlite3MemdebugSetType(p, MEMTYPE_HEAP); |
| 27930 | | - pNew = sqlite3_realloc64(p, n); |
| 27932 | + pNew = sqlite3Realloc(p, n); |
| 27931 | 27933 | if( !pNew ){ |
| 27932 | 27934 | sqlite3OomFault(db); |
| 27933 | 27935 | } |
| 27934 | 27936 | sqlite3MemdebugSetType(pNew, |
| 27935 | 27937 | (db->lookaside.bDisable==0 ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP)); |
| | @@ -29002,11 +29004,11 @@ |
| 29002 | 29004 | p->nAlloc = (int)szNew; |
| 29003 | 29005 | } |
| 29004 | 29006 | if( p->db ){ |
| 29005 | 29007 | zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc); |
| 29006 | 29008 | }else{ |
| 29007 | | - zNew = sqlite3_realloc64(zOld, p->nAlloc); |
| 29009 | + zNew = sqlite3Realloc(zOld, p->nAlloc); |
| 29008 | 29010 | } |
| 29009 | 29011 | if( zNew ){ |
| 29010 | 29012 | assert( p->zText!=0 || p->nChar==0 ); |
| 29011 | 29013 | if( !isMalloced(p) && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar); |
| 29012 | 29014 | p->zText = zNew; |
| | @@ -29344,11 +29346,11 @@ |
| 29344 | 29346 | ** and segfaults if you give it a long long int. |
| 29345 | 29347 | */ |
| 29346 | 29348 | SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){ |
| 29347 | 29349 | va_list ap; |
| 29348 | 29350 | StrAccum acc; |
| 29349 | | - char zBuf[500]; |
| 29351 | + char zBuf[SQLITE_PRINT_BUF_SIZE*10]; |
| 29350 | 29352 | sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); |
| 29351 | 29353 | va_start(ap,zFormat); |
| 29352 | 29354 | sqlite3_str_vappendf(&acc, zFormat, ap); |
| 29353 | 29355 | va_end(ap); |
| 29354 | 29356 | sqlite3StrAccumFinish(&acc); |
| | @@ -45049,10 +45051,11 @@ |
| 45049 | 45051 | } |
| 45050 | 45052 | |
| 45051 | 45053 | /* Forward references to VFS helper methods used for temporary files */ |
| 45052 | 45054 | static int winGetTempname(sqlite3_vfs *, char **); |
| 45053 | 45055 | static int winIsDir(const void *); |
| 45056 | +static BOOL winIsLongPathPrefix(const char *); |
| 45054 | 45057 | static BOOL winIsDriveLetterAndColon(const char *); |
| 45055 | 45058 | |
| 45056 | 45059 | /* |
| 45057 | 45060 | ** Control and query of the open file handle. |
| 45058 | 45061 | */ |
| | @@ -47027,10 +47030,21 @@ |
| 47027 | 47030 | *pResOut = rc; |
| 47028 | 47031 | OSTRACE(("ACCESS name=%s, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n", |
| 47029 | 47032 | zFilename, pResOut, *pResOut)); |
| 47030 | 47033 | return SQLITE_OK; |
| 47031 | 47034 | } |
| 47035 | + |
| 47036 | +/* |
| 47037 | +** Returns non-zero if the specified path name starts with the "long path" |
| 47038 | +** prefix. |
| 47039 | +*/ |
| 47040 | +static BOOL winIsLongPathPrefix( |
| 47041 | + const char *zPathname |
| 47042 | +){ |
| 47043 | + return ( zPathname[0]=='\\' && zPathname[1]=='\\' |
| 47044 | + && zPathname[2]=='?' && zPathname[3]=='\\' ); |
| 47045 | +} |
| 47032 | 47046 | |
| 47033 | 47047 | /* |
| 47034 | 47048 | ** Returns non-zero if the specified path name starts with a drive letter |
| 47035 | 47049 | ** followed by a colon character. |
| 47036 | 47050 | */ |
| | @@ -47092,14 +47106,15 @@ |
| 47092 | 47106 | DWORD nByte; |
| 47093 | 47107 | void *zConverted; |
| 47094 | 47108 | char *zOut; |
| 47095 | 47109 | #endif |
| 47096 | 47110 | |
| 47097 | | - /* If this path name begins with "/X:", where "X" is any alphabetic |
| 47098 | | - ** character, discard the initial "/" from the pathname. |
| 47111 | + /* If this path name begins with "/X:" or "\\?\", where "X" is any |
| 47112 | + ** alphabetic character, discard the initial "/" from the pathname. |
| 47099 | 47113 | */ |
| 47100 | | - if( zRelative[0]=='/' && winIsDriveLetterAndColon(zRelative+1) ){ |
| 47114 | + if( zRelative[0]=='/' && (winIsDriveLetterAndColon(zRelative+1) |
| 47115 | + || winIsLongPathPrefix(zRelative+1)) ){ |
| 47101 | 47116 | zRelative++; |
| 47102 | 47117 | } |
| 47103 | 47118 | |
| 47104 | 47119 | #if defined(__CYGWIN__) |
| 47105 | 47120 | SimulateIOError( return SQLITE_ERROR ); |
| | @@ -47851,11 +47866,11 @@ |
| 47851 | 47866 | if( newSz>p->szMax ){ |
| 47852 | 47867 | return SQLITE_FULL; |
| 47853 | 47868 | } |
| 47854 | 47869 | newSz *= 2; |
| 47855 | 47870 | if( newSz>p->szMax ) newSz = p->szMax; |
| 47856 | | - pNew = sqlite3_realloc64(p->aData, newSz); |
| 47871 | + pNew = sqlite3Realloc(p->aData, newSz); |
| 47857 | 47872 | if( pNew==0 ) return SQLITE_NOMEM; |
| 47858 | 47873 | p->aData = pNew; |
| 47859 | 47874 | p->szAlloc = newSz; |
| 47860 | 47875 | return SQLITE_OK; |
| 47861 | 47876 | } |
| | @@ -59821,11 +59836,11 @@ |
| 59821 | 59836 | |
| 59822 | 59837 | /* Enlarge the pWal->apWiData[] array if required */ |
| 59823 | 59838 | if( pWal->nWiData<=iPage ){ |
| 59824 | 59839 | sqlite3_int64 nByte = sizeof(u32*)*(iPage+1); |
| 59825 | 59840 | volatile u32 **apNew; |
| 59826 | | - apNew = (volatile u32 **)sqlite3_realloc64((void *)pWal->apWiData, nByte); |
| 59841 | + apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte); |
| 59827 | 59842 | if( !apNew ){ |
| 59828 | 59843 | *ppPage = 0; |
| 59829 | 59844 | return SQLITE_NOMEM_BKPT; |
| 59830 | 59845 | } |
| 59831 | 59846 | memset((void*)&apNew[pWal->nWiData], 0, |
| | @@ -79308,10 +79323,11 @@ |
| 79308 | 79323 | char *zP4; |
| 79309 | 79324 | char *zCom; |
| 79310 | 79325 | sqlite3 dummyDb; |
| 79311 | 79326 | static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-13s %.2X %s\n"; |
| 79312 | 79327 | if( pOut==0 ) pOut = stdout; |
| 79328 | + sqlite3BeginBenignMalloc(); |
| 79313 | 79329 | dummyDb.mallocFailed = 1; |
| 79314 | 79330 | zP4 = sqlite3VdbeDisplayP4(&dummyDb, pOp); |
| 79315 | 79331 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 79316 | 79332 | zCom = sqlite3VdbeDisplayComment(0, pOp, zP4); |
| 79317 | 79333 | #else |
| | @@ -79326,10 +79342,11 @@ |
| 79326 | 79342 | zCom ? zCom : "" |
| 79327 | 79343 | ); |
| 79328 | 79344 | fflush(pOut); |
| 79329 | 79345 | sqlite3_free(zP4); |
| 79330 | 79346 | sqlite3_free(zCom); |
| 79347 | + sqlite3EndBenignMalloc(); |
| 79331 | 79348 | } |
| 79332 | 79349 | #endif |
| 79333 | 79350 | |
| 79334 | 79351 | /* |
| 79335 | 79352 | ** Initialize an array of N Mem element. |
| | @@ -84067,11 +84084,11 @@ |
| 84067 | 84084 | p->db->errCode = SQLITE_OK; |
| 84068 | 84085 | |
| 84069 | 84086 | /* If the bit corresponding to this variable in Vdbe.expmask is set, then |
| 84070 | 84087 | ** binding a new value to this variable invalidates the current query plan. |
| 84071 | 84088 | ** |
| 84072 | | - ** IMPLEMENTATION-OF: R-48440-37595 If the specific value bound to host |
| 84089 | + ** IMPLEMENTATION-OF: R-57496-20354 If the specific value bound to a host |
| 84073 | 84090 | ** parameter in the WHERE clause might influence the choice of query plan |
| 84074 | 84091 | ** for a statement, then the statement will be automatically recompiled, |
| 84075 | 84092 | ** as if there had been a schema change, on the first sqlite3_step() call |
| 84076 | 84093 | ** following any change to the bindings of that parameter. |
| 84077 | 84094 | */ |
| | @@ -96366,12 +96383,12 @@ |
| 96366 | 96383 | ************************************************************************* |
| 96367 | 96384 | ** |
| 96368 | 96385 | ** This file implements virtual-tables for examining the bytecode content |
| 96369 | 96386 | ** of a prepared statement. |
| 96370 | 96387 | */ |
| 96371 | | -#ifdef SQLITE_ENABLE_BYTECODE_VTAB |
| 96372 | 96388 | /* #include "sqliteInt.h" */ |
| 96389 | +#if defined(SQLITE_ENABLE_BYTECODE_VTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE) |
| 96373 | 96390 | /* #include "vdbeInt.h" */ |
| 96374 | 96391 | |
| 96375 | 96392 | /* An instance of the bytecode() table-valued function. |
| 96376 | 96393 | */ |
| 96377 | 96394 | typedef struct bytecodevtab bytecodevtab; |
| | @@ -96772,10 +96789,12 @@ |
| 96772 | 96789 | if( rc==SQLITE_OK ){ |
| 96773 | 96790 | rc = sqlite3_create_module(db, "tables_used", &bytecodevtabModule, &db); |
| 96774 | 96791 | } |
| 96775 | 96792 | return rc; |
| 96776 | 96793 | } |
| 96794 | +#elif defined(SQLITE_ENABLE_BYTECODE_VTAB) |
| 96795 | +SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3 *db){ return SQLITE_OK; } |
| 96777 | 96796 | #endif /* SQLITE_ENABLE_BYTECODE_VTAB */ |
| 96778 | 96797 | |
| 96779 | 96798 | /************** End of vdbevtab.c ********************************************/ |
| 96780 | 96799 | /************** Begin file memjournal.c **************************************/ |
| 96781 | 96800 | /* |
| | @@ -105505,11 +105524,14 @@ |
| 105505 | 105524 | if( !zName ) goto exit_rename_table; |
| 105506 | 105525 | |
| 105507 | 105526 | /* Check that a table or index named 'zName' does not already exist |
| 105508 | 105527 | ** in database iDb. If so, this is an error. |
| 105509 | 105528 | */ |
| 105510 | | - if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){ |
| 105529 | + if( sqlite3FindTable(db, zName, zDb) |
| 105530 | + || sqlite3FindIndex(db, zName, zDb) |
| 105531 | + || sqlite3IsShadowTableOf(db, pTab, zName) |
| 105532 | + ){ |
| 105511 | 105533 | sqlite3ErrorMsg(pParse, |
| 105512 | 105534 | "there is already another table or index with this name: %s", zName); |
| 105513 | 105535 | goto exit_rename_table; |
| 105514 | 105536 | } |
| 105515 | 105537 | |
| | @@ -110252,26 +110274,43 @@ |
| 110252 | 110274 | ** exists */ |
| 110253 | 110275 | if( db->auth.authLevel<UAUTH_Admin && sqlite3UserAuthTable(zName)!=0 ){ |
| 110254 | 110276 | return 0; |
| 110255 | 110277 | } |
| 110256 | 110278 | #endif |
| 110257 | | - while(1){ |
| 110258 | | - for(i=OMIT_TEMPDB; i<db->nDb; i++){ |
| 110259 | | - int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ |
| 110260 | | - if( zDatabase==0 || sqlite3DbIsNamed(db, j, zDatabase) ){ |
| 110261 | | - assert( sqlite3SchemaMutexHeld(db, j, 0) ); |
| 110262 | | - p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName); |
| 110263 | | - if( p ) return p; |
| 110264 | | - } |
| 110265 | | - } |
| 110266 | | - /* Not found. If the name we were looking for was temp.sqlite_master |
| 110267 | | - ** then change the name to sqlite_temp_master and try again. */ |
| 110268 | | - if( sqlite3StrICmp(zName, MASTER_NAME)!=0 ) break; |
| 110269 | | - if( sqlite3_stricmp(zDatabase, db->aDb[1].zDbSName)!=0 ) break; |
| 110270 | | - zName = TEMP_MASTER_NAME; |
| 110271 | | - } |
| 110272 | | - return 0; |
| 110279 | + if( zDatabase ){ |
| 110280 | + for(i=0; i<db->nDb; i++){ |
| 110281 | + if( sqlite3StrICmp(zDatabase, db->aDb[i].zDbSName)==0 ) break; |
| 110282 | + } |
| 110283 | + if( i>=db->nDb ){ |
| 110284 | + /* No match against the official names. But always match "main" |
| 110285 | + ** to schema 0 as a legacy fallback. */ |
| 110286 | + if( sqlite3StrICmp(zDatabase,"main")==0 ){ |
| 110287 | + i = 0; |
| 110288 | + }else{ |
| 110289 | + return 0; |
| 110290 | + } |
| 110291 | + } |
| 110292 | + p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName); |
| 110293 | + if( p==0 && i==1 && sqlite3StrICmp(zName, MASTER_NAME)==0 ){ |
| 110294 | + /* All temp.sqlite_master to be an alias for sqlite_temp_master */ |
| 110295 | + p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, TEMP_MASTER_NAME); |
| 110296 | + } |
| 110297 | + }else{ |
| 110298 | + /* Match against TEMP first */ |
| 110299 | + p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, zName); |
| 110300 | + if( p ) return p; |
| 110301 | + /* The main database is second */ |
| 110302 | + p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, zName); |
| 110303 | + if( p ) return p; |
| 110304 | + /* Attached databases are in order of attachment */ |
| 110305 | + for(i=2; i<db->nDb; i++){ |
| 110306 | + assert( sqlite3SchemaMutexHeld(db, i, 0) ); |
| 110307 | + p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName); |
| 110308 | + if( p ) break; |
| 110309 | + } |
| 110310 | + } |
| 110311 | + return p; |
| 110273 | 110312 | } |
| 110274 | 110313 | |
| 110275 | 110314 | /* |
| 110276 | 110315 | ** Locate the in-memory structure that describes a particular database |
| 110277 | 110316 | ** table given the name of that table and (optionally) the name of the |
| | @@ -112071,10 +112110,32 @@ |
| 112071 | 112110 | assert( pPk->nColumn==j ); |
| 112072 | 112111 | assert( pTab->nNVCol<=j ); |
| 112073 | 112112 | recomputeColumnsNotIndexed(pPk); |
| 112074 | 112113 | } |
| 112075 | 112114 | |
| 112115 | + |
| 112116 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 112117 | +/* |
| 112118 | +** Return true if pTab is a virtual table and zName is a shadow table name |
| 112119 | +** for that virtual table. |
| 112120 | +*/ |
| 112121 | +SQLITE_PRIVATE int sqlite3IsShadowTableOf(sqlite3 *db, Table *pTab, const char *zName){ |
| 112122 | + int nName; /* Length of zName */ |
| 112123 | + Module *pMod; /* Module for the virtual table */ |
| 112124 | + |
| 112125 | + if( !IsVirtual(pTab) ) return 0; |
| 112126 | + nName = sqlite3Strlen30(pTab->zName); |
| 112127 | + if( sqlite3_strnicmp(zName, pTab->zName, nName)!=0 ) return 0; |
| 112128 | + if( zName[nName]!='_' ) return 0; |
| 112129 | + pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->azModuleArg[0]); |
| 112130 | + if( pMod==0 ) return 0; |
| 112131 | + if( pMod->pModule->iVersion<3 ) return 0; |
| 112132 | + if( pMod->pModule->xShadowName==0 ) return 0; |
| 112133 | + return pMod->pModule->xShadowName(zName+nName+1); |
| 112134 | +} |
| 112135 | +#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ |
| 112136 | + |
| 112076 | 112137 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 112077 | 112138 | /* |
| 112078 | 112139 | ** Return true if zName is a shadow table name in the current database |
| 112079 | 112140 | ** connection. |
| 112080 | 112141 | ** |
| | @@ -112082,26 +112143,21 @@ |
| 112082 | 112143 | ** restored to its original value prior to this routine returning. |
| 112083 | 112144 | */ |
| 112084 | 112145 | SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ |
| 112085 | 112146 | char *zTail; /* Pointer to the last "_" in zName */ |
| 112086 | 112147 | Table *pTab; /* Table that zName is a shadow of */ |
| 112087 | | - Module *pMod; /* Module for the virtual table */ |
| 112088 | | - |
| 112089 | 112148 | zTail = strrchr(zName, '_'); |
| 112090 | 112149 | if( zTail==0 ) return 0; |
| 112091 | 112150 | *zTail = 0; |
| 112092 | 112151 | pTab = sqlite3FindTable(db, zName, 0); |
| 112093 | 112152 | *zTail = '_'; |
| 112094 | 112153 | if( pTab==0 ) return 0; |
| 112095 | 112154 | if( !IsVirtual(pTab) ) return 0; |
| 112096 | | - pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->azModuleArg[0]); |
| 112097 | | - if( pMod==0 ) return 0; |
| 112098 | | - if( pMod->pModule->iVersion<3 ) return 0; |
| 112099 | | - if( pMod->pModule->xShadowName==0 ) return 0; |
| 112100 | | - return pMod->pModule->xShadowName(zTail+1); |
| 112155 | + return sqlite3IsShadowTableOf(db, pTab, zName); |
| 112101 | 112156 | } |
| 112102 | 112157 | #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ |
| 112158 | + |
| 112103 | 112159 | |
| 112104 | 112160 | #ifdef SQLITE_DEBUG |
| 112105 | 112161 | /* |
| 112106 | 112162 | ** Mark all nodes of an expression as EP_Immutable, indicating that |
| 112107 | 112163 | ** they should not be changed. Expressions attached to a table or |
| | @@ -117788,11 +117844,11 @@ |
| 117788 | 117844 | if( (cntExpand&(cntExpand-1))==0 ){ |
| 117789 | 117845 | /* Grow the size of the output buffer only on substitutions |
| 117790 | 117846 | ** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */ |
| 117791 | 117847 | u8 *zOld; |
| 117792 | 117848 | zOld = zOut; |
| 117793 | | - zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1)); |
| 117849 | + zOut = sqlite3Realloc(zOut, (int)nOut + (nOut - nStr - 1)); |
| 117794 | 117850 | if( zOut==0 ){ |
| 117795 | 117851 | sqlite3_result_error_nomem(context); |
| 117796 | 117852 | sqlite3_free(zOld); |
| 117797 | 117853 | return; |
| 117798 | 117854 | } |
| | @@ -135579,11 +135635,11 @@ |
| 135579 | 135635 | need = nCol; |
| 135580 | 135636 | } |
| 135581 | 135637 | if( p->nData + need > p->nAlloc ){ |
| 135582 | 135638 | char **azNew; |
| 135583 | 135639 | p->nAlloc = p->nAlloc*2 + need; |
| 135584 | | - azNew = sqlite3_realloc64( p->azResult, sizeof(char*)*p->nAlloc ); |
| 135640 | + azNew = sqlite3Realloc( p->azResult, sizeof(char*)*p->nAlloc ); |
| 135585 | 135641 | if( azNew==0 ) goto malloc_failed; |
| 135586 | 135642 | p->azResult = azNew; |
| 135587 | 135643 | } |
| 135588 | 135644 | |
| 135589 | 135645 | /* If this is the first row, then generate an extra row containing |
| | @@ -135688,11 +135744,11 @@ |
| 135688 | 135744 | sqlite3_free_table(&res.azResult[1]); |
| 135689 | 135745 | return rc; |
| 135690 | 135746 | } |
| 135691 | 135747 | if( res.nAlloc>res.nData ){ |
| 135692 | 135748 | char **azNew; |
| 135693 | | - azNew = sqlite3_realloc64( res.azResult, sizeof(char*)*res.nData ); |
| 135749 | + azNew = sqlite3Realloc( res.azResult, sizeof(char*)*res.nData ); |
| 135694 | 135750 | if( azNew==0 ){ |
| 135695 | 135751 | sqlite3_free_table(&res.azResult[1]); |
| 135696 | 135752 | db->errCode = SQLITE_NOMEM; |
| 135697 | 135753 | return SQLITE_NOMEM_BKPT; |
| 135698 | 135754 | } |
| | @@ -136978,14 +137034,14 @@ |
| 136978 | 137034 | ** Therefore, the P4 parameter is only required if the default value for |
| 136979 | 137035 | ** the column is a literal number, string or null. The sqlite3ValueFromExpr() |
| 136980 | 137036 | ** function is capable of transforming these types of expressions into |
| 136981 | 137037 | ** sqlite3_value objects. |
| 136982 | 137038 | ** |
| 136983 | | -** If parameter iReg is not negative, code an OP_RealAffinity instruction |
| 136984 | | -** on register iReg. This is used when an equivalent integer value is |
| 136985 | | -** stored in place of an 8-byte floating point value in order to save |
| 136986 | | -** space. |
| 137039 | +** If column as REAL affinity and the table is an ordinary b-tree table |
| 137040 | +** (not a virtual table) then the value might have been stored as an |
| 137041 | +** integer. In that case, add an OP_RealAffinity opcode to make sure |
| 137042 | +** it has been converted into REAL. |
| 136987 | 137043 | */ |
| 136988 | 137044 | SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){ |
| 136989 | 137045 | assert( pTab!=0 ); |
| 136990 | 137046 | if( !pTab->pSelect ){ |
| 136991 | 137047 | sqlite3_value *pValue = 0; |
| | @@ -136998,11 +137054,11 @@ |
| 136998 | 137054 | if( pValue ){ |
| 136999 | 137055 | sqlite3VdbeAppendP4(v, pValue, P4_MEM); |
| 137000 | 137056 | } |
| 137001 | 137057 | } |
| 137002 | 137058 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 137003 | | - if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){ |
| 137059 | + if( pTab->aCol[i].affinity==SQLITE_AFF_REAL && !IsVirtual(pTab) ){ |
| 137004 | 137060 | sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg); |
| 137005 | 137061 | } |
| 137006 | 137062 | #endif |
| 137007 | 137063 | } |
| 137008 | 137064 | |
| | @@ -139847,11 +139903,11 @@ |
| 139847 | 139903 | assert( IsVirtual(pTab) ); |
| 139848 | 139904 | for(i=0; i<pToplevel->nVtabLock; i++){ |
| 139849 | 139905 | if( pTab==pToplevel->apVtabLock[i] ) return; |
| 139850 | 139906 | } |
| 139851 | 139907 | n = (pToplevel->nVtabLock+1)*sizeof(pToplevel->apVtabLock[0]); |
| 139852 | | - apVtabLock = sqlite3_realloc64(pToplevel->apVtabLock, n); |
| 139908 | + apVtabLock = sqlite3Realloc(pToplevel->apVtabLock, n); |
| 139853 | 139909 | if( apVtabLock ){ |
| 139854 | 139910 | pToplevel->apVtabLock = apVtabLock; |
| 139855 | 139911 | pToplevel->apVtabLock[pToplevel->nVtabLock++] = pTab; |
| 139856 | 139912 | }else{ |
| 139857 | 139913 | sqlite3OomFault(pToplevel->db); |
| | @@ -160337,10 +160393,11 @@ |
| 160337 | 160393 | } |
| 160338 | 160394 | #endif |
| 160339 | 160395 | if( rc==SQLITE_OK ){ |
| 160340 | 160396 | sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, |
| 160341 | 160397 | sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage); |
| 160398 | + sqlite3MemoryBarrier(); |
| 160342 | 160399 | sqlite3GlobalConfig.isInit = 1; |
| 160343 | 160400 | #ifdef SQLITE_EXTRA_INIT |
| 160344 | 160401 | bRunExtraInit = 1; |
| 160345 | 160402 | #endif |
| 160346 | 160403 | } |
| | @@ -163285,11 +163342,11 @@ |
| 163285 | 163342 | assert( SQLITE_OPEN_CREATE == 0x04 ); |
| 163286 | 163343 | testcase( (1<<(flags&7))==0x02 ); /* READONLY */ |
| 163287 | 163344 | testcase( (1<<(flags&7))==0x04 ); /* READWRITE */ |
| 163288 | 163345 | testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */ |
| 163289 | 163346 | if( ((1<<(flags&7)) & 0x46)==0 ){ |
| 163290 | | - rc = SQLITE_MISUSE_BKPT; /* IMP: R-65497-44594 */ |
| 163347 | + rc = SQLITE_MISUSE_BKPT; /* IMP: R-18321-05872 */ |
| 163291 | 163348 | }else{ |
| 163292 | 163349 | rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg); |
| 163293 | 163350 | } |
| 163294 | 163351 | if( rc!=SQLITE_OK ){ |
| 163295 | 163352 | if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); |
| | @@ -171209,10 +171266,11 @@ |
| 171209 | 171266 | while( *pRc==SQLITE_OK && pLeft->bEof==0 ){ |
| 171210 | 171267 | memset(pDl->pList, 0, pDl->nList); |
| 171211 | 171268 | fts3EvalNextRow(pCsr, pLeft, pRc); |
| 171212 | 171269 | } |
| 171213 | 171270 | } |
| 171271 | + pRight->bEof = pLeft->bEof = 1; |
| 171214 | 171272 | } |
| 171215 | 171273 | } |
| 171216 | 171274 | break; |
| 171217 | 171275 | } |
| 171218 | 171276 | |
| | @@ -182754,11 +182812,11 @@ |
| 182754 | 182812 | iStart = pExpr->iPhrase * p->nCol; |
| 182755 | 182813 | }else{ |
| 182756 | 182814 | iStart = pExpr->iPhrase * ((p->nCol + 31) / 32); |
| 182757 | 182815 | } |
| 182758 | 182816 | |
| 182759 | | - while( 1 ){ |
| 182817 | + if( pIter ) while( 1 ){ |
| 182760 | 182818 | int nHit = fts3ColumnlistCount(&pIter); |
| 182761 | 182819 | if( (pPhrase->iColumn>=pTab->nColumn || pPhrase->iColumn==iCol) ){ |
| 182762 | 182820 | if( p->flag==FTS3_MATCHINFO_LHITS ){ |
| 182763 | 182821 | p->aMatchinfo[iStart + iCol] = (u32)nHit; |
| 182764 | 182822 | }else if( nHit ){ |
| | @@ -184668,10 +184726,11 @@ |
| 184668 | 184726 | } |
| 184669 | 184727 | |
| 184670 | 184728 | /* Append N bytes from zIn onto the end of the JsonString string. |
| 184671 | 184729 | */ |
| 184672 | 184730 | static void jsonAppendRaw(JsonString *p, const char *zIn, u32 N){ |
| 184731 | + if( N==0 ) return; |
| 184673 | 184732 | if( (N+p->nUsed >= p->nAlloc) && jsonGrow(p,N)!=0 ) return; |
| 184674 | 184733 | memcpy(p->zBuf+p->nUsed, zIn, N); |
| 184675 | 184734 | p->nUsed += N; |
| 184676 | 184735 | } |
| 184677 | 184736 | |
| | @@ -224679,11 +224738,11 @@ |
| 224679 | 224738 | int nArg, /* Number of args */ |
| 224680 | 224739 | sqlite3_value **apUnused /* Function arguments */ |
| 224681 | 224740 | ){ |
| 224682 | 224741 | assert( nArg==0 ); |
| 224683 | 224742 | UNUSED_PARAM2(nArg, apUnused); |
| 224684 | | - sqlite3_result_text(pCtx, "fts5: 2020-05-13 18:03:34 fce173cd211b15867369b6a54fad48168352fc83981a722ce98e57299b88608a", -1, SQLITE_TRANSIENT); |
| 224743 | + sqlite3_result_text(pCtx, "fts5: 2020-05-17 00:26:44 1313557b512297e7b75ed748894379b2022aecf696d5a58318e46a668321c1ff", -1, SQLITE_TRANSIENT); |
| 224685 | 224744 | } |
| 224686 | 224745 | |
| 224687 | 224746 | /* |
| 224688 | 224747 | ** Return true if zName is the extension on one of the shadow tables used |
| 224689 | 224748 | ** by this module. |
| | @@ -229462,12 +229521,12 @@ |
| 229462 | 229521 | } |
| 229463 | 229522 | #endif /* SQLITE_CORE */ |
| 229464 | 229523 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 229465 | 229524 | |
| 229466 | 229525 | /************** End of stmt.c ************************************************/ |
| 229467 | | -#if __LINE__!=229467 |
| 229526 | +#if __LINE__!=229526 |
| 229468 | 229527 | #undef SQLITE_SOURCE_ID |
| 229469 | | -#define SQLITE_SOURCE_ID "2020-05-13 18:03:34 fce173cd211b15867369b6a54fad48168352fc83981a722ce98e57299b88alt2" |
| 229528 | +#define SQLITE_SOURCE_ID "2020-05-17 13:47:28 69e149f76853d196c8855fedfc98848b60fb116ac36bc08824b1a122469falt2" |
| 229470 | 229529 | #endif |
| 229471 | 229530 | /* Return the source-id for this library */ |
| 229472 | 229531 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 229473 | 229532 | /************************** End of sqlite3.c ******************************/ |
| 229474 | 229533 | |