Fossil

Check-in [048a6f80]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update the built-in SQLite to the 3.25.0 release.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 048a6f80d33fd5a4aa9a218be233bf3f252cbaac4b351c30633dbda01d283d73
User & Date: drh 2018-09-15 12:39:37
Context
2018-09-15
12:42
Increase the version number to 2.7. check-in: 4559373c user: drh tags: trunk
12:39
Update the built-in SQLite to the 3.25.0 release. check-in: 048a6f80 user: drh tags: trunk
2018-09-14
21:23
Fix a typo. check-in: 4b562158 user: ashepilko tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqlite3.c.

  1154   1154   **
  1155   1155   ** See also: [sqlite3_libversion()],
  1156   1156   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
  1157   1157   ** [sqlite_version()] and [sqlite_source_id()].
  1158   1158   */
  1159   1159   #define SQLITE_VERSION        "3.25.0"
  1160   1160   #define SQLITE_VERSION_NUMBER 3025000
  1161         -#define SQLITE_SOURCE_ID      "2018-09-10 19:34:06 74c381b573817d0212153278b5ee5d2238a27a727dcf7ee769365c47bb9fc40d"
         1161  +#define SQLITE_SOURCE_ID      "2018-09-15 04:01:47 b63af6c3bd33152742648d5d2e8dc5d5fcbcdd27df409272b6aea00a6f761760"
  1162   1162   
  1163   1163   /*
  1164   1164   ** CAPI3REF: Run-Time Library Version Numbers
  1165   1165   ** KEYWORDS: sqlite3_version sqlite3_sourceid
  1166   1166   **
  1167   1167   ** These interfaces provide the same information as the [SQLITE_VERSION],
  1168   1168   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  2111   2111   **
  2112   2112   ** <li>[[SQLITE_FCNTL_DATA_VERSION]]
  2113   2113   ** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
  2114   2114   ** a database file.  The argument is a pointer to a 32-bit unsigned integer.
  2115   2115   ** The "data version" for the pager is written into the pointer.  The
  2116   2116   ** "data version" changes whenever any change occurs to the corresponding
  2117   2117   ** database file, either through SQL statements on the same database
  2118         -** connection, or through transactions committed by separate database
         2118  +** connection or through transactions committed by separate database
  2119   2119   ** connections possibly in other processes. The [sqlite3_total_changes()]
  2120   2120   ** interface can be used to find if any database on the connection has changed,
  2121         -** but that interface response to changes on TEMP as well as MAIN and does
         2121  +** but that interface responds to changes on TEMP as well as MAIN and does
  2122   2122   ** not provide a mechanism to detect changes to MAIN only.  Also, the
  2123         -** [sqlite3_total_changes()] interface response to internal changes only and
         2123  +** [sqlite3_total_changes()] interface responds to internal changes only and
  2124   2124   ** omits changes made by other database connections.  The
  2125   2125   ** [PRAGMA data_version] command provide a mechanism to detect changes to
  2126   2126   ** a single attached database that occur due to other database connections,
  2127         -** but omits changes implemented by the database connection for which it is
         2127  +** but omits changes implemented by the database connection on which it is
  2128   2128   ** called.  This file control is the only mechanism to detect changes that
  2129         -** happen either internally or externally on a single database.
         2129  +** happen either internally or externally and that are associated with
         2130  +** a particular attached database.
  2130   2131   ** </ul>
  2131   2132   */
  2132   2133   #define SQLITE_FCNTL_LOCKSTATE               1
  2133   2134   #define SQLITE_FCNTL_GET_LOCKPROXYFILE       2
  2134   2135   #define SQLITE_FCNTL_SET_LOCKPROXYFILE       3
  2135   2136   #define SQLITE_FCNTL_LAST_ERRNO              4
  2136   2137   #define SQLITE_FCNTL_SIZE_HINT               5
................................................................................
  5760   5761   ** parameters. ^An aggregate SQL function requires an implementation of xStep
  5761   5762   ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
  5762   5763   ** SQL function or aggregate, pass NULL pointers for all three function
  5763   5764   ** callbacks.
  5764   5765   **
  5765   5766   ** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue 
  5766   5767   ** and xInverse) passed to sqlite3_create_window_function are pointers to
  5767         -** C-lanugage callbacks that implement the new function. xStep and xFinal
         5768  +** C-language callbacks that implement the new function. xStep and xFinal
  5768   5769   ** must both be non-NULL. xValue and xInverse may either both be NULL, in
  5769   5770   ** which case a regular aggregate function is created, or must both be 
  5770   5771   ** non-NULL, in which case the new function may be used as either an aggregate
  5771   5772   ** or aggregate window function. More details regarding the implementation
  5772   5773   ** of aggregate window functions are 
  5773   5774   ** [user-defined window functions|available here].
  5774   5775   **
................................................................................
 10286  10287   ** The following are allowed values for 6th argument (the F argument) to
 10287  10288   ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
 10288  10289   **
 10289  10290   ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
 10290  10291   ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
 10291  10292   ** and that SQLite should take ownership of this memory and automatically
 10292  10293   ** free it when it has finished using it.  Without this flag, the caller
 10293         -** is resposible for freeing any dynamically allocated memory.
        10294  +** is responsible for freeing any dynamically allocated memory.
 10294  10295   **
 10295  10296   ** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
 10296  10297   ** grow the size of the database using calls to [sqlite3_realloc64()].  This
 10297  10298   ** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
 10298  10299   ** Without this flag, the deserialized database cannot increase in size beyond
 10299  10300   ** the number of bytes specified by the M parameter.
 10300  10301   **
................................................................................
 12464  12465   **            document such as "I won first place" is tokenized, entries are
 12465  12466   **            added to the FTS index for "i", "won", "first", "1st" and
 12466  12467   **            "place".
 12467  12468   **
 12468  12469   **            This way, even if the tokenizer does not provide synonyms
 12469  12470   **            when tokenizing query text (it should not - to do would be
 12470  12471   **            inefficient), it doesn't matter if the user queries for 
 12471         -**            'first + place' or '1st + place', as there are entires in the
        12472  +**            'first + place' or '1st + place', as there are entries in the
 12472  12473   **            FTS index corresponding to both forms of the first token.
 12473  12474   **   </ol>
 12474  12475   **
 12475  12476   **   Whether it is parsing document or query text, any call to xToken that
 12476  12477   **   specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit
 12477  12478   **   is considered to supply a synonym for the previous token. For example,
 12478  12479   **   when parsing the document "I won first place", a tokenizer that supports
................................................................................
 12492  12493   **   There is no limit to the number of synonyms that may be provided for a
 12493  12494   **   single token.
 12494  12495   **
 12495  12496   **   In many cases, method (1) above is the best approach. It does not add 
 12496  12497   **   extra data to the FTS index or require FTS5 to query for multiple terms,
 12497  12498   **   so it is efficient in terms of disk space and query speed. However, it
 12498  12499   **   does not support prefix queries very well. If, as suggested above, the
 12499         -**   token "first" is subsituted for "1st" by the tokenizer, then the query:
        12500  +**   token "first" is substituted for "1st" by the tokenizer, then the query:
 12500  12501   **
 12501  12502   **   <codeblock>
 12502  12503   **     ... MATCH '1s*'</codeblock>
 12503  12504   **
 12504  12505   **   will not match documents that contain the token "1st" (as the tokenizer
 12505  12506   **   will probably not map "1s" to any prefix of "first").
 12506  12507   **
................................................................................
 18970  18971   SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
 18971  18972   SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
 18972  18973   SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
 18973  18974   SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
 18974  18975   SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*);
 18975  18976   SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom);
 18976  18977   SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*);
        18978  +SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*);
 18977  18979   SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
 18978  18980   SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*);
 18979  18981   SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*);
 18980  18982   SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*);
 18981  18983   SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*);
 18982  18984   SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *);
 18983  18985   SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB);
................................................................................
 27604  27606             xtype = etSTRING;
 27605  27607           }else{
 27606  27608             bufpt = va_arg(ap,char*);
 27607  27609           }
 27608  27610           if( bufpt==0 ){
 27609  27611             bufpt = "";
 27610  27612           }else if( xtype==etDYNSTRING ){
 27611         -          if( pAccum->nChar==0 && pAccum->mxAlloc && width==0 && precision<0 ){
        27613  +          if( pAccum->nChar==0
        27614  +           && pAccum->mxAlloc
        27615  +           && width==0
        27616  +           && precision<0
        27617  +           && pAccum->accError==0
        27618  +          ){
 27612  27619               /* Special optimization for sqlite3_mprintf("%z..."):
 27613  27620               ** Extend an existing memory allocation rather than creating
 27614  27621               ** a new one. */
 27615  27622               assert( (pAccum->printfFlags&SQLITE_PRINTF_MALLOCED)==0 );
 27616  27623               pAccum->zText = bufpt;
 27617  27624               pAccum->nAlloc = sqlite3DbMallocSize(pAccum->db, bufpt);
 27618  27625               pAccum->nChar = 0x7fffffff & (int)strlen(bufpt);
................................................................................
 36966  36973   ** any load or store begun after the barrier.
 36967  36974   */
 36968  36975   static void unixShmBarrier(
 36969  36976     sqlite3_file *fd                /* Database file holding the shared memory */
 36970  36977   ){
 36971  36978     UNUSED_PARAMETER(fd);
 36972  36979     sqlite3MemoryBarrier();         /* compiler-defined memory barrier */
 36973         -  assert( unixFileMutexNotheld((unixFile*)fd) );
        36980  +  assert( fd->pMethods->xLock==nolockLock 
        36981  +       || unixFileMutexNotheld((unixFile*)fd) 
        36982  +  );
 36974  36983     unixEnterMutex();               /* Also mutex, for redundancy */
 36975  36984     unixLeaveMutex();
 36976  36985   }
 36977  36986   
 36978  36987   /*
 36979  36988   ** Close a connection to shared-memory.  Delete the underlying 
 36980  36989   ** storage if deleteFlag is true.
................................................................................
 46283  46292   **
 46284  46293   ** This file implements an in-memory VFS. A database is held as a contiguous
 46285  46294   ** block of memory.
 46286  46295   **
 46287  46296   ** This file also implements interface sqlite3_serialize() and
 46288  46297   ** sqlite3_deserialize().
 46289  46298   */
        46299  +/* #include "sqliteInt.h" */
 46290  46300   #ifdef SQLITE_ENABLE_DESERIALIZE
 46291         -/* #include "sqliteInt.h" */
 46292  46301   
 46293  46302   /*
 46294  46303   ** Forward declaration of objects used by this utility
 46295  46304   */
 46296  46305   typedef struct sqlite3_vfs MemVfs;
 46297  46306   typedef struct MemFile MemFile;
 46298  46307   
................................................................................
 60505  60514   ** it takes a snapshot of the state of the WAL and wal-index for the current
 60506  60515   ** instant in time.  The current thread will continue to use this snapshot.
 60507  60516   ** Other threads might append new content to the WAL and wal-index but
 60508  60517   ** that extra content is ignored by the current thread.
 60509  60518   **
 60510  60519   ** If the database contents have changes since the previous read
 60511  60520   ** transaction, then *pChanged is set to 1 before returning.  The
 60512         -** Pager layer will use this to know that is cache is stale and
        60521  +** Pager layer will use this to know that its cache is stale and
 60513  60522   ** needs to be flushed.
 60514  60523   */
 60515  60524   SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
 60516  60525     int rc;                         /* Return code */
 60517  60526     int cnt = 0;                    /* Number of TryBeginRead attempts */
 60518  60527   
 60519  60528   #ifdef SQLITE_ENABLE_SNAPSHOT
................................................................................
 78536  78545   
 78537  78546     /* If the VM did not run to completion or if it encountered an
 78538  78547     ** error, then it might not have been halted properly.  So halt
 78539  78548     ** it now.
 78540  78549     */
 78541  78550     sqlite3VdbeHalt(p);
 78542  78551   
 78543         -  /* If the VDBE has be run even partially, then transfer the error code
        78552  +  /* If the VDBE has been run even partially, then transfer the error code
 78544  78553     ** and error message from the VDBE into the main database structure.  But
 78545  78554     ** if the VDBE has just been set to run but has not actually executed any
 78546  78555     ** instructions yet, leave the main database error information unchanged.
 78547  78556     */
 78548  78557     if( p->pc>=0 ){
 78549  78558       vdbeInvokeSqllog(p);
 78550  78559       sqlite3VdbeTransferError(p);
................................................................................
101159 101168   /*
101160 101169   ** Generate code to verify that the schemas of database zDb and, if
101161 101170   ** bTemp is not true, database "temp", can still be parsed. This is
101162 101171   ** called at the end of the generation of an ALTER TABLE ... RENAME ...
101163 101172   ** statement to ensure that the operation has not rendered any schema
101164 101173   ** objects unusable.
101165 101174   */
101166         -void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){
       101175  +static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){
101167 101176     sqlite3NestedParse(pParse, 
101168 101177         "SELECT 1 "
101169 101178         "FROM \"%w\".%s "
101170 101179         "WHERE name NOT LIKE 'sqlite_%%'"
101171 101180         " AND sql NOT LIKE 'create virtual%%'"
101172 101181         " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ",
101173 101182         zDb, MASTER_NAME, 
................................................................................
101186 101195     }
101187 101196   }
101188 101197   
101189 101198   /*
101190 101199   ** Generate code to reload the schema for database iDb. And, if iDb!=1, for
101191 101200   ** the temp database as well.
101192 101201   */
101193         -void renameReloadSchema(Parse *pParse, int iDb){
       101202  +static void renameReloadSchema(Parse *pParse, int iDb){
101194 101203     Vdbe *v = pParse->pVdbe;
101195 101204     if( v ){
101196 101205       sqlite3ChangeCookie(pParse, iDb);
101197 101206       sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0);
101198 101207       if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0);
101199 101208     }
101200 101209   }
................................................................................
101766 101775   **
101767 101776   **     sqlite3_free(x);
101768 101777   **     if( x==y ) ...
101769 101778   **
101770 101779   ** Technically, as x no longer points into a valid object or to the byte
101771 101780   ** following a valid object, it may not be used in comparison operations.
101772 101781   */
101773         -void renameTokenCheckAll(Parse *pParse, void *pPtr){
       101782  +static void renameTokenCheckAll(Parse *pParse, void *pPtr){
101774 101783     if( pParse->nErr==0 && pParse->db->mallocFailed==0 ){
101775 101784       RenameToken *p;
101776 101785       u8 i = 0;
101777 101786       for(p=pParse->pRename; p; p=p->pNext){
101778 101787         if( p->p ){
101779 101788           assert( p->p!=pPtr );
101780 101789           i += *(u8*)(p->p);
................................................................................
101838 101847   SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){
101839 101848     Walker sWalker;
101840 101849     memset(&sWalker, 0, sizeof(Walker));
101841 101850     sWalker.pParse = pParse;
101842 101851     sWalker.xExprCallback = renameUnmapExprCb;
101843 101852     sqlite3WalkExpr(&sWalker, pExpr);
101844 101853   }
       101854  +
       101855  +/*
       101856  +** Remove all nodes that are part of expression-list pEList from the 
       101857  +** rename list.
       101858  +*/
       101859  +SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse *pParse, ExprList *pEList){
       101860  +  if( pEList ){
       101861  +    int i;
       101862  +    Walker sWalker;
       101863  +    memset(&sWalker, 0, sizeof(Walker));
       101864  +    sWalker.pParse = pParse;
       101865  +    sWalker.xExprCallback = renameUnmapExprCb;
       101866  +    sqlite3WalkExprList(&sWalker, pEList);
       101867  +    for(i=0; i<pEList->nExpr; i++){
       101868  +      sqlite3RenameTokenRemap(pParse, 0, (void*)pEList->a[i].zName);
       101869  +    }
       101870  +  }
       101871  +}
101845 101872   
101846 101873   /*
101847 101874   ** Free the list of RenameToken objects given in the second argument
101848 101875   */
101849 101876   static void renameTokenFree(sqlite3 *db, RenameToken *pToken){
101850 101877     RenameToken *pNext;
101851 101878     RenameToken *p;
................................................................................
107744 107771     sEnd.n = 1;
107745 107772   
107746 107773     /* Use sqlite3EndTable() to add the view to the SQLITE_MASTER table */
107747 107774     sqlite3EndTable(pParse, 0, &sEnd, 0, 0);
107748 107775   
107749 107776   create_view_fail:
107750 107777     sqlite3SelectDelete(db, pSelect);
       107778  +  if( IN_RENAME_OBJECT ){
       107779  +    sqlite3RenameExprlistUnmap(pParse, pCNames);
       107780  +  }
107751 107781     sqlite3ExprListDelete(db, pCNames);
107752 107782     return;
107753 107783   }
107754 107784   #endif /* SQLITE_OMIT_VIEW */
107755 107785   
107756 107786   #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
107757 107787   /*
................................................................................
135327 135357   ** an access of the index rather than the original table.
135328 135358   */
135329 135359   static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
135330 135360     int rc = WRC_Continue;
135331 135361     struct CCurHint *pHint = pWalker->u.pCCurHint;
135332 135362     if( pExpr->op==TK_COLUMN ){
135333 135363       if( pExpr->iTable!=pHint->iTabCur ){
135334         -      Vdbe *v = pWalker->pParse->pVdbe;
135335 135364         int reg = ++pWalker->pParse->nMem;   /* Register for column value */
135336         -      sqlite3ExprCodeGetColumnOfTable(
135337         -          v, pExpr->pTab, pExpr->iTable, pExpr->iColumn, reg
135338         -      );
       135365  +      sqlite3ExprCode(pWalker->pParse, pExpr, reg);
135339 135366         pExpr->op = TK_REGISTER;
135340 135367         pExpr->iTable = reg;
135341 135368       }else if( pHint->pIdx!=0 ){
135342 135369         pExpr->iTable = pHint->iIdxCur;
135343 135370         pExpr->iColumn = sqlite3ColumnOfIndex(pHint->pIdx, pExpr->iColumn);
135344 135371         assert( pExpr->iColumn>=0 );
135345 135372       }
................................................................................
177351 177378     if( pStr ){
177352 177379       pStr->pCtx = ctx;
177353 177380       jsonAppendChar(pStr, ']');
177354 177381       if( pStr->bErr ){
177355 177382         if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
177356 177383         assert( pStr->bStatic );
177357 177384       }else if( isFinal ){
177358         -      sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
       177385  +      sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed,
177359 177386                             pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
177360 177387         pStr->bStatic = 1;
177361 177388       }else{
177362         -      sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed, SQLITE_TRANSIENT);
       177389  +      sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT);
177363 177390         pStr->nUsed--;
177364 177391       }
177365 177392     }else{
177366 177393       sqlite3_result_text(ctx, "[]", 2, SQLITE_STATIC);
177367 177394     }
177368 177395     sqlite3_result_subtype(ctx, JSON_SUBTYPE);
177369 177396   }
................................................................................
177404 177431       if( z[i]=='"' ){
177405 177432         inStr = !inStr;
177406 177433       }else if( z[i]=='\\' ){
177407 177434         i++;
177408 177435       }
177409 177436     }
177410 177437     pStr->nUsed -= i;      
177411         -  memmove(&z[1], &z[i+1], pStr->nUsed-1);
       177438  +  memmove(&z[1], &z[i+1], (size_t)pStr->nUsed-1);
177412 177439   }
177413 177440   #else
177414 177441   # define jsonGroupInverse 0
177415 177442   #endif
177416 177443   
177417 177444   
177418 177445   /*
................................................................................
177450 177477     pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
177451 177478     if( pStr ){
177452 177479       jsonAppendChar(pStr, '}');
177453 177480       if( pStr->bErr ){
177454 177481         if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
177455 177482         assert( pStr->bStatic );
177456 177483       }else if( isFinal ){
177457         -      sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
       177484  +      sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed,
177458 177485                             pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
177459 177486         pStr->bStatic = 1;
177460 177487       }else{
177461         -      sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed, SQLITE_TRANSIENT);
       177488  +      sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT);
177462 177489         pStr->nUsed--;
177463 177490       }
177464 177491     }else{
177465 177492       sqlite3_result_text(ctx, "{}", 2, SQLITE_STATIC);
177466 177493     }
177467 177494     sqlite3_result_subtype(ctx, JSON_SUBTYPE);
177468 177495   }
................................................................................
181308 181335   **   BEGIN;
181309 181336   **     INSERT INTO rtree...
181310 181337   **     DROP TABLE <tablename>;    -- Would fail with SQLITE_LOCKED
181311 181338   **   COMMIT;
181312 181339   */
181313 181340   static int rtreeSavepoint(sqlite3_vtab *pVtab, int iSavepoint){
181314 181341     Rtree *pRtree = (Rtree *)pVtab;
181315         -  int iwt = pRtree->inWrTrans;
       181342  +  u8 iwt = pRtree->inWrTrans;
181316 181343     UNUSED_PARAMETER(iSavepoint);
181317 181344     pRtree->inWrTrans = 0;
181318 181345     nodeBlobReset(pRtree);
181319 181346     pRtree->inWrTrans = iwt;
181320 181347     return SQLITE_OK;
181321 181348   }
181322 181349   
................................................................................
182448 182475         }
182449 182476         if( c<'0' || c>'9' ) return 0;
182450 182477         continue;
182451 182478       }
182452 182479       break;
182453 182480     }
182454 182481     if( z[j-1]<'0' ) return 0;
182455         -  if( pVal ) *pVal = atof((const char*)p->z);
       182482  +  if( pVal ) *pVal = (GeoCoord)atof((const char*)p->z);
182456 182483     p->z += j;
182457 182484     return 1;
182458 182485   }
182459 182486   
182460 182487   /*
182461 182488   ** If the input is a well-formed JSON array of coordinates with at least
182462 182489   ** four coordinates and where each coordinate is itself a two-value array,
................................................................................
182703 182730     double F = sqlite3_value_double(argv[6]);
182704 182731     GeoCoord x1, y1, x0, y0;
182705 182732     int ii;
182706 182733     if( p ){
182707 182734       for(ii=0; ii<p->nVertex; ii++){
182708 182735         x0 = p->a[ii*2];
182709 182736         y0 = p->a[ii*2+1];
182710         -      x1 = A*x0 + B*y0 + E;
182711         -      y1 = C*x0 + D*y0 + F;
       182737  +      x1 = (GeoCoord)(A*x0 + B*y0 + E);
       182738  +      y1 = (GeoCoord)(C*x0 + D*y0 + F);
182712 182739         p->a[ii*2] = x1;
182713 182740         p->a[ii*2+1] = y1;
182714 182741       }
182715 182742       sqlite3_result_blob(context, p->hdr, 
182716 182743          4+8*p->nVertex, SQLITE_TRANSIENT);
182717 182744       sqlite3_free(p);
182718 182745     }
................................................................................
182779 182806     }
182780 182807     if( p ){
182781 182808       int ii;
182782 182809       mnX = mxX = p->a[0];
182783 182810       mnY = mxY = p->a[1];
182784 182811       for(ii=1; ii<p->nVertex; ii++){
182785 182812         double r = p->a[ii*2];
182786         -      if( r<mnX ) mnX = r;
182787         -      else if( r>mxX ) mxX = r;
       182813  +      if( r<mnX ) mnX = (float)r;
       182814  +      else if( r>mxX ) mxX = (float)r;
182788 182815         r = p->a[ii*2+1];
182789         -      if( r<mnY ) mnY = r;
182790         -      else if( r>mxY ) mxY = r;
       182816  +      if( r<mnY ) mnY = (float)r;
       182817  +      else if( r>mxY ) mxY = (float)r;
182791 182818       }
182792 182819       if( pRc ) *pRc = SQLITE_OK;
182793 182820       if( aCoord==0 ){
182794 182821         geopolyBboxFill:
182795 182822         pOut = sqlite3_realloc(p, sizeof(GeoPoly)+sizeof(GeoCoord)*6);
182796 182823         if( pOut==0 ){
182797 182824           sqlite3_free(p);
................................................................................
197383 197410   **            document such as "I won first place" is tokenized, entries are
197384 197411   **            added to the FTS index for "i", "won", "first", "1st" and
197385 197412   **            "place".
197386 197413   **
197387 197414   **            This way, even if the tokenizer does not provide synonyms
197388 197415   **            when tokenizing query text (it should not - to do would be
197389 197416   **            inefficient), it doesn't matter if the user queries for 
197390         -**            'first + place' or '1st + place', as there are entires in the
       197417  +**            'first + place' or '1st + place', as there are entries in the
197391 197418   **            FTS index corresponding to both forms of the first token.
197392 197419   **   </ol>
197393 197420   **
197394 197421   **   Whether it is parsing document or query text, any call to xToken that
197395 197422   **   specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit
197396 197423   **   is considered to supply a synonym for the previous token. For example,
197397 197424   **   when parsing the document "I won first place", a tokenizer that supports
................................................................................
197411 197438   **   There is no limit to the number of synonyms that may be provided for a
197412 197439   **   single token.
197413 197440   **
197414 197441   **   In many cases, method (1) above is the best approach. It does not add 
197415 197442   **   extra data to the FTS index or require FTS5 to query for multiple terms,
197416 197443   **   so it is efficient in terms of disk space and query speed. However, it
197417 197444   **   does not support prefix queries very well. If, as suggested above, the
197418         -**   token "first" is subsituted for "1st" by the tokenizer, then the query:
       197445  +**   token "first" is substituted for "1st" by the tokenizer, then the query:
197419 197446   **
197420 197447   **   <codeblock>
197421 197448   **     ... MATCH '1s*'</codeblock>
197422 197449   **
197423 197450   **   will not match documents that contain the token "1st" (as the tokenizer
197424 197451   **   will probably not map "1s" to any prefix of "first").
197425 197452   **
................................................................................
214385 214412   static void fts5SourceIdFunc(
214386 214413     sqlite3_context *pCtx,          /* Function call context */
214387 214414     int nArg,                       /* Number of args */
214388 214415     sqlite3_value **apUnused        /* Function arguments */
214389 214416   ){
214390 214417     assert( nArg==0 );
214391 214418     UNUSED_PARAM2(nArg, apUnused);
214392         -  sqlite3_result_text(pCtx, "fts5: 2018-09-10 16:38:25 564fa75195c5179d0bc86431aaff06136fc65ec63aa9839cd1114b1fbfac928b", -1, SQLITE_TRANSIENT);
       214419  +  sqlite3_result_text(pCtx, "fts5: 2018-09-15 04:01:47 b63af6c3bd33152742648d5d2e8dc5d5fcbcdd27df409272b6aea00a6f761760", -1, SQLITE_TRANSIENT);
214393 214420   }
214394 214421   
214395 214422   static int fts5Init(sqlite3 *db){
214396 214423     static const sqlite3_module fts5Mod = {
214397 214424       /* iVersion      */ 2,
214398 214425       /* xCreate       */ fts5CreateMethod,
214399 214426       /* xConnect      */ fts5ConnectMethod,
................................................................................
219095 219122   #endif
219096 219123     return rc;
219097 219124   }
219098 219125   #endif /* SQLITE_CORE */
219099 219126   #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
219100 219127   
219101 219128   /************** End of stmt.c ************************************************/
219102         -#if __LINE__!=219102
       219129  +#if __LINE__!=219129
219103 219130   #undef SQLITE_SOURCE_ID
219104         -#define SQLITE_SOURCE_ID      "2018-09-10 19:34:06 74c381b573817d0212153278b5ee5d2238a27a727dcf7ee769365c47bb9falt2"
       219131  +#define SQLITE_SOURCE_ID      "2018-09-15 04:01:47 b63af6c3bd33152742648d5d2e8dc5d5fcbcdd27df409272b6aea00a6f76alt2"
219105 219132   #endif
219106 219133   /* Return the source-id for this library */
219107 219134   SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
219108 219135   /************************** End of sqlite3.c ******************************/

Changes to src/sqlite3.h.

   121    121   **
   122    122   ** See also: [sqlite3_libversion()],
   123    123   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
   124    124   ** [sqlite_version()] and [sqlite_source_id()].
   125    125   */
   126    126   #define SQLITE_VERSION        "3.25.0"
   127    127   #define SQLITE_VERSION_NUMBER 3025000
   128         -#define SQLITE_SOURCE_ID      "2018-09-10 19:34:06 74c381b573817d0212153278b5ee5d2238a27a727dcf7ee769365c47bb9fc40d"
          128  +#define SQLITE_SOURCE_ID      "2018-09-15 04:01:47 b63af6c3bd33152742648d5d2e8dc5d5fcbcdd27df409272b6aea00a6f761760"
   129    129   
   130    130   /*
   131    131   ** CAPI3REF: Run-Time Library Version Numbers
   132    132   ** KEYWORDS: sqlite3_version sqlite3_sourceid
   133    133   **
   134    134   ** These interfaces provide the same information as the [SQLITE_VERSION],
   135    135   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  1078   1078   **
  1079   1079   ** <li>[[SQLITE_FCNTL_DATA_VERSION]]
  1080   1080   ** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
  1081   1081   ** a database file.  The argument is a pointer to a 32-bit unsigned integer.
  1082   1082   ** The "data version" for the pager is written into the pointer.  The
  1083   1083   ** "data version" changes whenever any change occurs to the corresponding
  1084   1084   ** database file, either through SQL statements on the same database
  1085         -** connection, or through transactions committed by separate database
         1085  +** connection or through transactions committed by separate database
  1086   1086   ** connections possibly in other processes. The [sqlite3_total_changes()]
  1087   1087   ** interface can be used to find if any database on the connection has changed,
  1088         -** but that interface response to changes on TEMP as well as MAIN and does
         1088  +** but that interface responds to changes on TEMP as well as MAIN and does
  1089   1089   ** not provide a mechanism to detect changes to MAIN only.  Also, the
  1090         -** [sqlite3_total_changes()] interface response to internal changes only and
         1090  +** [sqlite3_total_changes()] interface responds to internal changes only and
  1091   1091   ** omits changes made by other database connections.  The
  1092   1092   ** [PRAGMA data_version] command provide a mechanism to detect changes to
  1093   1093   ** a single attached database that occur due to other database connections,
  1094         -** but omits changes implemented by the database connection for which it is
         1094  +** but omits changes implemented by the database connection on which it is
  1095   1095   ** called.  This file control is the only mechanism to detect changes that
  1096         -** happen either internally or externally on a single database.
         1096  +** happen either internally or externally and that are associated with
         1097  +** a particular attached database.
  1097   1098   ** </ul>
  1098   1099   */
  1099   1100   #define SQLITE_FCNTL_LOCKSTATE               1
  1100   1101   #define SQLITE_FCNTL_GET_LOCKPROXYFILE       2
  1101   1102   #define SQLITE_FCNTL_SET_LOCKPROXYFILE       3
  1102   1103   #define SQLITE_FCNTL_LAST_ERRNO              4
  1103   1104   #define SQLITE_FCNTL_SIZE_HINT               5
................................................................................
  4727   4728   ** parameters. ^An aggregate SQL function requires an implementation of xStep
  4728   4729   ** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
  4729   4730   ** SQL function or aggregate, pass NULL pointers for all three function
  4730   4731   ** callbacks.
  4731   4732   **
  4732   4733   ** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue 
  4733   4734   ** and xInverse) passed to sqlite3_create_window_function are pointers to
  4734         -** C-lanugage callbacks that implement the new function. xStep and xFinal
         4735  +** C-language callbacks that implement the new function. xStep and xFinal
  4735   4736   ** must both be non-NULL. xValue and xInverse may either both be NULL, in
  4736   4737   ** which case a regular aggregate function is created, or must both be 
  4737   4738   ** non-NULL, in which case the new function may be used as either an aggregate
  4738   4739   ** or aggregate window function. More details regarding the implementation
  4739   4740   ** of aggregate window functions are 
  4740   4741   ** [user-defined window functions|available here].
  4741   4742   **
................................................................................
  9253   9254   ** The following are allowed values for 6th argument (the F argument) to
  9254   9255   ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
  9255   9256   **
  9256   9257   ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
  9257   9258   ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
  9258   9259   ** and that SQLite should take ownership of this memory and automatically
  9259   9260   ** free it when it has finished using it.  Without this flag, the caller
  9260         -** is resposible for freeing any dynamically allocated memory.
         9261  +** is responsible for freeing any dynamically allocated memory.
  9261   9262   **
  9262   9263   ** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
  9263   9264   ** grow the size of the database using calls to [sqlite3_realloc64()].  This
  9264   9265   ** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
  9265   9266   ** Without this flag, the deserialized database cannot increase in size beyond
  9266   9267   ** the number of bytes specified by the M parameter.
  9267   9268   **
................................................................................
 11431  11432   **            document such as "I won first place" is tokenized, entries are
 11432  11433   **            added to the FTS index for "i", "won", "first", "1st" and
 11433  11434   **            "place".
 11434  11435   **
 11435  11436   **            This way, even if the tokenizer does not provide synonyms
 11436  11437   **            when tokenizing query text (it should not - to do would be
 11437  11438   **            inefficient), it doesn't matter if the user queries for 
 11438         -**            'first + place' or '1st + place', as there are entires in the
        11439  +**            'first + place' or '1st + place', as there are entries in the
 11439  11440   **            FTS index corresponding to both forms of the first token.
 11440  11441   **   </ol>
 11441  11442   **
 11442  11443   **   Whether it is parsing document or query text, any call to xToken that
 11443  11444   **   specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit
 11444  11445   **   is considered to supply a synonym for the previous token. For example,
 11445  11446   **   when parsing the document "I won first place", a tokenizer that supports
................................................................................
 11459  11460   **   There is no limit to the number of synonyms that may be provided for a
 11460  11461   **   single token.
 11461  11462   **
 11462  11463   **   In many cases, method (1) above is the best approach. It does not add 
 11463  11464   **   extra data to the FTS index or require FTS5 to query for multiple terms,
 11464  11465   **   so it is efficient in terms of disk space and query speed. However, it
 11465  11466   **   does not support prefix queries very well. If, as suggested above, the
 11466         -**   token "first" is subsituted for "1st" by the tokenizer, then the query:
        11467  +**   token "first" is substituted for "1st" by the tokenizer, then the query:
 11467  11468   **
 11468  11469   **   <codeblock>
 11469  11470   **     ... MATCH '1s*'</codeblock>
 11470  11471   **
 11471  11472   **   will not match documents that contain the token "1st" (as the tokenizer
 11472  11473   **   will probably not map "1s" to any prefix of "first").
 11473  11474   **