| | @@ -1150,11 +1150,11 @@ |
| 1150 | 1150 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1151 | 1151 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1152 | 1152 | */ |
| 1153 | 1153 | #define SQLITE_VERSION "3.24.0" |
| 1154 | 1154 | #define SQLITE_VERSION_NUMBER 3024000 |
| 1155 | | -#define SQLITE_SOURCE_ID "2018-05-05 01:23:28 9191ff670cb7f36e0b2dac4a22888679b639845687aef8edcc3c05e35ba71eda" |
| 1155 | +#define SQLITE_SOURCE_ID "2018-05-14 00:41:12 d0f35739af3b226c8eef39676407293650cde551acef06fe8628fdd5b59bd66a" |
| 1156 | 1156 | |
| 1157 | 1157 | /* |
| 1158 | 1158 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1159 | 1159 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1160 | 1160 | ** |
| | @@ -8138,11 +8138,11 @@ |
| 8138 | 8138 | ** creates a new table named "BEGIN" with three columns named |
| 8139 | 8139 | ** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid |
| 8140 | 8140 | ** using keywords as identifiers. Common techniques used to avoid keyword |
| 8141 | 8141 | ** name collisions include: |
| 8142 | 8142 | ** <ul> |
| 8143 | | -** <li> Put all indentifier names inside double-quotes. This is the official |
| 8143 | +** <li> Put all identifier names inside double-quotes. This is the official |
| 8144 | 8144 | ** SQL way to escape identifier names. |
| 8145 | 8145 | ** <li> Put identifier names inside [...]. This is not standard SQL, |
| 8146 | 8146 | ** but it is what SQL Server does and so lots of programmers use this |
| 8147 | 8147 | ** technique. |
| 8148 | 8148 | ** <li> Begin every identifier with the letter "Z" as no SQL keywords start |
| | @@ -8157,10 +8157,134 @@ |
| 8157 | 8157 | */ |
| 8158 | 8158 | SQLITE_API int sqlite3_keyword_count(void); |
| 8159 | 8159 | SQLITE_API int sqlite3_keyword_name(int,const char**,int*); |
| 8160 | 8160 | SQLITE_API int sqlite3_keyword_check(const char*,int); |
| 8161 | 8161 | |
| 8162 | +/* |
| 8163 | +** CAPI3REF: Dynamic String Object |
| 8164 | +** KEYWORDS: {dynamic string} |
| 8165 | +** |
| 8166 | +** An instance of the sqlite3_str object contains a dynamically-sized |
| 8167 | +** string under construction. |
| 8168 | +** |
| 8169 | +** The lifecycle of an sqlite3_str object is as follows: |
| 8170 | +** <ol> |
| 8171 | +** <li> ^The sqlite3_str object is created using [sqlite3_str_new()]. |
| 8172 | +** <li> ^Text is appended to the sqlite3_str object using various |
| 8173 | +** methods, such as [sqlite3_str_appendf()]. |
| 8174 | +** <li> ^The sqlite3_str object is destroyed and the string it created |
| 8175 | +** is returned using the [sqlite3_str_finish()] interface. |
| 8176 | +** </ol> |
| 8177 | +*/ |
| 8178 | +typedef struct sqlite3_str sqlite3_str; |
| 8179 | + |
| 8180 | +/* |
| 8181 | +** CAPI3REF: Create A New Dynamic String Object |
| 8182 | +** CONSTRUCTOR: sqlite3_str |
| 8183 | +** |
| 8184 | +** ^The [sqlite3_str_new(D)] interface allocates and initializes |
| 8185 | +** a new [sqlite3_str] |
| 8186 | +** object. ^The [sqlite3_str_new()] interface returns NULL on an out-of-memory |
| 8187 | +** condition. To avoid memory leaks, the object returned by |
| 8188 | +** [sqlite3_str_new()] must be freed by a subsequent call to |
| 8189 | +** [sqlite3_str_finish(X)]. |
| 8190 | +** |
| 8191 | +** The D parameter to [sqlite3_str_new(D)] may be NULL. If the |
| 8192 | +** D parameter in [sqlite3_str_new(D)] is not NULL, then the maximum |
| 8193 | +** length of the string contained in the [sqlite3_str] object will be |
| 8194 | +** the value set for [sqlite3_limit](D,[SQLITE_LIMIT_LENGTH]) instead |
| 8195 | +** of [SQLITE_MAX_LENGTH]. |
| 8196 | +*/ |
| 8197 | +SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*); |
| 8198 | + |
| 8199 | +/* |
| 8200 | +** CAPI3REF: Finalize A Dynamic String |
| 8201 | +** DESTRUCTOR: sqlite3_str |
| 8202 | +** |
| 8203 | +** ^The [sqlite3_str_finish(X)] interface destroys the sqlite3_str object X |
| 8204 | +** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()] |
| 8205 | +** that contains the constructed string. The calling application should |
| 8206 | +** pass the returned value to [sqlite3_free()] to avoid a memory leak. |
| 8207 | +** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any |
| 8208 | +** errors were encountered during construction of the string. ^The |
| 8209 | +** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the |
| 8210 | +** string in [sqlite3_str] object X is zero bytes long. |
| 8211 | +*/ |
| 8212 | +SQLITE_API char *sqlite3_str_finish(sqlite3_str*); |
| 8213 | + |
| 8214 | +/* |
| 8215 | +** CAPI3REF: Add Content To A Dynamic String |
| 8216 | +** METHOD: sqlite3_str |
| 8217 | +** |
| 8218 | +** These interfaces add content to an sqlite3_str object previously obtained |
| 8219 | +** from [sqlite3_str_new()]. |
| 8220 | +** |
| 8221 | +** ^The [sqlite3_str_appendf(X,F,...)] and |
| 8222 | +** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf] |
| 8223 | +** functionality of SQLite to append formatted text onto the end of |
| 8224 | +** [sqlite3_str] object X. |
| 8225 | +** |
| 8226 | +** ^The [sqlite3_str_append(X,S,N)] method appends exactly N bytes from string S |
| 8227 | +** onto the end of the [sqlite3_str] object X. N must be non-negative. |
| 8228 | +** S must contain at least N non-zero bytes of content. To append a |
| 8229 | +** zero-terminated string in its entirety, use the [sqlite3_str_appendall()] |
| 8230 | +** method instead. |
| 8231 | +** |
| 8232 | +** ^The [sqlite3_str_appendall(X,S)] method appends the complete content of |
| 8233 | +** zero-terminated string S onto the end of [sqlite3_str] object X. |
| 8234 | +** |
| 8235 | +** ^The [sqlite3_str_appendchar(X,N,C)] method appends N copies of the |
| 8236 | +** single-byte character C onto the end of [sqlite3_str] object X. |
| 8237 | +** ^This method can be used, for example, to add whitespace indentation. |
| 8238 | +** |
| 8239 | +** ^The [sqlite3_str_reset(X)] method resets the string under construction |
| 8240 | +** inside [sqlite3_str] object X back to zero bytes in length. |
| 8241 | +** |
| 8242 | +** These methods do not return a result code. ^If an error occurs, that fact |
| 8243 | +** is recorded in the [sqlite3_str] object and can be recovered by a |
| 8244 | +** subsequent call to [sqlite3_str_errcode(X)]. |
| 8245 | +*/ |
| 8246 | +SQLITE_API void sqlite3_str_appendf(sqlite3_str*, const char *zFormat, ...); |
| 8247 | +SQLITE_API void sqlite3_str_vappendf(sqlite3_str*, const char *zFormat, va_list); |
| 8248 | +SQLITE_API void sqlite3_str_append(sqlite3_str*, const char *zIn, int N); |
| 8249 | +SQLITE_API void sqlite3_str_appendall(sqlite3_str*, const char *zIn); |
| 8250 | +SQLITE_API void sqlite3_str_appendchar(sqlite3_str*, int N, char C); |
| 8251 | +SQLITE_API void sqlite3_str_reset(sqlite3_str*); |
| 8252 | + |
| 8253 | +/* |
| 8254 | +** CAPI3REF: Status Of A Dynamic String |
| 8255 | +** METHOD: sqlite3_str |
| 8256 | +** |
| 8257 | +** These interfaces return the current status of an [sqlite3_str] object. |
| 8258 | +** |
| 8259 | +** ^If any prior errors have occurred while constructing the dynamic string |
| 8260 | +** in sqlite3_str X, then the [sqlite3_str_errcode(X)] method will return |
| 8261 | +** an appropriate error code. ^The [sqlite3_str_errcode(X)] method returns |
| 8262 | +** [SQLITE_NOMEM] following any out-of-memory error, or |
| 8263 | +** [SQLITE_TOOBIG] if the size of the dynamic string exceeds |
| 8264 | +** [SQLITE_MAX_LENGTH], or [SQLITE_OK] if there have been no errors. |
| 8265 | +** |
| 8266 | +** ^The [sqlite3_str_length(X)] method returns the current length, in bytes, |
| 8267 | +** of the dynamic string under construction in [sqlite3_str] object X. |
| 8268 | +** ^The length returned by [sqlite3_str_length(X)] does not include the |
| 8269 | +** zero-termination byte. |
| 8270 | +** |
| 8271 | +** ^The [sqlite3_str_value(X)] method returns a pointer to the current |
| 8272 | +** content of the dynamic string under construction in X. The value |
| 8273 | +** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X |
| 8274 | +** and might be freed or altered by any subsequent method on the same |
| 8275 | +** [sqlite3_str] object. Applications must not used the pointer returned |
| 8276 | +** [sqlite3_str_value(X)] after any subsequent method call on the same |
| 8277 | +** object. ^Applications may change the content of the string returned |
| 8278 | +** by [sqlite3_str_value(X)] as long as they do not write into any bytes |
| 8279 | +** outside the range of 0 to [sqlite3_str_length(X)] and do not read or |
| 8280 | +** write any byte after any subsequent sqlite3_str method call. |
| 8281 | +*/ |
| 8282 | +SQLITE_API int sqlite3_str_errcode(sqlite3_str*); |
| 8283 | +SQLITE_API int sqlite3_str_length(sqlite3_str*); |
| 8284 | +SQLITE_API char *sqlite3_str_value(sqlite3_str*); |
| 8285 | + |
| 8162 | 8286 | /* |
| 8163 | 8287 | ** CAPI3REF: SQLite Runtime Status |
| 8164 | 8288 | ** |
| 8165 | 8289 | ** ^These interfaces are used to retrieve runtime status information |
| 8166 | 8290 | ** about the performance of SQLite, and optionally to reset various |
| | @@ -13739,11 +13863,11 @@ |
| 13739 | 13863 | typedef struct Savepoint Savepoint; |
| 13740 | 13864 | typedef struct Select Select; |
| 13741 | 13865 | typedef struct SQLiteThread SQLiteThread; |
| 13742 | 13866 | typedef struct SelectDest SelectDest; |
| 13743 | 13867 | typedef struct SrcList SrcList; |
| 13744 | | -typedef struct StrAccum StrAccum; |
| 13868 | +typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */ |
| 13745 | 13869 | typedef struct Table Table; |
| 13746 | 13870 | typedef struct TableLock TableLock; |
| 13747 | 13871 | typedef struct Token Token; |
| 13748 | 13872 | typedef struct TreeView TreeView; |
| 13749 | 13873 | typedef struct Trigger Trigger; |
| | @@ -14031,17 +14155,32 @@ |
| 14031 | 14155 | |
| 14032 | 14156 | /* An instance of the BtreePayload object describes the content of a single |
| 14033 | 14157 | ** entry in either an index or table btree. |
| 14034 | 14158 | ** |
| 14035 | 14159 | ** Index btrees (used for indexes and also WITHOUT ROWID tables) contain |
| 14036 | | -** an arbitrary key and no data. These btrees have pKey,nKey set to their |
| 14037 | | -** key and pData,nData,nZero set to zero. |
| 14160 | +** an arbitrary key and no data. These btrees have pKey,nKey set to the |
| 14161 | +** key and the pData,nData,nZero fields are uninitialized. The aMem,nMem |
| 14162 | +** fields give an array of Mem objects that are a decomposition of the key. |
| 14163 | +** The nMem field might be zero, indicating that no decomposition is available. |
| 14038 | 14164 | ** |
| 14039 | 14165 | ** Table btrees (used for rowid tables) contain an integer rowid used as |
| 14040 | 14166 | ** the key and passed in the nKey field. The pKey field is zero. |
| 14041 | 14167 | ** pData,nData hold the content of the new entry. nZero extra zero bytes |
| 14042 | 14168 | ** are appended to the end of the content when constructing the entry. |
| 14169 | +** The aMem,nMem fields are uninitialized for table btrees. |
| 14170 | +** |
| 14171 | +** Field usage summary: |
| 14172 | +** |
| 14173 | +** Table BTrees Index Btrees |
| 14174 | +** |
| 14175 | +** pKey always NULL encoded key |
| 14176 | +** nKey the ROWID length of pKey |
| 14177 | +** pData data not used |
| 14178 | +** aMem not used decomposed key value |
| 14179 | +** nMem not used entries in aMem |
| 14180 | +** nData length of pData not used |
| 14181 | +** nZero extra zeros after pData not used |
| 14043 | 14182 | ** |
| 14044 | 14183 | ** This object is used to pass information into sqlite3BtreeInsert(). The |
| 14045 | 14184 | ** same information used to be passed as five separate parameters. But placing |
| 14046 | 14185 | ** the information into this object helps to keep the interface more |
| 14047 | 14186 | ** organized and understandable, and it also helps the resulting code to |
| | @@ -14048,11 +14187,11 @@ |
| 14048 | 14187 | ** run a little faster by using fewer registers for parameter passing. |
| 14049 | 14188 | */ |
| 14050 | 14189 | struct BtreePayload { |
| 14051 | 14190 | const void *pKey; /* Key content for indexes. NULL for tables */ |
| 14052 | 14191 | sqlite3_int64 nKey; /* Size of pKey for indexes. PRIMARY KEY for tabs */ |
| 14053 | | - const void *pData; /* Data for tables. NULL for indexes */ |
| 14192 | + const void *pData; /* Data for tables. */ |
| 14054 | 14193 | sqlite3_value *aMem; /* First of nMem value in the unpacked pKey */ |
| 14055 | 14194 | u16 nMem; /* Number of aMem[] value. Might be zero */ |
| 14056 | 14195 | int nData; /* Size of pData. 0 if none. */ |
| 14057 | 14196 | int nZero; /* Extra zero data appended after pData,nData */ |
| 14058 | 14197 | }; |
| | @@ -17651,21 +17790,19 @@ |
| 17651 | 17790 | |
| 17652 | 17791 | /* |
| 17653 | 17792 | ** An objected used to accumulate the text of a string where we |
| 17654 | 17793 | ** do not necessarily know how big the string will be in the end. |
| 17655 | 17794 | */ |
| 17656 | | -struct StrAccum { |
| 17795 | +struct sqlite3_str { |
| 17657 | 17796 | sqlite3 *db; /* Optional database for lookaside. Can be NULL */ |
| 17658 | 17797 | char *zText; /* The string collected so far */ |
| 17659 | 17798 | u32 nAlloc; /* Amount of space allocated in zText */ |
| 17660 | 17799 | u32 mxAlloc; /* Maximum allowed allocation. 0 for no malloc usage */ |
| 17661 | 17800 | u32 nChar; /* Length of the string so far */ |
| 17662 | | - u8 accError; /* STRACCUM_NOMEM or STRACCUM_TOOBIG */ |
| 17801 | + u8 accError; /* SQLITE_NOMEM or SQLITE_TOOBIG */ |
| 17663 | 17802 | u8 printfFlags; /* SQLITE_PRINTF flags below */ |
| 17664 | 17803 | }; |
| 17665 | | -#define STRACCUM_NOMEM 1 |
| 17666 | | -#define STRACCUM_TOOBIG 2 |
| 17667 | 17804 | #define SQLITE_PRINTF_INTERNAL 0x01 /* Internal-use-only converters allowed */ |
| 17668 | 17805 | #define SQLITE_PRINTF_SQLFUNC 0x02 /* SQL function arguments to VXPrintf */ |
| 17669 | 17806 | #define SQLITE_PRINTF_MALLOCED 0x04 /* True if xText is allocated space */ |
| 17670 | 17807 | |
| 17671 | 17808 | #define isMalloced(X) (((X)->printfFlags & SQLITE_PRINTF_MALLOCED)!=0) |
| | @@ -18030,12 +18167,10 @@ |
| 18030 | 18167 | int nArg; /* Total number of arguments */ |
| 18031 | 18168 | int nUsed; /* Number of arguments used so far */ |
| 18032 | 18169 | sqlite3_value **apArg; /* The argument values */ |
| 18033 | 18170 | }; |
| 18034 | 18171 | |
| 18035 | | -SQLITE_PRIVATE void sqlite3VXPrintf(StrAccum*, const char*, va_list); |
| 18036 | | -SQLITE_PRIVATE void sqlite3XPrintf(StrAccum*, const char*, ...); |
| 18037 | 18172 | SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3*,const char*, ...); |
| 18038 | 18173 | SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3*,const char*, va_list); |
| 18039 | 18174 | #if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE) |
| 18040 | 18175 | SQLITE_PRIVATE void sqlite3DebugPrintf(const char*, ...); |
| 18041 | 18176 | #endif |
| | @@ -18554,15 +18689,11 @@ |
| 18554 | 18689 | SQLITE_PRIVATE void sqlite3OomClear(sqlite3*); |
| 18555 | 18690 | SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int); |
| 18556 | 18691 | SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); |
| 18557 | 18692 | |
| 18558 | 18693 | SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int); |
| 18559 | | -SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int); |
| 18560 | | -SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum*,const char*); |
| 18561 | | -SQLITE_PRIVATE void sqlite3AppendChar(StrAccum*,int,char); |
| 18562 | 18694 | SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*); |
| 18563 | | -SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*); |
| 18564 | 18695 | SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); |
| 18565 | 18696 | SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); |
| 18566 | 18697 | |
| 18567 | 18698 | SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); |
| 18568 | 18699 | SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); |
| | @@ -24411,11 +24542,10 @@ |
| 24411 | 24542 | } |
| 24412 | 24543 | #endif |
| 24413 | 24544 | |
| 24414 | 24545 | #endif /* !defined(SQLITE_MUTEX_OMIT) */ |
| 24415 | 24546 | |
| 24416 | | - |
| 24417 | 24547 | /************** End of mutex.c ***********************************************/ |
| 24418 | 24548 | /************** Begin file mutex_noop.c **************************************/ |
| 24419 | 24549 | /* |
| 24420 | 24550 | ** 2008 October 07 |
| 24421 | 24551 | ** |
| | @@ -26575,11 +26705,11 @@ |
| 26575 | 26705 | |
| 26576 | 26706 | /* |
| 26577 | 26707 | ** Set the StrAccum object to an error mode. |
| 26578 | 26708 | */ |
| 26579 | 26709 | static void setStrAccumError(StrAccum *p, u8 eError){ |
| 26580 | | - assert( eError==STRACCUM_NOMEM || eError==STRACCUM_TOOBIG ); |
| 26710 | + assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG ); |
| 26581 | 26711 | p->accError = eError; |
| 26582 | 26712 | p->nAlloc = 0; |
| 26583 | 26713 | } |
| 26584 | 26714 | |
| 26585 | 26715 | /* |
| | @@ -26609,12 +26739,12 @@ |
| 26609 | 26739 | #define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */ |
| 26610 | 26740 | |
| 26611 | 26741 | /* |
| 26612 | 26742 | ** Render a string given by "fmt" into the StrAccum object. |
| 26613 | 26743 | */ |
| 26614 | | -SQLITE_PRIVATE void sqlite3VXPrintf( |
| 26615 | | - StrAccum *pAccum, /* Accumulate results here */ |
| 26744 | +SQLITE_API void sqlite3_str_vappendf( |
| 26745 | + sqlite3_str *pAccum, /* Accumulate results here */ |
| 26616 | 26746 | const char *fmt, /* Format string */ |
| 26617 | 26747 | va_list ap /* arguments */ |
| 26618 | 26748 | ){ |
| 26619 | 26749 | int c; /* Next character in the format string */ |
| 26620 | 26750 | char *bufpt; /* Pointer to the conversion buffer */ |
| | @@ -26667,15 +26797,15 @@ |
| 26667 | 26797 | #if HAVE_STRCHRNUL |
| 26668 | 26798 | fmt = strchrnul(fmt, '%'); |
| 26669 | 26799 | #else |
| 26670 | 26800 | do{ fmt++; }while( *fmt && *fmt != '%' ); |
| 26671 | 26801 | #endif |
| 26672 | | - sqlite3StrAccumAppend(pAccum, bufpt, (int)(fmt - bufpt)); |
| 26802 | + sqlite3_str_append(pAccum, bufpt, (int)(fmt - bufpt)); |
| 26673 | 26803 | if( *fmt==0 ) break; |
| 26674 | 26804 | } |
| 26675 | 26805 | if( (c=(*++fmt))==0 ){ |
| 26676 | | - sqlite3StrAccumAppend(pAccum, "%", 1); |
| 26806 | + sqlite3_str_append(pAccum, "%", 1); |
| 26677 | 26807 | break; |
| 26678 | 26808 | } |
| 26679 | 26809 | /* Find out what flags are present */ |
| 26680 | 26810 | flag_leftjustify = flag_prefix = cThousand = |
| 26681 | 26811 | flag_alternateform = flag_altform2 = flag_zeropad = 0; |
| | @@ -26849,11 +26979,11 @@ |
| 26849 | 26979 | zOut = buf; |
| 26850 | 26980 | }else{ |
| 26851 | 26981 | u64 n = (u64)precision + 10 + precision/3; |
| 26852 | 26982 | zOut = zExtra = sqlite3Malloc( n ); |
| 26853 | 26983 | if( zOut==0 ){ |
| 26854 | | - setStrAccumError(pAccum, STRACCUM_NOMEM); |
| 26984 | + setStrAccumError(pAccum, SQLITE_NOMEM); |
| 26855 | 26985 | return; |
| 26856 | 26986 | } |
| 26857 | 26987 | nOut = (int)n; |
| 26858 | 26988 | } |
| 26859 | 26989 | bufpt = &zOut[nOut-1]; |
| | @@ -26974,11 +27104,11 @@ |
| 26974 | 27104 | } |
| 26975 | 27105 | if( MAX(e2,0)+(i64)precision+(i64)width > etBUFSIZE - 15 ){ |
| 26976 | 27106 | bufpt = zExtra |
| 26977 | 27107 | = sqlite3Malloc( MAX(e2,0)+(i64)precision+(i64)width+15 ); |
| 26978 | 27108 | if( bufpt==0 ){ |
| 26979 | | - setStrAccumError(pAccum, STRACCUM_NOMEM); |
| 27109 | + setStrAccumError(pAccum, SQLITE_NOMEM); |
| 26980 | 27110 | return; |
| 26981 | 27111 | } |
| 26982 | 27112 | } |
| 26983 | 27113 | zOut = bufpt; |
| 26984 | 27114 | nsd = 16 + flag_altform2*10; |
| | @@ -27106,15 +27236,15 @@ |
| 27106 | 27236 | } |
| 27107 | 27237 | } |
| 27108 | 27238 | if( precision>1 ){ |
| 27109 | 27239 | width -= precision-1; |
| 27110 | 27240 | if( width>1 && !flag_leftjustify ){ |
| 27111 | | - sqlite3AppendChar(pAccum, width-1, ' '); |
| 27241 | + sqlite3_str_appendchar(pAccum, width-1, ' '); |
| 27112 | 27242 | width = 0; |
| 27113 | 27243 | } |
| 27114 | 27244 | while( precision-- > 1 ){ |
| 27115 | | - sqlite3StrAccumAppend(pAccum, buf, length); |
| 27245 | + sqlite3_str_append(pAccum, buf, length); |
| 27116 | 27246 | } |
| 27117 | 27247 | } |
| 27118 | 27248 | bufpt = buf; |
| 27119 | 27249 | flag_altform2 = 1; |
| 27120 | 27250 | goto adjust_width_for_utf8; |
| | @@ -27196,11 +27326,11 @@ |
| 27196 | 27326 | needQuote = !isnull && xtype==etSQLESCAPE2; |
| 27197 | 27327 | n += i + 3; |
| 27198 | 27328 | if( n>etBUFSIZE ){ |
| 27199 | 27329 | bufpt = zExtra = sqlite3Malloc( n ); |
| 27200 | 27330 | if( bufpt==0 ){ |
| 27201 | | - setStrAccumError(pAccum, STRACCUM_NOMEM); |
| 27331 | + setStrAccumError(pAccum, SQLITE_NOMEM); |
| 27202 | 27332 | return; |
| 27203 | 27333 | } |
| 27204 | 27334 | }else{ |
| 27205 | 27335 | bufpt = buf; |
| 27206 | 27336 | } |
| | @@ -27220,11 +27350,11 @@ |
| 27220 | 27350 | Token *pToken; |
| 27221 | 27351 | if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return; |
| 27222 | 27352 | pToken = va_arg(ap, Token*); |
| 27223 | 27353 | assert( bArgList==0 ); |
| 27224 | 27354 | if( pToken && pToken->n ){ |
| 27225 | | - sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n); |
| 27355 | + sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n); |
| 27226 | 27356 | } |
| 27227 | 27357 | length = width = 0; |
| 27228 | 27358 | break; |
| 27229 | 27359 | } |
| 27230 | 27360 | case etSRCLIST: { |
| | @@ -27236,14 +27366,14 @@ |
| 27236 | 27366 | k = va_arg(ap, int); |
| 27237 | 27367 | pItem = &pSrc->a[k]; |
| 27238 | 27368 | assert( bArgList==0 ); |
| 27239 | 27369 | assert( k>=0 && k<pSrc->nSrc ); |
| 27240 | 27370 | if( pItem->zDatabase ){ |
| 27241 | | - sqlite3StrAccumAppendAll(pAccum, pItem->zDatabase); |
| 27242 | | - sqlite3StrAccumAppend(pAccum, ".", 1); |
| 27371 | + sqlite3_str_appendall(pAccum, pItem->zDatabase); |
| 27372 | + sqlite3_str_append(pAccum, ".", 1); |
| 27243 | 27373 | } |
| 27244 | | - sqlite3StrAccumAppendAll(pAccum, pItem->zName); |
| 27374 | + sqlite3_str_appendall(pAccum, pItem->zName); |
| 27245 | 27375 | length = width = 0; |
| 27246 | 27376 | break; |
| 27247 | 27377 | } |
| 27248 | 27378 | default: { |
| 27249 | 27379 | assert( xtype==etINVALID ); |
| | @@ -27258,15 +27388,15 @@ |
| 27258 | 27388 | ** indicating that width and precision should be expressed in characters, |
| 27259 | 27389 | ** then the values have been translated prior to reaching this point. |
| 27260 | 27390 | */ |
| 27261 | 27391 | width -= length; |
| 27262 | 27392 | if( width>0 ){ |
| 27263 | | - if( !flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' '); |
| 27264 | | - sqlite3StrAccumAppend(pAccum, bufpt, length); |
| 27265 | | - if( flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' '); |
| 27393 | + if( !flag_leftjustify ) sqlite3_str_appendchar(pAccum, width, ' '); |
| 27394 | + sqlite3_str_append(pAccum, bufpt, length); |
| 27395 | + if( flag_leftjustify ) sqlite3_str_appendchar(pAccum, width, ' '); |
| 27266 | 27396 | }else{ |
| 27267 | | - sqlite3StrAccumAppend(pAccum, bufpt, length); |
| 27397 | + sqlite3_str_append(pAccum, bufpt, length); |
| 27268 | 27398 | } |
| 27269 | 27399 | |
| 27270 | 27400 | if( zExtra ){ |
| 27271 | 27401 | sqlite3DbFree(pAccum->db, zExtra); |
| 27272 | 27402 | zExtra = 0; |
| | @@ -27283,17 +27413,17 @@ |
| 27283 | 27413 | */ |
| 27284 | 27414 | static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ |
| 27285 | 27415 | char *zNew; |
| 27286 | 27416 | assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */ |
| 27287 | 27417 | if( p->accError ){ |
| 27288 | | - testcase(p->accError==STRACCUM_TOOBIG); |
| 27289 | | - testcase(p->accError==STRACCUM_NOMEM); |
| 27418 | + testcase(p->accError==SQLITE_TOOBIG); |
| 27419 | + testcase(p->accError==SQLITE_NOMEM); |
| 27290 | 27420 | return 0; |
| 27291 | 27421 | } |
| 27292 | 27422 | if( p->mxAlloc==0 ){ |
| 27293 | 27423 | N = p->nAlloc - p->nChar - 1; |
| 27294 | | - setStrAccumError(p, STRACCUM_TOOBIG); |
| 27424 | + setStrAccumError(p, SQLITE_TOOBIG); |
| 27295 | 27425 | return N; |
| 27296 | 27426 | }else{ |
| 27297 | 27427 | char *zOld = isMalloced(p) ? p->zText : 0; |
| 27298 | 27428 | i64 szNew = p->nChar; |
| 27299 | 27429 | szNew += N + 1; |
| | @@ -27301,12 +27431,12 @@ |
| 27301 | 27431 | /* Force exponential buffer size growth as long as it does not overflow, |
| 27302 | 27432 | ** to avoid having to call this routine too often */ |
| 27303 | 27433 | szNew += p->nChar; |
| 27304 | 27434 | } |
| 27305 | 27435 | if( szNew > p->mxAlloc ){ |
| 27306 | | - sqlite3StrAccumReset(p); |
| 27307 | | - setStrAccumError(p, STRACCUM_TOOBIG); |
| 27436 | + sqlite3_str_reset(p); |
| 27437 | + setStrAccumError(p, SQLITE_TOOBIG); |
| 27308 | 27438 | return 0; |
| 27309 | 27439 | }else{ |
| 27310 | 27440 | p->nAlloc = (int)szNew; |
| 27311 | 27441 | } |
| 27312 | 27442 | if( p->db ){ |
| | @@ -27319,22 +27449,22 @@ |
| 27319 | 27449 | if( !isMalloced(p) && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar); |
| 27320 | 27450 | p->zText = zNew; |
| 27321 | 27451 | p->nAlloc = sqlite3DbMallocSize(p->db, zNew); |
| 27322 | 27452 | p->printfFlags |= SQLITE_PRINTF_MALLOCED; |
| 27323 | 27453 | }else{ |
| 27324 | | - sqlite3StrAccumReset(p); |
| 27325 | | - setStrAccumError(p, STRACCUM_NOMEM); |
| 27454 | + sqlite3_str_reset(p); |
| 27455 | + setStrAccumError(p, SQLITE_NOMEM); |
| 27326 | 27456 | return 0; |
| 27327 | 27457 | } |
| 27328 | 27458 | } |
| 27329 | 27459 | return N; |
| 27330 | 27460 | } |
| 27331 | 27461 | |
| 27332 | 27462 | /* |
| 27333 | 27463 | ** Append N copies of character c to the given string buffer. |
| 27334 | 27464 | */ |
| 27335 | | -SQLITE_PRIVATE void sqlite3AppendChar(StrAccum *p, int N, char c){ |
| 27465 | +SQLITE_API void sqlite3_str_appendchar(sqlite3_str *p, int N, char c){ |
| 27336 | 27466 | testcase( p->nChar + (i64)N > 0x7fffffff ); |
| 27337 | 27467 | if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){ |
| 27338 | 27468 | return; |
| 27339 | 27469 | } |
| 27340 | 27470 | while( (N--)>0 ) p->zText[p->nChar++] = c; |
| | @@ -27342,13 +27472,13 @@ |
| 27342 | 27472 | |
| 27343 | 27473 | /* |
| 27344 | 27474 | ** The StrAccum "p" is not large enough to accept N new bytes of z[]. |
| 27345 | 27475 | ** So enlarge if first, then do the append. |
| 27346 | 27476 | ** |
| 27347 | | -** This is a helper routine to sqlite3StrAccumAppend() that does special-case |
| 27477 | +** This is a helper routine to sqlite3_str_append() that does special-case |
| 27348 | 27478 | ** work (enlarging the buffer) using tail recursion, so that the |
| 27349 | | -** sqlite3StrAccumAppend() routine can use fast calling semantics. |
| 27479 | +** sqlite3_str_append() routine can use fast calling semantics. |
| 27350 | 27480 | */ |
| 27351 | 27481 | static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){ |
| 27352 | 27482 | N = sqlite3StrAccumEnlarge(p, N); |
| 27353 | 27483 | if( N>0 ){ |
| 27354 | 27484 | memcpy(&p->zText[p->nChar], z, N); |
| | @@ -27358,11 +27488,11 @@ |
| 27358 | 27488 | |
| 27359 | 27489 | /* |
| 27360 | 27490 | ** Append N bytes of text from z to the StrAccum object. Increase the |
| 27361 | 27491 | ** size of the memory allocation for StrAccum if necessary. |
| 27362 | 27492 | */ |
| 27363 | | -SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum *p, const char *z, int N){ |
| 27493 | +SQLITE_API void sqlite3_str_append(sqlite3_str *p, const char *z, int N){ |
| 27364 | 27494 | assert( z!=0 || N==0 ); |
| 27365 | 27495 | assert( p->zText!=0 || p->nChar==0 || p->accError ); |
| 27366 | 27496 | assert( N>=0 ); |
| 27367 | 27497 | assert( p->accError==0 || p->nAlloc==0 ); |
| 27368 | 27498 | if( p->nChar+N >= p->nAlloc ){ |
| | @@ -27375,12 +27505,12 @@ |
| 27375 | 27505 | } |
| 27376 | 27506 | |
| 27377 | 27507 | /* |
| 27378 | 27508 | ** Append the complete text of zero-terminated string z[] to the p string. |
| 27379 | 27509 | */ |
| 27380 | | -SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum *p, const char *z){ |
| 27381 | | - sqlite3StrAccumAppend(p, z, sqlite3Strlen30(z)); |
| 27510 | +SQLITE_API void sqlite3_str_appendall(sqlite3_str *p, const char *z){ |
| 27511 | + sqlite3_str_append(p, z, sqlite3Strlen30(z)); |
| 27382 | 27512 | } |
| 27383 | 27513 | |
| 27384 | 27514 | |
| 27385 | 27515 | /* |
| 27386 | 27516 | ** Finish off a string by making sure it is zero-terminated. |
| | @@ -27393,11 +27523,11 @@ |
| 27393 | 27523 | zText = sqlite3DbMallocRaw(p->db, p->nChar+1 ); |
| 27394 | 27524 | if( zText ){ |
| 27395 | 27525 | memcpy(zText, p->zText, p->nChar+1); |
| 27396 | 27526 | p->printfFlags |= SQLITE_PRINTF_MALLOCED; |
| 27397 | 27527 | }else{ |
| 27398 | | - setStrAccumError(p, STRACCUM_NOMEM); |
| 27528 | + setStrAccumError(p, SQLITE_NOMEM); |
| 27399 | 27529 | } |
| 27400 | 27530 | p->zText = zText; |
| 27401 | 27531 | return zText; |
| 27402 | 27532 | } |
| 27403 | 27533 | SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){ |
| | @@ -27407,19 +27537,51 @@ |
| 27407 | 27537 | return strAccumFinishRealloc(p); |
| 27408 | 27538 | } |
| 27409 | 27539 | } |
| 27410 | 27540 | return p->zText; |
| 27411 | 27541 | } |
| 27542 | + |
| 27543 | +/* Finalize a string created using sqlite3_str_new(). |
| 27544 | +*/ |
| 27545 | +SQLITE_API char *sqlite3_str_finish(sqlite3_str *p){ |
| 27546 | + char *z; |
| 27547 | + if( p ){ |
| 27548 | + z = sqlite3StrAccumFinish(p); |
| 27549 | + sqlite3_free(p); |
| 27550 | + }else{ |
| 27551 | + z = 0; |
| 27552 | + } |
| 27553 | + return z; |
| 27554 | +} |
| 27555 | + |
| 27556 | +/* Return any error code associated with p */ |
| 27557 | +SQLITE_API int sqlite3_str_errcode(sqlite3_str *p){ |
| 27558 | + return p ? p->accError : SQLITE_NOMEM; |
| 27559 | +} |
| 27560 | + |
| 27561 | +/* Return the current length of p in bytes */ |
| 27562 | +SQLITE_API int sqlite3_str_length(sqlite3_str *p){ |
| 27563 | + return p ? p->nChar : 0; |
| 27564 | +} |
| 27565 | + |
| 27566 | +/* Return the current value for p */ |
| 27567 | +SQLITE_API char *sqlite3_str_value(sqlite3_str *p){ |
| 27568 | + if( p==0 || p->nChar==0 ) return 0; |
| 27569 | + p->zText[p->nChar] = 0; |
| 27570 | + return p->zText; |
| 27571 | +} |
| 27412 | 27572 | |
| 27413 | 27573 | /* |
| 27414 | 27574 | ** Reset an StrAccum string. Reclaim all malloced memory. |
| 27415 | 27575 | */ |
| 27416 | | -SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum *p){ |
| 27576 | +SQLITE_API void sqlite3_str_reset(StrAccum *p){ |
| 27417 | 27577 | if( isMalloced(p) ){ |
| 27418 | 27578 | sqlite3DbFree(p->db, p->zText); |
| 27419 | 27579 | p->printfFlags &= ~SQLITE_PRINTF_MALLOCED; |
| 27420 | 27580 | } |
| 27581 | + p->nAlloc = 0; |
| 27582 | + p->nChar = 0; |
| 27421 | 27583 | p->zText = 0; |
| 27422 | 27584 | } |
| 27423 | 27585 | |
| 27424 | 27586 | /* |
| 27425 | 27587 | ** Initialize a string accumulator. |
| | @@ -27442,10 +27604,20 @@ |
| 27442 | 27604 | p->mxAlloc = mx; |
| 27443 | 27605 | p->nChar = 0; |
| 27444 | 27606 | p->accError = 0; |
| 27445 | 27607 | p->printfFlags = 0; |
| 27446 | 27608 | } |
| 27609 | + |
| 27610 | +/* Allocate and initialize a new dynamic string object */ |
| 27611 | +SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3 *db){ |
| 27612 | + sqlite3_str *p = sqlite3_malloc64(sizeof(*p)); |
| 27613 | + if( p ){ |
| 27614 | + sqlite3StrAccumInit(p, 0, 0, 0, |
| 27615 | + db ? db->aLimit[SQLITE_LIMIT_LENGTH] : SQLITE_MAX_LENGTH); |
| 27616 | + } |
| 27617 | + return p; |
| 27618 | +} |
| 27447 | 27619 | |
| 27448 | 27620 | /* |
| 27449 | 27621 | ** Print into memory obtained from sqliteMalloc(). Use the internal |
| 27450 | 27622 | ** %-conversion extensions. |
| 27451 | 27623 | */ |
| | @@ -27455,13 +27627,13 @@ |
| 27455 | 27627 | StrAccum acc; |
| 27456 | 27628 | assert( db!=0 ); |
| 27457 | 27629 | sqlite3StrAccumInit(&acc, db, zBase, sizeof(zBase), |
| 27458 | 27630 | db->aLimit[SQLITE_LIMIT_LENGTH]); |
| 27459 | 27631 | acc.printfFlags = SQLITE_PRINTF_INTERNAL; |
| 27460 | | - sqlite3VXPrintf(&acc, zFormat, ap); |
| 27632 | + sqlite3_str_vappendf(&acc, zFormat, ap); |
| 27461 | 27633 | z = sqlite3StrAccumFinish(&acc); |
| 27462 | | - if( acc.accError==STRACCUM_NOMEM ){ |
| 27634 | + if( acc.accError==SQLITE_NOMEM ){ |
| 27463 | 27635 | sqlite3OomFault(db); |
| 27464 | 27636 | } |
| 27465 | 27637 | return z; |
| 27466 | 27638 | } |
| 27467 | 27639 | |
| | @@ -27495,11 +27667,11 @@ |
| 27495 | 27667 | #endif |
| 27496 | 27668 | #ifndef SQLITE_OMIT_AUTOINIT |
| 27497 | 27669 | if( sqlite3_initialize() ) return 0; |
| 27498 | 27670 | #endif |
| 27499 | 27671 | sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH); |
| 27500 | | - sqlite3VXPrintf(&acc, zFormat, ap); |
| 27672 | + sqlite3_str_vappendf(&acc, zFormat, ap); |
| 27501 | 27673 | z = sqlite3StrAccumFinish(&acc); |
| 27502 | 27674 | return z; |
| 27503 | 27675 | } |
| 27504 | 27676 | |
| 27505 | 27677 | /* |
| | @@ -27540,11 +27712,11 @@ |
| 27540 | 27712 | if( zBuf ) zBuf[0] = 0; |
| 27541 | 27713 | return zBuf; |
| 27542 | 27714 | } |
| 27543 | 27715 | #endif |
| 27544 | 27716 | sqlite3StrAccumInit(&acc, 0, zBuf, n, 0); |
| 27545 | | - sqlite3VXPrintf(&acc, zFormat, ap); |
| 27717 | + sqlite3_str_vappendf(&acc, zFormat, ap); |
| 27546 | 27718 | zBuf[acc.nChar] = 0; |
| 27547 | 27719 | return zBuf; |
| 27548 | 27720 | } |
| 27549 | 27721 | SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){ |
| 27550 | 27722 | char *z; |
| | @@ -27562,21 +27734,21 @@ |
| 27562 | 27734 | ** |
| 27563 | 27735 | ** sqlite3_log() must render into a static buffer. It cannot dynamically |
| 27564 | 27736 | ** allocate memory because it might be called while the memory allocator |
| 27565 | 27737 | ** mutex is held. |
| 27566 | 27738 | ** |
| 27567 | | -** sqlite3VXPrintf() might ask for *temporary* memory allocations for |
| 27739 | +** sqlite3_str_vappendf() might ask for *temporary* memory allocations for |
| 27568 | 27740 | ** certain format characters (%q) or for very large precisions or widths. |
| 27569 | 27741 | ** Care must be taken that any sqlite3_log() calls that occur while the |
| 27570 | 27742 | ** memory mutex is held do not use these mechanisms. |
| 27571 | 27743 | */ |
| 27572 | 27744 | static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){ |
| 27573 | 27745 | StrAccum acc; /* String accumulator */ |
| 27574 | 27746 | char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */ |
| 27575 | 27747 | |
| 27576 | 27748 | sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0); |
| 27577 | | - sqlite3VXPrintf(&acc, zFormat, ap); |
| 27749 | + sqlite3_str_vappendf(&acc, zFormat, ap); |
| 27578 | 27750 | sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode, |
| 27579 | 27751 | sqlite3StrAccumFinish(&acc)); |
| 27580 | 27752 | } |
| 27581 | 27753 | |
| 27582 | 27754 | /* |
| | @@ -27601,11 +27773,11 @@ |
| 27601 | 27773 | va_list ap; |
| 27602 | 27774 | StrAccum acc; |
| 27603 | 27775 | char zBuf[500]; |
| 27604 | 27776 | sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); |
| 27605 | 27777 | va_start(ap,zFormat); |
| 27606 | | - sqlite3VXPrintf(&acc, zFormat, ap); |
| 27778 | + sqlite3_str_vappendf(&acc, zFormat, ap); |
| 27607 | 27779 | va_end(ap); |
| 27608 | 27780 | sqlite3StrAccumFinish(&acc); |
| 27609 | 27781 | #ifdef SQLITE_OS_TRACE_PROC |
| 27610 | 27782 | { |
| 27611 | 27783 | extern void SQLITE_OS_TRACE_PROC(const char *zBuf, int nBuf); |
| | @@ -27618,17 +27790,17 @@ |
| 27618 | 27790 | } |
| 27619 | 27791 | #endif |
| 27620 | 27792 | |
| 27621 | 27793 | |
| 27622 | 27794 | /* |
| 27623 | | -** variable-argument wrapper around sqlite3VXPrintf(). The bFlags argument |
| 27795 | +** variable-argument wrapper around sqlite3_str_vappendf(). The bFlags argument |
| 27624 | 27796 | ** can contain the bit SQLITE_PRINTF_INTERNAL enable internal formats. |
| 27625 | 27797 | */ |
| 27626 | | -SQLITE_PRIVATE void sqlite3XPrintf(StrAccum *p, const char *zFormat, ...){ |
| 27798 | +SQLITE_API void sqlite3_str_appendf(StrAccum *p, const char *zFormat, ...){ |
| 27627 | 27799 | va_list ap; |
| 27628 | 27800 | va_start(ap,zFormat); |
| 27629 | | - sqlite3VXPrintf(p, zFormat, ap); |
| 27801 | + sqlite3_str_vappendf(p, zFormat, ap); |
| 27630 | 27802 | va_end(ap); |
| 27631 | 27803 | } |
| 27632 | 27804 | |
| 27633 | 27805 | /************** End of printf.c **********************************************/ |
| 27634 | 27806 | /************** Begin file treeview.c ****************************************/ |
| | @@ -27690,20 +27862,20 @@ |
| 27690 | 27862 | StrAccum acc; |
| 27691 | 27863 | char zBuf[500]; |
| 27692 | 27864 | sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); |
| 27693 | 27865 | if( p ){ |
| 27694 | 27866 | for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){ |
| 27695 | | - sqlite3StrAccumAppend(&acc, p->bLine[i] ? "| " : " ", 4); |
| 27867 | + sqlite3_str_append(&acc, p->bLine[i] ? "| " : " ", 4); |
| 27696 | 27868 | } |
| 27697 | | - sqlite3StrAccumAppend(&acc, p->bLine[i] ? "|-- " : "'-- ", 4); |
| 27869 | + sqlite3_str_append(&acc, p->bLine[i] ? "|-- " : "'-- ", 4); |
| 27698 | 27870 | } |
| 27699 | 27871 | if( zFormat!=0 ){ |
| 27700 | 27872 | va_start(ap, zFormat); |
| 27701 | | - sqlite3VXPrintf(&acc, zFormat, ap); |
| 27873 | + sqlite3_str_vappendf(&acc, zFormat, ap); |
| 27702 | 27874 | va_end(ap); |
| 27703 | 27875 | assert( acc.nChar>0 ); |
| 27704 | | - sqlite3StrAccumAppend(&acc, "\n", 1); |
| 27876 | + sqlite3_str_append(&acc, "\n", 1); |
| 27705 | 27877 | } |
| 27706 | 27878 | sqlite3StrAccumFinish(&acc); |
| 27707 | 27879 | fprintf(stdout,"%s", zBuf); |
| 27708 | 27880 | fflush(stdout); |
| 27709 | 27881 | } |
| | @@ -27733,21 +27905,21 @@ |
| 27733 | 27905 | for(i=0; i<pWith->nCte; i++){ |
| 27734 | 27906 | StrAccum x; |
| 27735 | 27907 | char zLine[1000]; |
| 27736 | 27908 | const struct Cte *pCte = &pWith->a[i]; |
| 27737 | 27909 | sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); |
| 27738 | | - sqlite3XPrintf(&x, "%s", pCte->zName); |
| 27910 | + sqlite3_str_appendf(&x, "%s", pCte->zName); |
| 27739 | 27911 | if( pCte->pCols && pCte->pCols->nExpr>0 ){ |
| 27740 | 27912 | char cSep = '('; |
| 27741 | 27913 | int j; |
| 27742 | 27914 | for(j=0; j<pCte->pCols->nExpr; j++){ |
| 27743 | | - sqlite3XPrintf(&x, "%c%s", cSep, pCte->pCols->a[j].zName); |
| 27915 | + sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zName); |
| 27744 | 27916 | cSep = ','; |
| 27745 | 27917 | } |
| 27746 | | - sqlite3XPrintf(&x, ")"); |
| 27918 | + sqlite3_str_appendf(&x, ")"); |
| 27747 | 27919 | } |
| 27748 | | - sqlite3XPrintf(&x, " AS"); |
| 27920 | + sqlite3_str_appendf(&x, " AS"); |
| 27749 | 27921 | sqlite3StrAccumFinish(&x); |
| 27750 | 27922 | sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1); |
| 27751 | 27923 | sqlite3TreeViewSelect(pView, pCte->pSelect, 0); |
| 27752 | 27924 | sqlite3TreeViewPop(pView); |
| 27753 | 27925 | } |
| | @@ -27808,24 +27980,24 @@ |
| 27808 | 27980 | for(i=0; i<p->pSrc->nSrc; i++){ |
| 27809 | 27981 | struct SrcList_item *pItem = &p->pSrc->a[i]; |
| 27810 | 27982 | StrAccum x; |
| 27811 | 27983 | char zLine[100]; |
| 27812 | 27984 | sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); |
| 27813 | | - sqlite3XPrintf(&x, "{%d,*}", pItem->iCursor); |
| 27985 | + sqlite3_str_appendf(&x, "{%d,*}", pItem->iCursor); |
| 27814 | 27986 | if( pItem->zDatabase ){ |
| 27815 | | - sqlite3XPrintf(&x, " %s.%s", pItem->zDatabase, pItem->zName); |
| 27987 | + sqlite3_str_appendf(&x, " %s.%s", pItem->zDatabase, pItem->zName); |
| 27816 | 27988 | }else if( pItem->zName ){ |
| 27817 | | - sqlite3XPrintf(&x, " %s", pItem->zName); |
| 27989 | + sqlite3_str_appendf(&x, " %s", pItem->zName); |
| 27818 | 27990 | } |
| 27819 | 27991 | if( pItem->pTab ){ |
| 27820 | | - sqlite3XPrintf(&x, " tabname=%Q", pItem->pTab->zName); |
| 27992 | + sqlite3_str_appendf(&x, " tabname=%Q", pItem->pTab->zName); |
| 27821 | 27993 | } |
| 27822 | 27994 | if( pItem->zAlias ){ |
| 27823 | | - sqlite3XPrintf(&x, " (AS %s)", pItem->zAlias); |
| 27995 | + sqlite3_str_appendf(&x, " (AS %s)", pItem->zAlias); |
| 27824 | 27996 | } |
| 27825 | 27997 | if( pItem->fg.jointype & JT_LEFT ){ |
| 27826 | | - sqlite3XPrintf(&x, " LEFT-JOIN"); |
| 27998 | + sqlite3_str_appendf(&x, " LEFT-JOIN"); |
| 27827 | 27999 | } |
| 27828 | 28000 | sqlite3StrAccumFinish(&x); |
| 27829 | 28001 | sqlite3TreeViewItem(pView, zLine, i<p->pSrc->nSrc-1); |
| 27830 | 28002 | if( pItem->pSelect ){ |
| 27831 | 28003 | sqlite3TreeViewSelect(pView, pItem->pSelect, 0); |
| | @@ -69969,10 +70141,98 @@ |
| 69969 | 70141 | sqlite3PageFree(pFree); |
| 69970 | 70142 | } |
| 69971 | 70143 | return rc; |
| 69972 | 70144 | } |
| 69973 | 70145 | |
| 70146 | +/* Overwrite content from pX into pDest. Only do the write if the |
| 70147 | +** content is different from what is already there. |
| 70148 | +*/ |
| 70149 | +static int btreeOverwriteContent( |
| 70150 | + MemPage *pPage, /* MemPage on which writing will occur */ |
| 70151 | + u8 *pDest, /* Pointer to the place to start writing */ |
| 70152 | + const BtreePayload *pX, /* Source of data to write */ |
| 70153 | + int iOffset, /* Offset of first byte to write */ |
| 70154 | + int iAmt /* Number of bytes to be written */ |
| 70155 | +){ |
| 70156 | + int nData = pX->nData - iOffset; |
| 70157 | + if( nData<=0 ){ |
| 70158 | + /* Overwritting with zeros */ |
| 70159 | + int i; |
| 70160 | + for(i=0; i<iAmt && pDest[i]==0; i++){} |
| 70161 | + if( i<iAmt ){ |
| 70162 | + int rc = sqlite3PagerWrite(pPage->pDbPage); |
| 70163 | + if( rc ) return rc; |
| 70164 | + memset(pDest + i, 0, iAmt - i); |
| 70165 | + } |
| 70166 | + }else{ |
| 70167 | + if( nData<iAmt ){ |
| 70168 | + /* Mixed read data and zeros at the end. Make a recursive call |
| 70169 | + ** to write the zeros then fall through to write the real data */ |
| 70170 | + int rc = btreeOverwriteContent(pPage, pDest+nData, pX, iOffset+nData, |
| 70171 | + iAmt-nData); |
| 70172 | + if( rc ) return rc; |
| 70173 | + iAmt = nData; |
| 70174 | + } |
| 70175 | + if( memcmp(pDest, ((u8*)pX->pData) + iOffset, iAmt)!=0 ){ |
| 70176 | + int rc = sqlite3PagerWrite(pPage->pDbPage); |
| 70177 | + if( rc ) return rc; |
| 70178 | + memcpy(pDest, ((u8*)pX->pData) + iOffset, iAmt); |
| 70179 | + } |
| 70180 | + } |
| 70181 | + return SQLITE_OK; |
| 70182 | +} |
| 70183 | + |
| 70184 | +/* |
| 70185 | +** Overwrite the cell that cursor pCur is pointing to with fresh content |
| 70186 | +** contained in pX. |
| 70187 | +*/ |
| 70188 | +static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){ |
| 70189 | + int iOffset; /* Next byte of pX->pData to write */ |
| 70190 | + int nTotal = pX->nData + pX->nZero; /* Total bytes of to write */ |
| 70191 | + int rc; /* Return code */ |
| 70192 | + MemPage *pPage = pCur->pPage; /* Page being written */ |
| 70193 | + BtShared *pBt; /* Btree */ |
| 70194 | + Pgno ovflPgno; /* Next overflow page to write */ |
| 70195 | + u32 ovflPageSize; /* Size to write on overflow page */ |
| 70196 | + |
| 70197 | + if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd ){ |
| 70198 | + return SQLITE_CORRUPT_BKPT; |
| 70199 | + } |
| 70200 | + /* Overwrite the local portion first */ |
| 70201 | + rc = btreeOverwriteContent(pPage, pCur->info.pPayload, pX, |
| 70202 | + 0, pCur->info.nLocal); |
| 70203 | + if( rc ) return rc; |
| 70204 | + if( pCur->info.nLocal==nTotal ) return SQLITE_OK; |
| 70205 | + |
| 70206 | + /* Now overwrite the overflow pages */ |
| 70207 | + iOffset = pCur->info.nLocal; |
| 70208 | + assert( nTotal>=0 ); |
| 70209 | + assert( iOffset>=0 ); |
| 70210 | + ovflPgno = get4byte(pCur->info.pPayload + iOffset); |
| 70211 | + pBt = pPage->pBt; |
| 70212 | + ovflPageSize = pBt->usableSize - 4; |
| 70213 | + do{ |
| 70214 | + rc = btreeGetPage(pBt, ovflPgno, &pPage, 0); |
| 70215 | + if( rc ) return rc; |
| 70216 | + if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 ){ |
| 70217 | + rc = SQLITE_CORRUPT_BKPT; |
| 70218 | + }else{ |
| 70219 | + if( iOffset+ovflPageSize<(u32)nTotal ){ |
| 70220 | + ovflPgno = get4byte(pPage->aData); |
| 70221 | + }else{ |
| 70222 | + ovflPageSize = nTotal - iOffset; |
| 70223 | + } |
| 70224 | + rc = btreeOverwriteContent(pPage, pPage->aData+4, pX, |
| 70225 | + iOffset, ovflPageSize); |
| 70226 | + } |
| 70227 | + sqlite3PagerUnref(pPage->pDbPage); |
| 70228 | + if( rc ) return rc; |
| 70229 | + iOffset += ovflPageSize; |
| 70230 | + }while( iOffset<nTotal ); |
| 70231 | + return SQLITE_OK; |
| 70232 | +} |
| 70233 | + |
| 69974 | 70234 | |
| 69975 | 70235 | /* |
| 69976 | 70236 | ** Insert a new record into the BTree. The content of the new record |
| 69977 | 70237 | ** is described by the pX object. The pCur cursor is used only to |
| 69978 | 70238 | ** define what table the record should be inserted into, and is left |
| | @@ -70059,39 +70319,90 @@ |
| 70059 | 70319 | /* If this is an insert into a table b-tree, invalidate any incrblob |
| 70060 | 70320 | ** cursors open on the row being replaced */ |
| 70061 | 70321 | invalidateIncrblobCursors(p, pCur->pgnoRoot, pX->nKey, 0); |
| 70062 | 70322 | |
| 70063 | 70323 | /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing |
| 70064 | | - ** to a row with the same key as the new entry being inserted. */ |
| 70065 | | - assert( (flags & BTREE_SAVEPOSITION)==0 || |
| 70066 | | - ((pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey==pCur->info.nKey) ); |
| 70324 | + ** to a row with the same key as the new entry being inserted. |
| 70325 | + */ |
| 70326 | +#ifdef SQLITE_DEBUG |
| 70327 | + if( flags & BTREE_SAVEPOSITION ){ |
| 70328 | + assert( pCur->curFlags & BTCF_ValidNKey ); |
| 70329 | + assert( pX->nKey==pCur->info.nKey ); |
| 70330 | + assert( pCur->info.nSize!=0 ); |
| 70331 | + assert( loc==0 ); |
| 70332 | + } |
| 70333 | +#endif |
| 70067 | 70334 | |
| 70068 | | - /* If the cursor is currently on the last row and we are appending a |
| 70069 | | - ** new row onto the end, set the "loc" to avoid an unnecessary |
| 70070 | | - ** btreeMoveto() call */ |
| 70335 | + /* On the other hand, BTREE_SAVEPOSITION==0 does not imply |
| 70336 | + ** that the cursor is not pointing to a row to be overwritten. |
| 70337 | + ** So do a complete check. |
| 70338 | + */ |
| 70071 | 70339 | if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey==pCur->info.nKey ){ |
| 70072 | | - loc = 0; |
| 70340 | + /* The cursor is pointing to the entry that is to be |
| 70341 | + ** overwritten */ |
| 70342 | + assert( pX->nData>=0 && pX->nZero>=0 ); |
| 70343 | + if( pCur->info.nSize!=0 |
| 70344 | + && pCur->info.nPayload==(u32)pX->nData+pX->nZero |
| 70345 | + ){ |
| 70346 | + /* New entry is the same size as the old. Do an overwrite */ |
| 70347 | + return btreeOverwriteCell(pCur, pX); |
| 70348 | + } |
| 70349 | + assert( loc==0 ); |
| 70073 | 70350 | }else if( loc==0 ){ |
| 70351 | + /* The cursor is *not* pointing to the cell to be overwritten, nor |
| 70352 | + ** to an adjacent cell. Move the cursor so that it is pointing either |
| 70353 | + ** to the cell to be overwritten or an adjacent cell. |
| 70354 | + */ |
| 70074 | 70355 | rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, flags!=0, &loc); |
| 70075 | 70356 | if( rc ) return rc; |
| 70076 | 70357 | } |
| 70077 | | - }else if( loc==0 && (flags & BTREE_SAVEPOSITION)==0 ){ |
| 70078 | | - if( pX->nMem ){ |
| 70079 | | - UnpackedRecord r; |
| 70080 | | - r.pKeyInfo = pCur->pKeyInfo; |
| 70081 | | - r.aMem = pX->aMem; |
| 70082 | | - r.nField = pX->nMem; |
| 70083 | | - r.default_rc = 0; |
| 70084 | | - r.errCode = 0; |
| 70085 | | - r.r1 = 0; |
| 70086 | | - r.r2 = 0; |
| 70087 | | - r.eqSeen = 0; |
| 70088 | | - rc = sqlite3BtreeMovetoUnpacked(pCur, &r, 0, flags!=0, &loc); |
| 70089 | | - }else{ |
| 70090 | | - rc = btreeMoveto(pCur, pX->pKey, pX->nKey, flags!=0, &loc); |
| 70091 | | - } |
| 70092 | | - if( rc ) return rc; |
| 70358 | + }else{ |
| 70359 | + /* This is an index or a WITHOUT ROWID table */ |
| 70360 | + |
| 70361 | + /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing |
| 70362 | + ** to a row with the same key as the new entry being inserted. |
| 70363 | + */ |
| 70364 | + assert( (flags & BTREE_SAVEPOSITION)==0 || loc==0 ); |
| 70365 | + |
| 70366 | + /* If the cursor is not already pointing either to the cell to be |
| 70367 | + ** overwritten, or if a new cell is being inserted, if the cursor is |
| 70368 | + ** not pointing to an immediately adjacent cell, then move the cursor |
| 70369 | + ** so that it does. |
| 70370 | + */ |
| 70371 | + if( loc==0 && (flags & BTREE_SAVEPOSITION)==0 ){ |
| 70372 | + if( pX->nMem ){ |
| 70373 | + UnpackedRecord r; |
| 70374 | + r.pKeyInfo = pCur->pKeyInfo; |
| 70375 | + r.aMem = pX->aMem; |
| 70376 | + r.nField = pX->nMem; |
| 70377 | + r.default_rc = 0; |
| 70378 | + r.errCode = 0; |
| 70379 | + r.r1 = 0; |
| 70380 | + r.r2 = 0; |
| 70381 | + r.eqSeen = 0; |
| 70382 | + rc = sqlite3BtreeMovetoUnpacked(pCur, &r, 0, flags!=0, &loc); |
| 70383 | + }else{ |
| 70384 | + rc = btreeMoveto(pCur, pX->pKey, pX->nKey, flags!=0, &loc); |
| 70385 | + } |
| 70386 | + if( rc ) return rc; |
| 70387 | + } |
| 70388 | + |
| 70389 | + /* If the cursor is currently pointing to an entry to be overwritten |
| 70390 | + ** and the new content is the same as as the old, then use the |
| 70391 | + ** overwrite optimization. |
| 70392 | + */ |
| 70393 | + if( loc==0 ){ |
| 70394 | + getCellInfo(pCur); |
| 70395 | + if( pCur->info.nKey==pX->nKey ){ |
| 70396 | + BtreePayload x2; |
| 70397 | + x2.pData = pX->pKey; |
| 70398 | + x2.nData = pX->nKey; |
| 70399 | + x2.nZero = 0; |
| 70400 | + return btreeOverwriteCell(pCur, &x2); |
| 70401 | + } |
| 70402 | + } |
| 70403 | + |
| 70093 | 70404 | } |
| 70094 | 70405 | assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) ); |
| 70095 | 70406 | |
| 70096 | 70407 | pPage = pCur->pPage; |
| 70097 | 70408 | assert( pPage->intKey || pX->nKey>=0 ); |
| | @@ -70926,18 +71237,18 @@ |
| 70926 | 71237 | if( !pCheck->mxErr ) return; |
| 70927 | 71238 | pCheck->mxErr--; |
| 70928 | 71239 | pCheck->nErr++; |
| 70929 | 71240 | va_start(ap, zFormat); |
| 70930 | 71241 | if( pCheck->errMsg.nChar ){ |
| 70931 | | - sqlite3StrAccumAppend(&pCheck->errMsg, "\n", 1); |
| 71242 | + sqlite3_str_append(&pCheck->errMsg, "\n", 1); |
| 70932 | 71243 | } |
| 70933 | 71244 | if( pCheck->zPfx ){ |
| 70934 | | - sqlite3XPrintf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2); |
| 71245 | + sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2); |
| 70935 | 71246 | } |
| 70936 | | - sqlite3VXPrintf(&pCheck->errMsg, zFormat, ap); |
| 71247 | + sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap); |
| 70937 | 71248 | va_end(ap); |
| 70938 | | - if( pCheck->errMsg.accError==STRACCUM_NOMEM ){ |
| 71249 | + if( pCheck->errMsg.accError==SQLITE_NOMEM ){ |
| 70939 | 71250 | pCheck->mallocFailed = 1; |
| 70940 | 71251 | } |
| 70941 | 71252 | } |
| 70942 | 71253 | #endif /* SQLITE_OMIT_INTEGRITY_CHECK */ |
| 70943 | 71254 | |
| | @@ -71517,15 +71828,15 @@ |
| 71517 | 71828 | */ |
| 71518 | 71829 | integrity_ck_cleanup: |
| 71519 | 71830 | sqlite3PageFree(sCheck.heap); |
| 71520 | 71831 | sqlite3_free(sCheck.aPgRef); |
| 71521 | 71832 | if( sCheck.mallocFailed ){ |
| 71522 | | - sqlite3StrAccumReset(&sCheck.errMsg); |
| 71833 | + sqlite3_str_reset(&sCheck.errMsg); |
| 71523 | 71834 | sCheck.nErr++; |
| 71524 | 71835 | } |
| 71525 | 71836 | *pnErr = sCheck.nErr; |
| 71526 | | - if( sCheck.nErr==0 ) sqlite3StrAccumReset(&sCheck.errMsg); |
| 71837 | + if( sCheck.nErr==0 ) sqlite3_str_reset(&sCheck.errMsg); |
| 71527 | 71838 | /* Make sure this analysis did not leave any unref() pages. */ |
| 71528 | 71839 | assert( nRef==sqlite3PagerRefcount(pBt->pPager) ); |
| 71529 | 71840 | sqlite3BtreeLeave(p); |
| 71530 | 71841 | return sqlite3StrAccumFinish(&sCheck.errMsg); |
| 71531 | 71842 | } |
| | @@ -75770,27 +76081,27 @@ |
| 75770 | 76081 | */ |
| 75771 | 76082 | static void displayP4Expr(StrAccum *p, Expr *pExpr){ |
| 75772 | 76083 | const char *zOp = 0; |
| 75773 | 76084 | switch( pExpr->op ){ |
| 75774 | 76085 | case TK_STRING: |
| 75775 | | - sqlite3XPrintf(p, "%Q", pExpr->u.zToken); |
| 76086 | + sqlite3_str_appendf(p, "%Q", pExpr->u.zToken); |
| 75776 | 76087 | break; |
| 75777 | 76088 | case TK_INTEGER: |
| 75778 | | - sqlite3XPrintf(p, "%d", pExpr->u.iValue); |
| 76089 | + sqlite3_str_appendf(p, "%d", pExpr->u.iValue); |
| 75779 | 76090 | break; |
| 75780 | 76091 | case TK_NULL: |
| 75781 | | - sqlite3XPrintf(p, "NULL"); |
| 76092 | + sqlite3_str_appendf(p, "NULL"); |
| 75782 | 76093 | break; |
| 75783 | 76094 | case TK_REGISTER: { |
| 75784 | | - sqlite3XPrintf(p, "r[%d]", pExpr->iTable); |
| 76095 | + sqlite3_str_appendf(p, "r[%d]", pExpr->iTable); |
| 75785 | 76096 | break; |
| 75786 | 76097 | } |
| 75787 | 76098 | case TK_COLUMN: { |
| 75788 | 76099 | if( pExpr->iColumn<0 ){ |
| 75789 | | - sqlite3XPrintf(p, "rowid"); |
| 76100 | + sqlite3_str_appendf(p, "rowid"); |
| 75790 | 76101 | }else{ |
| 75791 | | - sqlite3XPrintf(p, "c%d", (int)pExpr->iColumn); |
| 76102 | + sqlite3_str_appendf(p, "c%d", (int)pExpr->iColumn); |
| 75792 | 76103 | } |
| 75793 | 76104 | break; |
| 75794 | 76105 | } |
| 75795 | 76106 | case TK_LT: zOp = "LT"; break; |
| 75796 | 76107 | case TK_LE: zOp = "LE"; break; |
| | @@ -75818,22 +76129,22 @@ |
| 75818 | 76129 | case TK_NOT: zOp = "NOT"; break; |
| 75819 | 76130 | case TK_ISNULL: zOp = "ISNULL"; break; |
| 75820 | 76131 | case TK_NOTNULL: zOp = "NOTNULL"; break; |
| 75821 | 76132 | |
| 75822 | 76133 | default: |
| 75823 | | - sqlite3XPrintf(p, "%s", "expr"); |
| 76134 | + sqlite3_str_appendf(p, "%s", "expr"); |
| 75824 | 76135 | break; |
| 75825 | 76136 | } |
| 75826 | 76137 | |
| 75827 | 76138 | if( zOp ){ |
| 75828 | | - sqlite3XPrintf(p, "%s(", zOp); |
| 76139 | + sqlite3_str_appendf(p, "%s(", zOp); |
| 75829 | 76140 | displayP4Expr(p, pExpr->pLeft); |
| 75830 | 76141 | if( pExpr->pRight ){ |
| 75831 | | - sqlite3StrAccumAppend(p, ",", 1); |
| 76142 | + sqlite3_str_append(p, ",", 1); |
| 75832 | 76143 | displayP4Expr(p, pExpr->pRight); |
| 75833 | 76144 | } |
| 75834 | | - sqlite3StrAccumAppend(p, ")", 1); |
| 76145 | + sqlite3_str_append(p, ")", 1); |
| 75835 | 76146 | } |
| 75836 | 76147 | } |
| 75837 | 76148 | #endif /* VDBE_DISPLAY_P4 && defined(SQLITE_ENABLE_CURSOR_HINTS) */ |
| 75838 | 76149 | |
| 75839 | 76150 | |
| | @@ -75850,18 +76161,19 @@ |
| 75850 | 76161 | switch( pOp->p4type ){ |
| 75851 | 76162 | case P4_KEYINFO: { |
| 75852 | 76163 | int j; |
| 75853 | 76164 | KeyInfo *pKeyInfo = pOp->p4.pKeyInfo; |
| 75854 | 76165 | assert( pKeyInfo->aSortOrder!=0 ); |
| 75855 | | - sqlite3XPrintf(&x, "k(%d", pKeyInfo->nKeyField); |
| 76166 | + sqlite3_str_appendf(&x, "k(%d", pKeyInfo->nKeyField); |
| 75856 | 76167 | for(j=0; j<pKeyInfo->nKeyField; j++){ |
| 75857 | 76168 | CollSeq *pColl = pKeyInfo->aColl[j]; |
| 75858 | 76169 | const char *zColl = pColl ? pColl->zName : ""; |
| 75859 | 76170 | if( strcmp(zColl, "BINARY")==0 ) zColl = "B"; |
| 75860 | | - sqlite3XPrintf(&x, ",%s%s", pKeyInfo->aSortOrder[j] ? "-" : "", zColl); |
| 76171 | + sqlite3_str_appendf(&x, ",%s%s", |
| 76172 | + pKeyInfo->aSortOrder[j] ? "-" : "", zColl); |
| 75861 | 76173 | } |
| 75862 | | - sqlite3StrAccumAppend(&x, ")", 1); |
| 76174 | + sqlite3_str_append(&x, ")", 1); |
| 75863 | 76175 | break; |
| 75864 | 76176 | } |
| 75865 | 76177 | #ifdef SQLITE_ENABLE_CURSOR_HINTS |
| 75866 | 76178 | case P4_EXPR: { |
| 75867 | 76179 | displayP4Expr(&x, pOp->p4.pExpr); |
| | @@ -75868,45 +76180,45 @@ |
| 75868 | 76180 | break; |
| 75869 | 76181 | } |
| 75870 | 76182 | #endif |
| 75871 | 76183 | case P4_COLLSEQ: { |
| 75872 | 76184 | CollSeq *pColl = pOp->p4.pColl; |
| 75873 | | - sqlite3XPrintf(&x, "(%.20s)", pColl->zName); |
| 76185 | + sqlite3_str_appendf(&x, "(%.20s)", pColl->zName); |
| 75874 | 76186 | break; |
| 75875 | 76187 | } |
| 75876 | 76188 | case P4_FUNCDEF: { |
| 75877 | 76189 | FuncDef *pDef = pOp->p4.pFunc; |
| 75878 | | - sqlite3XPrintf(&x, "%s(%d)", pDef->zName, pDef->nArg); |
| 76190 | + sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg); |
| 75879 | 76191 | break; |
| 75880 | 76192 | } |
| 75881 | 76193 | #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) |
| 75882 | 76194 | case P4_FUNCCTX: { |
| 75883 | 76195 | FuncDef *pDef = pOp->p4.pCtx->pFunc; |
| 75884 | | - sqlite3XPrintf(&x, "%s(%d)", pDef->zName, pDef->nArg); |
| 76196 | + sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg); |
| 75885 | 76197 | break; |
| 75886 | 76198 | } |
| 75887 | 76199 | #endif |
| 75888 | 76200 | case P4_INT64: { |
| 75889 | | - sqlite3XPrintf(&x, "%lld", *pOp->p4.pI64); |
| 76201 | + sqlite3_str_appendf(&x, "%lld", *pOp->p4.pI64); |
| 75890 | 76202 | break; |
| 75891 | 76203 | } |
| 75892 | 76204 | case P4_INT32: { |
| 75893 | | - sqlite3XPrintf(&x, "%d", pOp->p4.i); |
| 76205 | + sqlite3_str_appendf(&x, "%d", pOp->p4.i); |
| 75894 | 76206 | break; |
| 75895 | 76207 | } |
| 75896 | 76208 | case P4_REAL: { |
| 75897 | | - sqlite3XPrintf(&x, "%.16g", *pOp->p4.pReal); |
| 76209 | + sqlite3_str_appendf(&x, "%.16g", *pOp->p4.pReal); |
| 75898 | 76210 | break; |
| 75899 | 76211 | } |
| 75900 | 76212 | case P4_MEM: { |
| 75901 | 76213 | Mem *pMem = pOp->p4.pMem; |
| 75902 | 76214 | if( pMem->flags & MEM_Str ){ |
| 75903 | 76215 | zP4 = pMem->z; |
| 75904 | 76216 | }else if( pMem->flags & MEM_Int ){ |
| 75905 | | - sqlite3XPrintf(&x, "%lld", pMem->u.i); |
| 76217 | + sqlite3_str_appendf(&x, "%lld", pMem->u.i); |
| 75906 | 76218 | }else if( pMem->flags & MEM_Real ){ |
| 75907 | | - sqlite3XPrintf(&x, "%.16g", pMem->u.r); |
| 76219 | + sqlite3_str_appendf(&x, "%.16g", pMem->u.r); |
| 75908 | 76220 | }else if( pMem->flags & MEM_Null ){ |
| 75909 | 76221 | zP4 = "NULL"; |
| 75910 | 76222 | }else{ |
| 75911 | 76223 | assert( pMem->flags & MEM_Blob ); |
| 75912 | 76224 | zP4 = "(blob)"; |
| | @@ -75914,37 +76226,37 @@ |
| 75914 | 76226 | break; |
| 75915 | 76227 | } |
| 75916 | 76228 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 75917 | 76229 | case P4_VTAB: { |
| 75918 | 76230 | sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab; |
| 75919 | | - sqlite3XPrintf(&x, "vtab:%p", pVtab); |
| 76231 | + sqlite3_str_appendf(&x, "vtab:%p", pVtab); |
| 75920 | 76232 | break; |
| 75921 | 76233 | } |
| 75922 | 76234 | #endif |
| 75923 | 76235 | case P4_INTARRAY: { |
| 75924 | 76236 | int i; |
| 75925 | 76237 | int *ai = pOp->p4.ai; |
| 75926 | 76238 | int n = ai[0]; /* The first element of an INTARRAY is always the |
| 75927 | 76239 | ** count of the number of elements to follow */ |
| 75928 | 76240 | for(i=1; i<=n; i++){ |
| 75929 | | - sqlite3XPrintf(&x, ",%d", ai[i]); |
| 76241 | + sqlite3_str_appendf(&x, ",%d", ai[i]); |
| 75930 | 76242 | } |
| 75931 | 76243 | zTemp[0] = '['; |
| 75932 | | - sqlite3StrAccumAppend(&x, "]", 1); |
| 76244 | + sqlite3_str_append(&x, "]", 1); |
| 75933 | 76245 | break; |
| 75934 | 76246 | } |
| 75935 | 76247 | case P4_SUBPROGRAM: { |
| 75936 | | - sqlite3XPrintf(&x, "program"); |
| 76248 | + sqlite3_str_appendf(&x, "program"); |
| 75937 | 76249 | break; |
| 75938 | 76250 | } |
| 75939 | 76251 | case P4_DYNBLOB: |
| 75940 | 76252 | case P4_ADVANCE: { |
| 75941 | 76253 | zTemp[0] = 0; |
| 75942 | 76254 | break; |
| 75943 | 76255 | } |
| 75944 | 76256 | case P4_TABLE: { |
| 75945 | | - sqlite3XPrintf(&x, "%s", pOp->p4.pTab->zName); |
| 76257 | + sqlite3_str_appendf(&x, "%s", pOp->p4.pTab->zName); |
| 75946 | 76258 | break; |
| 75947 | 76259 | } |
| 75948 | 76260 | default: { |
| 75949 | 76261 | zP4 = pOp->p4.z; |
| 75950 | 76262 | if( zP4==0 ){ |
| | @@ -81353,21 +81665,21 @@ |
| 81353 | 81665 | db->aLimit[SQLITE_LIMIT_LENGTH]); |
| 81354 | 81666 | if( db->nVdbeExec>1 ){ |
| 81355 | 81667 | while( *zRawSql ){ |
| 81356 | 81668 | const char *zStart = zRawSql; |
| 81357 | 81669 | while( *(zRawSql++)!='\n' && *zRawSql ); |
| 81358 | | - sqlite3StrAccumAppend(&out, "-- ", 3); |
| 81670 | + sqlite3_str_append(&out, "-- ", 3); |
| 81359 | 81671 | assert( (zRawSql - zStart) > 0 ); |
| 81360 | | - sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart)); |
| 81672 | + sqlite3_str_append(&out, zStart, (int)(zRawSql-zStart)); |
| 81361 | 81673 | } |
| 81362 | 81674 | }else if( p->nVar==0 ){ |
| 81363 | | - sqlite3StrAccumAppend(&out, zRawSql, sqlite3Strlen30(zRawSql)); |
| 81675 | + sqlite3_str_append(&out, zRawSql, sqlite3Strlen30(zRawSql)); |
| 81364 | 81676 | }else{ |
| 81365 | 81677 | while( zRawSql[0] ){ |
| 81366 | 81678 | n = findNextHostParameter(zRawSql, &nToken); |
| 81367 | 81679 | assert( n>0 ); |
| 81368 | | - sqlite3StrAccumAppend(&out, zRawSql, n); |
| 81680 | + sqlite3_str_append(&out, zRawSql, n); |
| 81369 | 81681 | zRawSql += n; |
| 81370 | 81682 | assert( zRawSql[0] || nToken==0 ); |
| 81371 | 81683 | if( nToken==0 ) break; |
| 81372 | 81684 | if( zRawSql[0]=='?' ){ |
| 81373 | 81685 | if( nToken>1 ){ |
| | @@ -81389,25 +81701,25 @@ |
| 81389 | 81701 | zRawSql += nToken; |
| 81390 | 81702 | nextIndex = idx + 1; |
| 81391 | 81703 | assert( idx>0 && idx<=p->nVar ); |
| 81392 | 81704 | pVar = &p->aVar[idx-1]; |
| 81393 | 81705 | if( pVar->flags & MEM_Null ){ |
| 81394 | | - sqlite3StrAccumAppend(&out, "NULL", 4); |
| 81706 | + sqlite3_str_append(&out, "NULL", 4); |
| 81395 | 81707 | }else if( pVar->flags & MEM_Int ){ |
| 81396 | | - sqlite3XPrintf(&out, "%lld", pVar->u.i); |
| 81708 | + sqlite3_str_appendf(&out, "%lld", pVar->u.i); |
| 81397 | 81709 | }else if( pVar->flags & MEM_Real ){ |
| 81398 | | - sqlite3XPrintf(&out, "%!.15g", pVar->u.r); |
| 81710 | + sqlite3_str_appendf(&out, "%!.15g", pVar->u.r); |
| 81399 | 81711 | }else if( pVar->flags & MEM_Str ){ |
| 81400 | 81712 | int nOut; /* Number of bytes of the string text to include in output */ |
| 81401 | 81713 | #ifndef SQLITE_OMIT_UTF16 |
| 81402 | 81714 | u8 enc = ENC(db); |
| 81403 | 81715 | if( enc!=SQLITE_UTF8 ){ |
| 81404 | 81716 | memset(&utf8, 0, sizeof(utf8)); |
| 81405 | 81717 | utf8.db = db; |
| 81406 | 81718 | sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC); |
| 81407 | 81719 | if( SQLITE_NOMEM==sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){ |
| 81408 | | - out.accError = STRACCUM_NOMEM; |
| 81720 | + out.accError = SQLITE_NOMEM; |
| 81409 | 81721 | out.nAlloc = 0; |
| 81410 | 81722 | } |
| 81411 | 81723 | pVar = &utf8; |
| 81412 | 81724 | } |
| 81413 | 81725 | #endif |
| | @@ -81416,42 +81728,42 @@ |
| 81416 | 81728 | if( nOut>SQLITE_TRACE_SIZE_LIMIT ){ |
| 81417 | 81729 | nOut = SQLITE_TRACE_SIZE_LIMIT; |
| 81418 | 81730 | while( nOut<pVar->n && (pVar->z[nOut]&0xc0)==0x80 ){ nOut++; } |
| 81419 | 81731 | } |
| 81420 | 81732 | #endif |
| 81421 | | - sqlite3XPrintf(&out, "'%.*q'", nOut, pVar->z); |
| 81733 | + sqlite3_str_appendf(&out, "'%.*q'", nOut, pVar->z); |
| 81422 | 81734 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 81423 | 81735 | if( nOut<pVar->n ){ |
| 81424 | | - sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-nOut); |
| 81736 | + sqlite3_str_appendf(&out, "/*+%d bytes*/", pVar->n-nOut); |
| 81425 | 81737 | } |
| 81426 | 81738 | #endif |
| 81427 | 81739 | #ifndef SQLITE_OMIT_UTF16 |
| 81428 | 81740 | if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8); |
| 81429 | 81741 | #endif |
| 81430 | 81742 | }else if( pVar->flags & MEM_Zero ){ |
| 81431 | | - sqlite3XPrintf(&out, "zeroblob(%d)", pVar->u.nZero); |
| 81743 | + sqlite3_str_appendf(&out, "zeroblob(%d)", pVar->u.nZero); |
| 81432 | 81744 | }else{ |
| 81433 | 81745 | int nOut; /* Number of bytes of the blob to include in output */ |
| 81434 | 81746 | assert( pVar->flags & MEM_Blob ); |
| 81435 | | - sqlite3StrAccumAppend(&out, "x'", 2); |
| 81747 | + sqlite3_str_append(&out, "x'", 2); |
| 81436 | 81748 | nOut = pVar->n; |
| 81437 | 81749 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 81438 | 81750 | if( nOut>SQLITE_TRACE_SIZE_LIMIT ) nOut = SQLITE_TRACE_SIZE_LIMIT; |
| 81439 | 81751 | #endif |
| 81440 | 81752 | for(i=0; i<nOut; i++){ |
| 81441 | | - sqlite3XPrintf(&out, "%02x", pVar->z[i]&0xff); |
| 81753 | + sqlite3_str_appendf(&out, "%02x", pVar->z[i]&0xff); |
| 81442 | 81754 | } |
| 81443 | | - sqlite3StrAccumAppend(&out, "'", 1); |
| 81755 | + sqlite3_str_append(&out, "'", 1); |
| 81444 | 81756 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 81445 | 81757 | if( nOut<pVar->n ){ |
| 81446 | | - sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-nOut); |
| 81758 | + sqlite3_str_appendf(&out, "/*+%d bytes*/", pVar->n-nOut); |
| 81447 | 81759 | } |
| 81448 | 81760 | #endif |
| 81449 | 81761 | } |
| 81450 | 81762 | } |
| 81451 | 81763 | } |
| 81452 | | - if( out.accError ) sqlite3StrAccumReset(&out); |
| 81764 | + if( out.accError ) sqlite3_str_reset(&out); |
| 81453 | 81765 | return sqlite3StrAccumFinish(&out); |
| 81454 | 81766 | } |
| 81455 | 81767 | |
| 81456 | 81768 | #endif /* #ifndef SQLITE_OMIT_TRACE */ |
| 81457 | 81769 | |
| | @@ -107716,20 +108028,20 @@ |
| 107716 | 108028 | StrAccum errMsg; |
| 107717 | 108029 | Table *pTab = pIdx->pTable; |
| 107718 | 108030 | |
| 107719 | 108031 | sqlite3StrAccumInit(&errMsg, pParse->db, 0, 0, 200); |
| 107720 | 108032 | if( pIdx->aColExpr ){ |
| 107721 | | - sqlite3XPrintf(&errMsg, "index '%q'", pIdx->zName); |
| 108033 | + sqlite3_str_appendf(&errMsg, "index '%q'", pIdx->zName); |
| 107722 | 108034 | }else{ |
| 107723 | 108035 | for(j=0; j<pIdx->nKeyCol; j++){ |
| 107724 | 108036 | char *zCol; |
| 107725 | 108037 | assert( pIdx->aiColumn[j]>=0 ); |
| 107726 | 108038 | zCol = pTab->aCol[pIdx->aiColumn[j]].zName; |
| 107727 | | - if( j ) sqlite3StrAccumAppend(&errMsg, ", ", 2); |
| 107728 | | - sqlite3StrAccumAppendAll(&errMsg, pTab->zName); |
| 107729 | | - sqlite3StrAccumAppend(&errMsg, ".", 1); |
| 107730 | | - sqlite3StrAccumAppendAll(&errMsg, zCol); |
| 108039 | + if( j ) sqlite3_str_append(&errMsg, ", ", 2); |
| 108040 | + sqlite3_str_appendall(&errMsg, pTab->zName); |
| 108041 | + sqlite3_str_append(&errMsg, ".", 1); |
| 108042 | + sqlite3_str_appendall(&errMsg, zCol); |
| 107731 | 108043 | } |
| 107732 | 108044 | } |
| 107733 | 108045 | zErr = sqlite3StrAccumFinish(&errMsg); |
| 107734 | 108046 | sqlite3HaltConstraint(pParse, |
| 107735 | 108047 | IsPrimaryKeyIndex(pIdx) ? SQLITE_CONSTRAINT_PRIMARYKEY |
| | @@ -109695,11 +110007,11 @@ |
| 109695 | 110007 | x.nArg = argc-1; |
| 109696 | 110008 | x.nUsed = 0; |
| 109697 | 110009 | x.apArg = argv+1; |
| 109698 | 110010 | sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]); |
| 109699 | 110011 | str.printfFlags = SQLITE_PRINTF_SQLFUNC; |
| 109700 | | - sqlite3XPrintf(&str, zFormat, &x); |
| 110012 | + sqlite3_str_appendf(&str, zFormat, &x); |
| 109701 | 110013 | n = str.nChar; |
| 109702 | 110014 | sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n, |
| 109703 | 110015 | SQLITE_DYNAMIC); |
| 109704 | 110016 | } |
| 109705 | 110017 | } |
| | @@ -111098,24 +111410,24 @@ |
| 111098 | 111410 | nSep = sqlite3_value_bytes(argv[1]); |
| 111099 | 111411 | }else{ |
| 111100 | 111412 | zSep = ","; |
| 111101 | 111413 | nSep = 1; |
| 111102 | 111414 | } |
| 111103 | | - if( zSep ) sqlite3StrAccumAppend(pAccum, zSep, nSep); |
| 111415 | + if( zSep ) sqlite3_str_append(pAccum, zSep, nSep); |
| 111104 | 111416 | } |
| 111105 | 111417 | zVal = (char*)sqlite3_value_text(argv[0]); |
| 111106 | 111418 | nVal = sqlite3_value_bytes(argv[0]); |
| 111107 | | - if( zVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal); |
| 111419 | + if( zVal ) sqlite3_str_append(pAccum, zVal, nVal); |
| 111108 | 111420 | } |
| 111109 | 111421 | } |
| 111110 | 111422 | static void groupConcatFinalize(sqlite3_context *context){ |
| 111111 | 111423 | StrAccum *pAccum; |
| 111112 | 111424 | pAccum = sqlite3_aggregate_context(context, 0); |
| 111113 | 111425 | if( pAccum ){ |
| 111114 | | - if( pAccum->accError==STRACCUM_TOOBIG ){ |
| 111426 | + if( pAccum->accError==SQLITE_TOOBIG ){ |
| 111115 | 111427 | sqlite3_result_error_toobig(context); |
| 111116 | | - }else if( pAccum->accError==STRACCUM_NOMEM ){ |
| 111428 | + }else if( pAccum->accError==SQLITE_NOMEM ){ |
| 111117 | 111429 | sqlite3_result_error_nomem(context); |
| 111118 | 111430 | }else{ |
| 111119 | 111431 | sqlite3_result_text(context, sqlite3StrAccumFinish(pAccum), -1, |
| 111120 | 111432 | sqlite3_free); |
| 111121 | 111433 | } |
| | @@ -115673,10 +115985,25 @@ |
| 115673 | 115985 | void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*)); |
| 115674 | 115986 | void *(*value_pointer)(sqlite3_value*,const char*); |
| 115675 | 115987 | int (*vtab_nochange)(sqlite3_context*); |
| 115676 | 115988 | int (*value_nochange)(sqlite3_value*); |
| 115677 | 115989 | const char *(*vtab_collation)(sqlite3_index_info*,int); |
| 115990 | + /* Version 3.24.0 and later */ |
| 115991 | + int (*keyword_count)(void); |
| 115992 | + int (*keyword_name)(int,const char**,int*); |
| 115993 | + int (*keyword_check)(const char*,int); |
| 115994 | + sqlite3_str *(*str_new)(sqlite3*); |
| 115995 | + char *(*str_finish)(sqlite3_str*); |
| 115996 | + void (*str_appendf)(sqlite3_str*, const char *zFormat, ...); |
| 115997 | + void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list); |
| 115998 | + void (*str_append)(sqlite3_str*, const char *zIn, int N); |
| 115999 | + void (*str_appendall)(sqlite3_str*, const char *zIn); |
| 116000 | + void (*str_appendchar)(sqlite3_str*, int N, char C); |
| 116001 | + void (*str_reset)(sqlite3_str*); |
| 116002 | + int (*str_errcode)(sqlite3_str*); |
| 116003 | + int (*str_length)(sqlite3_str*); |
| 116004 | + char *(*str_value)(sqlite3_str*); |
| 115678 | 116005 | }; |
| 115679 | 116006 | |
| 115680 | 116007 | /* |
| 115681 | 116008 | ** This is the function signature used for all extension entry points. It |
| 115682 | 116009 | ** is also defined in the file "loadext.c". |
| | @@ -115943,10 +116270,25 @@ |
| 115943 | 116270 | #define sqlite3_value_pointer sqlite3_api->value_pointer |
| 115944 | 116271 | /* Version 3.22.0 and later */ |
| 115945 | 116272 | #define sqlite3_vtab_nochange sqlite3_api->vtab_nochange |
| 115946 | 116273 | #define sqlite3_value_nochange sqlite3_api->value_nochange |
| 115947 | 116274 | #define sqlite3_vtab_collation sqlite3_api->vtab_collation |
| 116275 | +/* Version 3.24.0 and later */ |
| 116276 | +#define sqlite3_keyword_count sqlite3_api->keyword_count |
| 116277 | +#define sqlite3_keyword_name sqlite3_api->keyword_name |
| 116278 | +#define sqlite3_keyword_check sqlite3_api->keyword_check |
| 116279 | +#define sqlite3_str_new sqlite3_api->str_new |
| 116280 | +#define sqlite3_str_finish sqlite3_api->str_finish |
| 116281 | +#define sqlite3_str_appendf sqlite3_api->str_appendf |
| 116282 | +#define sqlite3_str_vappendf sqlite3_api->str_vappendf |
| 116283 | +#define sqlite3_str_append sqlite3_api->str_append |
| 116284 | +#define sqlite3_str_appendall sqlite3_api->str_appendall |
| 116285 | +#define sqlite3_str_appendchar sqlite3_api->str_appendchar |
| 116286 | +#define sqlite3_str_reset sqlite3_api->str_reset |
| 116287 | +#define sqlite3_str_errcode sqlite3_api->str_errcode |
| 116288 | +#define sqlite3_str_length sqlite3_api->str_length |
| 116289 | +#define sqlite3_str_value sqlite3_api->str_value |
| 115948 | 116290 | #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ |
| 115949 | 116291 | |
| 115950 | 116292 | #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) |
| 115951 | 116293 | /* This case when the file really is being compiled as a loadable |
| 115952 | 116294 | ** extension */ |
| | @@ -116381,11 +116723,26 @@ |
| 116381 | 116723 | sqlite3_result_pointer, |
| 116382 | 116724 | sqlite3_value_pointer, |
| 116383 | 116725 | /* Version 3.22.0 and later */ |
| 116384 | 116726 | sqlite3_vtab_nochange, |
| 116385 | 116727 | sqlite3_value_nochange, |
| 116386 | | - sqlite3_vtab_collation |
| 116728 | + sqlite3_vtab_collation, |
| 116729 | + /* Version 3.24.0 and later */ |
| 116730 | + sqlite3_keyword_count, |
| 116731 | + sqlite3_keyword_name, |
| 116732 | + sqlite3_keyword_check, |
| 116733 | + sqlite3_str_new, |
| 116734 | + sqlite3_str_finish, |
| 116735 | + sqlite3_str_appendf, |
| 116736 | + sqlite3_str_vappendf, |
| 116737 | + sqlite3_str_append, |
| 116738 | + sqlite3_str_appendall, |
| 116739 | + sqlite3_str_appendchar, |
| 116740 | + sqlite3_str_reset, |
| 116741 | + sqlite3_str_errcode, |
| 116742 | + sqlite3_str_length, |
| 116743 | + sqlite3_str_value |
| 116387 | 116744 | }; |
| 116388 | 116745 | |
| 116389 | 116746 | /* |
| 116390 | 116747 | ** Attempt to load an SQLite extension library contained in the file |
| 116391 | 116748 | ** zFile. The entry point is zProc. zProc may be 0 in which case a |
| | @@ -116447,14 +116804,12 @@ |
| 116447 | 116804 | |
| 116448 | 116805 | handle = sqlite3OsDlOpen(pVfs, zFile); |
| 116449 | 116806 | #if SQLITE_OS_UNIX || SQLITE_OS_WIN |
| 116450 | 116807 | for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){ |
| 116451 | 116808 | char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]); |
| 116452 | | - int bExists = 0; |
| 116453 | 116809 | if( zAltFile==0 ) return SQLITE_NOMEM_BKPT; |
| 116454 | | - sqlite3OsAccess(pVfs, zAltFile, SQLITE_ACCESS_EXISTS, &bExists); |
| 116455 | | - if( bExists ) handle = sqlite3OsDlOpen(pVfs, zAltFile); |
| 116810 | + handle = sqlite3OsDlOpen(pVfs, zAltFile); |
| 116456 | 116811 | sqlite3_free(zAltFile); |
| 116457 | 116812 | } |
| 116458 | 116813 | #endif |
| 116459 | 116814 | if( handle==0 ){ |
| 116460 | 116815 | if( pzErrMsg ){ |
| | @@ -119622,30 +119977,30 @@ |
| 119622 | 119977 | char zBuf[200]; |
| 119623 | 119978 | |
| 119624 | 119979 | UNUSED_PARAMETER(argc); |
| 119625 | 119980 | UNUSED_PARAMETER(argv); |
| 119626 | 119981 | sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); |
| 119627 | | - sqlite3StrAccumAppendAll(&acc, "CREATE TABLE x"); |
| 119982 | + sqlite3_str_appendall(&acc, "CREATE TABLE x"); |
| 119628 | 119983 | for(i=0, j=pPragma->iPragCName; i<pPragma->nPragCName; i++, j++){ |
| 119629 | | - sqlite3XPrintf(&acc, "%c\"%s\"", cSep, pragCName[j]); |
| 119984 | + sqlite3_str_appendf(&acc, "%c\"%s\"", cSep, pragCName[j]); |
| 119630 | 119985 | cSep = ','; |
| 119631 | 119986 | } |
| 119632 | 119987 | if( i==0 ){ |
| 119633 | | - sqlite3XPrintf(&acc, "(\"%s\"", pPragma->zName); |
| 119988 | + sqlite3_str_appendf(&acc, "(\"%s\"", pPragma->zName); |
| 119634 | 119989 | cSep = ','; |
| 119635 | 119990 | i++; |
| 119636 | 119991 | } |
| 119637 | 119992 | j = 0; |
| 119638 | 119993 | if( pPragma->mPragFlg & PragFlg_Result1 ){ |
| 119639 | | - sqlite3StrAccumAppendAll(&acc, ",arg HIDDEN"); |
| 119994 | + sqlite3_str_appendall(&acc, ",arg HIDDEN"); |
| 119640 | 119995 | j++; |
| 119641 | 119996 | } |
| 119642 | 119997 | if( pPragma->mPragFlg & (PragFlg_SchemaOpt|PragFlg_SchemaReq) ){ |
| 119643 | | - sqlite3StrAccumAppendAll(&acc, ",schema HIDDEN"); |
| 119998 | + sqlite3_str_appendall(&acc, ",schema HIDDEN"); |
| 119644 | 119999 | j++; |
| 119645 | 120000 | } |
| 119646 | | - sqlite3StrAccumAppend(&acc, ")", 1); |
| 120001 | + sqlite3_str_append(&acc, ")", 1); |
| 119647 | 120002 | sqlite3StrAccumFinish(&acc); |
| 119648 | 120003 | assert( strlen(zBuf) < sizeof(zBuf)-1 ); |
| 119649 | 120004 | rc = sqlite3_declare_vtab(db, zBuf); |
| 119650 | 120005 | if( rc==SQLITE_OK ){ |
| 119651 | 120006 | pTab = (PragmaVtab*)sqlite3_malloc(sizeof(PragmaVtab)); |
| | @@ -119793,17 +120148,17 @@ |
| 119793 | 120148 | return SQLITE_NOMEM; |
| 119794 | 120149 | } |
| 119795 | 120150 | } |
| 119796 | 120151 | } |
| 119797 | 120152 | sqlite3StrAccumInit(&acc, 0, 0, 0, pTab->db->aLimit[SQLITE_LIMIT_SQL_LENGTH]); |
| 119798 | | - sqlite3StrAccumAppendAll(&acc, "PRAGMA "); |
| 120153 | + sqlite3_str_appendall(&acc, "PRAGMA "); |
| 119799 | 120154 | if( pCsr->azArg[1] ){ |
| 119800 | | - sqlite3XPrintf(&acc, "%Q.", pCsr->azArg[1]); |
| 120155 | + sqlite3_str_appendf(&acc, "%Q.", pCsr->azArg[1]); |
| 119801 | 120156 | } |
| 119802 | | - sqlite3StrAccumAppendAll(&acc, pTab->pName->zName); |
| 120157 | + sqlite3_str_appendall(&acc, pTab->pName->zName); |
| 119803 | 120158 | if( pCsr->azArg[0] ){ |
| 119804 | | - sqlite3XPrintf(&acc, "=%Q", pCsr->azArg[0]); |
| 120159 | + sqlite3_str_appendf(&acc, "=%Q", pCsr->azArg[0]); |
| 119805 | 120160 | } |
| 119806 | 120161 | zSql = sqlite3StrAccumFinish(&acc); |
| 119807 | 120162 | if( zSql==0 ) return SQLITE_NOMEM; |
| 119808 | 120163 | rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pPragma, 0); |
| 119809 | 120164 | sqlite3_free(zSql); |
| | @@ -121433,13 +121788,14 @@ |
| 121433 | 121788 | ** will be completely unrelated to regOrigData. |
| 121434 | 121789 | ** (2) All output columns are included in the sort record. In that |
| 121435 | 121790 | ** case regData==regOrigData. |
| 121436 | 121791 | ** (3) Some output columns are omitted from the sort record due to |
| 121437 | 121792 | ** the SQLITE_ENABLE_SORTER_REFERENCE optimization, or due to the |
| 121438 | | - ** SQLITE_ECEL_OMITREF optimization. In that case, regOrigData==0 |
| 121439 | | - ** to prevent this routine from trying to copy values that might |
| 121440 | | - ** not exist. |
| 121793 | + ** SQLITE_ECEL_OMITREF optimization, or due to the |
| 121794 | + ** SortCtx.pDeferredRowLoad optimiation. In any of these cases |
| 121795 | + ** regOrigData is 0 to prevent this routine from trying to copy |
| 121796 | + ** values that might not yet exist. |
| 121441 | 121797 | */ |
| 121442 | 121798 | assert( nData==1 || regData==regOrigData || regOrigData==0 ); |
| 121443 | 121799 | |
| 121444 | 121800 | if( nPrefixReg ){ |
| 121445 | 121801 | assert( nPrefixReg==nExpr+bSeq ); |
| | @@ -121816,10 +122172,11 @@ |
| 121816 | 122172 | && nPrefixReg>0 |
| 121817 | 122173 | ){ |
| 121818 | 122174 | assert( pSort!=0 ); |
| 121819 | 122175 | assert( hasDistinct==0 ); |
| 121820 | 122176 | pSort->pDeferredRowLoad = &sRowLoadInfo; |
| 122177 | + regOrig = 0; |
| 121821 | 122178 | }else{ |
| 121822 | 122179 | innerLoopLoadRow(pParse, p, &sRowLoadInfo); |
| 121823 | 122180 | } |
| 121824 | 122181 | } |
| 121825 | 122182 | |
| | @@ -131819,16 +132176,14 @@ |
| 131819 | 132176 | #ifndef SQLITE_OMIT_EXPLAIN |
| 131820 | 132177 | SQLITE_PRIVATE int sqlite3WhereExplainOneScan( |
| 131821 | 132178 | Parse *pParse, /* Parse context */ |
| 131822 | 132179 | SrcList *pTabList, /* Table list this loop refers to */ |
| 131823 | 132180 | WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ |
| 131824 | | - int iLevel, /* Value for "level" column of output */ |
| 131825 | | - int iFrom, /* Value for "from" column of output */ |
| 131826 | 132181 | u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ |
| 131827 | 132182 | ); |
| 131828 | 132183 | #else |
| 131829 | | -# define sqlite3WhereExplainOneScan(u,v,w,x,y,z) 0 |
| 132184 | +# define sqlite3WhereExplainOneScan(u,v,w,x) 0 |
| 131830 | 132185 | #endif /* SQLITE_OMIT_EXPLAIN */ |
| 131831 | 132186 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 131832 | 132187 | SQLITE_PRIVATE void sqlite3WhereAddScanStatus( |
| 131833 | 132188 | Vdbe *v, /* Vdbe to add scanstatus entry to */ |
| 131834 | 132189 | SrcList *pSrclist, /* FROM clause pLvl reads data from */ |
| | @@ -131944,27 +132299,27 @@ |
| 131944 | 132299 | const char *zOp /* Name of the operator */ |
| 131945 | 132300 | ){ |
| 131946 | 132301 | int i; |
| 131947 | 132302 | |
| 131948 | 132303 | assert( nTerm>=1 ); |
| 131949 | | - if( bAnd ) sqlite3StrAccumAppend(pStr, " AND ", 5); |
| 131950 | | - |
| 131951 | | - if( nTerm>1 ) sqlite3StrAccumAppend(pStr, "(", 1); |
| 131952 | | - for(i=0; i<nTerm; i++){ |
| 131953 | | - if( i ) sqlite3StrAccumAppend(pStr, ",", 1); |
| 131954 | | - sqlite3StrAccumAppendAll(pStr, explainIndexColumnName(pIdx, iTerm+i)); |
| 131955 | | - } |
| 131956 | | - if( nTerm>1 ) sqlite3StrAccumAppend(pStr, ")", 1); |
| 131957 | | - |
| 131958 | | - sqlite3StrAccumAppend(pStr, zOp, 1); |
| 131959 | | - |
| 131960 | | - if( nTerm>1 ) sqlite3StrAccumAppend(pStr, "(", 1); |
| 131961 | | - for(i=0; i<nTerm; i++){ |
| 131962 | | - if( i ) sqlite3StrAccumAppend(pStr, ",", 1); |
| 131963 | | - sqlite3StrAccumAppend(pStr, "?", 1); |
| 131964 | | - } |
| 131965 | | - if( nTerm>1 ) sqlite3StrAccumAppend(pStr, ")", 1); |
| 132304 | + if( bAnd ) sqlite3_str_append(pStr, " AND ", 5); |
| 132305 | + |
| 132306 | + if( nTerm>1 ) sqlite3_str_append(pStr, "(", 1); |
| 132307 | + for(i=0; i<nTerm; i++){ |
| 132308 | + if( i ) sqlite3_str_append(pStr, ",", 1); |
| 132309 | + sqlite3_str_appendall(pStr, explainIndexColumnName(pIdx, iTerm+i)); |
| 132310 | + } |
| 132311 | + if( nTerm>1 ) sqlite3_str_append(pStr, ")", 1); |
| 132312 | + |
| 132313 | + sqlite3_str_append(pStr, zOp, 1); |
| 132314 | + |
| 132315 | + if( nTerm>1 ) sqlite3_str_append(pStr, "(", 1); |
| 132316 | + for(i=0; i<nTerm; i++){ |
| 132317 | + if( i ) sqlite3_str_append(pStr, ",", 1); |
| 132318 | + sqlite3_str_append(pStr, "?", 1); |
| 132319 | + } |
| 132320 | + if( nTerm>1 ) sqlite3_str_append(pStr, ")", 1); |
| 131966 | 132321 | } |
| 131967 | 132322 | |
| 131968 | 132323 | /* |
| 131969 | 132324 | ** Argument pLevel describes a strategy for scanning table pTab. This |
| 131970 | 132325 | ** function appends text to pStr that describes the subset of table |
| | @@ -131984,15 +132339,15 @@ |
| 131984 | 132339 | u16 nEq = pLoop->u.btree.nEq; |
| 131985 | 132340 | u16 nSkip = pLoop->nSkip; |
| 131986 | 132341 | int i, j; |
| 131987 | 132342 | |
| 131988 | 132343 | if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return; |
| 131989 | | - sqlite3StrAccumAppend(pStr, " (", 2); |
| 132344 | + sqlite3_str_append(pStr, " (", 2); |
| 131990 | 132345 | for(i=0; i<nEq; i++){ |
| 131991 | 132346 | const char *z = explainIndexColumnName(pIndex, i); |
| 131992 | | - if( i ) sqlite3StrAccumAppend(pStr, " AND ", 5); |
| 131993 | | - sqlite3XPrintf(pStr, i>=nSkip ? "%s=?" : "ANY(%s)", z); |
| 132347 | + if( i ) sqlite3_str_append(pStr, " AND ", 5); |
| 132348 | + sqlite3_str_appendf(pStr, i>=nSkip ? "%s=?" : "ANY(%s)", z); |
| 131994 | 132349 | } |
| 131995 | 132350 | |
| 131996 | 132351 | j = i; |
| 131997 | 132352 | if( pLoop->wsFlags&WHERE_BTM_LIMIT ){ |
| 131998 | 132353 | explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, ">"); |
| | @@ -131999,11 +132354,11 @@ |
| 131999 | 132354 | i = 1; |
| 132000 | 132355 | } |
| 132001 | 132356 | if( pLoop->wsFlags&WHERE_TOP_LIMIT ){ |
| 132002 | 132357 | explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<"); |
| 132003 | 132358 | } |
| 132004 | | - sqlite3StrAccumAppend(pStr, ")", 1); |
| 132359 | + sqlite3_str_append(pStr, ")", 1); |
| 132005 | 132360 | } |
| 132006 | 132361 | |
| 132007 | 132362 | /* |
| 132008 | 132363 | ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN |
| 132009 | 132364 | ** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was |
| | @@ -132015,12 +132370,10 @@ |
| 132015 | 132370 | */ |
| 132016 | 132371 | SQLITE_PRIVATE int sqlite3WhereExplainOneScan( |
| 132017 | 132372 | Parse *pParse, /* Parse context */ |
| 132018 | 132373 | SrcList *pTabList, /* Table list this loop refers to */ |
| 132019 | 132374 | WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ |
| 132020 | | - int iLevel, /* Value for "level" column of output */ |
| 132021 | | - int iFrom, /* Value for "from" column of output */ |
| 132022 | 132375 | u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ |
| 132023 | 132376 | ){ |
| 132024 | 132377 | int ret = 0; |
| 132025 | 132378 | #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS) |
| 132026 | 132379 | if( sqlite3ParseToplevel(pParse)->explain==2 ) |
| | @@ -132043,19 +132396,19 @@ |
| 132043 | 132396 | isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 |
| 132044 | 132397 | || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0)) |
| 132045 | 132398 | || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX)); |
| 132046 | 132399 | |
| 132047 | 132400 | sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH); |
| 132048 | | - sqlite3StrAccumAppendAll(&str, isSearch ? "SEARCH" : "SCAN"); |
| 132401 | + sqlite3_str_appendall(&str, isSearch ? "SEARCH" : "SCAN"); |
| 132049 | 132402 | if( pItem->pSelect ){ |
| 132050 | | - sqlite3XPrintf(&str, " SUBQUERY 0x%p", pItem->pSelect); |
| 132403 | + sqlite3_str_appendf(&str, " SUBQUERY 0x%p", pItem->pSelect); |
| 132051 | 132404 | }else{ |
| 132052 | | - sqlite3XPrintf(&str, " TABLE %s", pItem->zName); |
| 132405 | + sqlite3_str_appendf(&str, " TABLE %s", pItem->zName); |
| 132053 | 132406 | } |
| 132054 | 132407 | |
| 132055 | 132408 | if( pItem->zAlias ){ |
| 132056 | | - sqlite3XPrintf(&str, " AS %s", pItem->zAlias); |
| 132409 | + sqlite3_str_appendf(&str, " AS %s", pItem->zAlias); |
| 132057 | 132410 | } |
| 132058 | 132411 | if( (flags & (WHERE_IPK|WHERE_VIRTUALTABLE))==0 ){ |
| 132059 | 132412 | const char *zFmt = 0; |
| 132060 | 132413 | Index *pIdx; |
| 132061 | 132414 | |
| | @@ -132074,12 +132427,12 @@ |
| 132074 | 132427 | zFmt = "COVERING INDEX %s"; |
| 132075 | 132428 | }else{ |
| 132076 | 132429 | zFmt = "INDEX %s"; |
| 132077 | 132430 | } |
| 132078 | 132431 | if( zFmt ){ |
| 132079 | | - sqlite3StrAccumAppend(&str, " USING ", 7); |
| 132080 | | - sqlite3XPrintf(&str, zFmt, pIdx->zName); |
| 132432 | + sqlite3_str_append(&str, " USING ", 7); |
| 132433 | + sqlite3_str_appendf(&str, zFmt, pIdx->zName); |
| 132081 | 132434 | explainIndexRange(&str, pLoop); |
| 132082 | 132435 | } |
| 132083 | 132436 | }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){ |
| 132084 | 132437 | const char *zRangeOp; |
| 132085 | 132438 | if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){ |
| | @@ -132090,23 +132443,25 @@ |
| 132090 | 132443 | zRangeOp = ">"; |
| 132091 | 132444 | }else{ |
| 132092 | 132445 | assert( flags&WHERE_TOP_LIMIT); |
| 132093 | 132446 | zRangeOp = "<"; |
| 132094 | 132447 | } |
| 132095 | | - sqlite3XPrintf(&str, " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp); |
| 132448 | + sqlite3_str_appendf(&str, |
| 132449 | + " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp); |
| 132096 | 132450 | } |
| 132097 | 132451 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 132098 | 132452 | else if( (flags & WHERE_VIRTUALTABLE)!=0 ){ |
| 132099 | | - sqlite3XPrintf(&str, " VIRTUAL TABLE INDEX %d:%s", |
| 132453 | + sqlite3_str_appendf(&str, " VIRTUAL TABLE INDEX %d:%s", |
| 132100 | 132454 | pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr); |
| 132101 | 132455 | } |
| 132102 | 132456 | #endif |
| 132103 | 132457 | #ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS |
| 132104 | 132458 | if( pLoop->nOut>=10 ){ |
| 132105 | | - sqlite3XPrintf(&str, " (~%llu rows)", sqlite3LogEstToInt(pLoop->nOut)); |
| 132459 | + sqlite3_str_appendf(&str, " (~%llu rows)", |
| 132460 | + sqlite3LogEstToInt(pLoop->nOut)); |
| 132106 | 132461 | }else{ |
| 132107 | | - sqlite3StrAccumAppend(&str, " (~1 row)", 9); |
| 132462 | + sqlite3_str_append(&str, " (~1 row)", 9); |
| 132108 | 132463 | } |
| 132109 | 132464 | #endif |
| 132110 | 132465 | zMsg = sqlite3StrAccumFinish(&str); |
| 132111 | 132466 | ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v), |
| 132112 | 132467 | pParse->addrExplain, 0, zMsg,P4_DYNAMIC); |
| | @@ -133849,11 +134204,11 @@ |
| 133849 | 134204 | wctrlFlags, iCovCur); |
| 133850 | 134205 | assert( pSubWInfo || pParse->nErr || db->mallocFailed ); |
| 133851 | 134206 | if( pSubWInfo ){ |
| 133852 | 134207 | WhereLoop *pSubLoop; |
| 133853 | 134208 | int addrExplain = sqlite3WhereExplainOneScan( |
| 133854 | | - pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 |
| 134209 | + pParse, pOrTab, &pSubWInfo->a[0], 0 |
| 133855 | 134210 | ); |
| 133856 | 134211 | sqlite3WhereAddScanStatus(v, pOrTab, &pSubWInfo->a[0], addrExplain); |
| 133857 | 134212 | |
| 133858 | 134213 | /* This is the sub-WHERE clause body. First skip over |
| 133859 | 134214 | ** duplicate rows from prior sub-WHERE clauses, and record the |
| | @@ -140652,11 +141007,11 @@ |
| 140652 | 141007 | &pTabList->a[pLevel->iFrom], notReady, pLevel); |
| 140653 | 141008 | if( db->mallocFailed ) goto whereBeginError; |
| 140654 | 141009 | } |
| 140655 | 141010 | #endif |
| 140656 | 141011 | addrExplain = sqlite3WhereExplainOneScan( |
| 140657 | | - pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags |
| 141012 | + pParse, pTabList, pLevel, wctrlFlags |
| 140658 | 141013 | ); |
| 140659 | 141014 | pLevel->addrBody = sqlite3VdbeCurrentAddr(v); |
| 140660 | 141015 | notReady = sqlite3WhereCodeOneLoopStart(pWInfo, ii, notReady); |
| 140661 | 141016 | pWInfo->iContinue = pLevel->addrCont; |
| 140662 | 141017 | if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_OR_SUBCLAUSE)==0 ){ |
| | @@ -206901,11 +207256,11 @@ |
| 206901 | 207256 | int nArg, /* Number of args */ |
| 206902 | 207257 | sqlite3_value **apUnused /* Function arguments */ |
| 206903 | 207258 | ){ |
| 206904 | 207259 | assert( nArg==0 ); |
| 206905 | 207260 | UNUSED_PARAM2(nArg, apUnused); |
| 206906 | | - sqlite3_result_text(pCtx, "fts5: 2018-05-05 01:23:28 9191ff670cb7f36e0b2dac4a22888679b639845687aef8edcc3c05e35ba71eda", -1, SQLITE_TRANSIENT); |
| 207261 | + sqlite3_result_text(pCtx, "fts5: 2018-05-14 00:41:12 d0f35739af3b226c8eef39676407293650cde551acef06fe8628fdd5b59bd66a", -1, SQLITE_TRANSIENT); |
| 206907 | 207262 | } |
| 206908 | 207263 | |
| 206909 | 207264 | static int fts5Init(sqlite3 *db){ |
| 206910 | 207265 | static const sqlite3_module fts5Mod = { |
| 206911 | 207266 | /* iVersion */ 2, |
| | @@ -211171,12 +211526,12 @@ |
| 211171 | 211526 | } |
| 211172 | 211527 | #endif /* SQLITE_CORE */ |
| 211173 | 211528 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 211174 | 211529 | |
| 211175 | 211530 | /************** End of stmt.c ************************************************/ |
| 211176 | | -#if __LINE__!=211176 |
| 211531 | +#if __LINE__!=211531 |
| 211177 | 211532 | #undef SQLITE_SOURCE_ID |
| 211178 | | -#define SQLITE_SOURCE_ID "2018-05-05 01:23:28 9191ff670cb7f36e0b2dac4a22888679b639845687aef8edcc3c05e35ba7alt2" |
| 211533 | +#define SQLITE_SOURCE_ID "2018-05-14 00:41:12 d0f35739af3b226c8eef39676407293650cde551acef06fe8628fdd5b59balt2" |
| 211179 | 211534 | #endif |
| 211180 | 211535 | /* Return the source-id for this library */ |
| 211181 | 211536 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 211182 | 211537 | /************************** End of sqlite3.c ******************************/ |
| 211183 | 211538 | |