/ Check-in [53ea550c]
Login

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

Overview
Comment:Merge latest trunk changes into this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | window-functions
Files: files | file ages | folders
SHA3-256: 53ea550ce759ae4683bcf0ae3af655bfe04f85db70f74edee6bcab56d83bb041
User & Date: dan 2019-03-09 07:38:16
Wiki:window-functions
Context
2019-03-09
20:49
Add support for RANGE window frames. Some cases still do not work. check-in: ffc32b24 user: dan tags: window-functions
07:38
Merge latest trunk changes into this branch. check-in: 53ea550c user: dan tags: window-functions
2019-03-08
20:57
Add simple tests for GROUPS window frames. check-in: 2872702d user: dan tags: window-functions
20:26
Fix a harmless bug in the Makefile. check-in: 62ac9cb0 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

  1145   1145   
  1146   1146   fts3_write.lo:	$(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR)
  1147   1147   	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_write.c
  1148   1148   
  1149   1149   rtree.lo:	$(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
  1150   1150   	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
  1151   1151   
  1152         -sqlite3session.lo:	$(TOP)/ext/userauth/userauth.c $(HDR) $(EXTHDR)
         1152  +userauth.lo:	$(TOP)/ext/userauth/userauth.c $(HDR) $(EXTHDR)
  1153   1153   	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/userauth/userauth.c
  1154   1154   
  1155         -userauth.lo:	$(TOP)/ext/session/sqlite3session.c $(HDR) $(EXTHDR)
         1155  +sqlite3session.lo:	$(TOP)/ext/session/sqlite3session.c $(HDR) $(EXTHDR)
  1156   1156   	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/session/sqlite3session.c
  1157   1157   
  1158   1158   json1.lo:	$(TOP)/ext/misc/json1.c
  1159   1159   	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/json1.c
  1160   1160   
  1161   1161   stmt.lo:	$(TOP)/ext/misc/stmt.c
  1162   1162   	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/stmt.c

Changes to ext/fts3/fts3.c.

  1869   1869       if( !isFirstTerm ){
  1870   1870         zCsr += fts3GetVarint32(zCsr, &nPrefix);
  1871   1871       }
  1872   1872       isFirstTerm = 0;
  1873   1873       zCsr += fts3GetVarint32(zCsr, &nSuffix);
  1874   1874       
  1875   1875       assert( nPrefix>=0 && nSuffix>=0 );
  1876         -    if( nPrefix>zCsr-zNode || nSuffix>zEnd-zCsr ){
         1876  +    if( nPrefix>zCsr-zNode || nSuffix>zEnd-zCsr || nSuffix==0 ){
  1877   1877         rc = FTS_CORRUPT_VTAB;
  1878   1878         goto finish_scan;
  1879   1879       }
  1880   1880       if( (i64)nPrefix+nSuffix>nAlloc ){
  1881   1881         char *zNew;
  1882   1882         nAlloc = ((i64)nPrefix+nSuffix) * 2;
  1883   1883         zNew = (char *)sqlite3_realloc64(zBuffer, nAlloc);

Changes to src/btree.c.

  5548   5548             pCur->ix = (u16)idx;
  5549   5549             rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0);
  5550   5550             pCur->curFlags &= ~BTCF_ValidOvfl;
  5551   5551             if( rc ){
  5552   5552               sqlite3_free(pCellKey);
  5553   5553               goto moveto_finish;
  5554   5554             }
  5555         -          c = xRecordCompare(nCell, pCellKey, pIdxKey);
         5555  +          c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey);
  5556   5556             sqlite3_free(pCellKey);
  5557   5557           }
  5558   5558           assert( 
  5559   5559               (pIdxKey->errCode!=SQLITE_CORRUPT || c==0)
  5560   5560            && (pIdxKey->errCode!=SQLITE_NOMEM || pCur->pBtree->db->mallocFailed)
  5561   5561           );
  5562   5562           if( c<0 ){
................................................................................
  7148   7148     }
  7149   7149   
  7150   7150     /* Add any overflow cells */
  7151   7151     for(i=0; i<pPg->nOverflow; i++){
  7152   7152       int iCell = (iOld + pPg->aiOvfl[i]) - iNew;
  7153   7153       if( iCell>=0 && iCell<nNew ){
  7154   7154         pCellptr = &pPg->aCellIdx[iCell * 2];
  7155         -      assert( nCell>=iCell );
  7156         -      memmove(&pCellptr[2], pCellptr, (nCell - iCell) * 2);
         7155  +      if( nCell>iCell ){
         7156  +        memmove(&pCellptr[2], pCellptr, (nCell - iCell) * 2);
         7157  +      }
  7157   7158         nCell++;
  7158   7159         if( pageInsertArray(
  7159   7160               pPg, pBegin, &pData, pCellptr,
  7160   7161               iCell+iNew, 1, pCArray
  7161   7162         ) ) goto editpage_fail;
  7162   7163       }
  7163   7164     }
................................................................................
  9264   9265     int rc;
  9265   9266     MemPage *pPage = 0;
  9266   9267     BtShared *pBt = p->pBt;
  9267   9268   
  9268   9269     assert( sqlite3BtreeHoldsMutex(p) );
  9269   9270     assert( p->inTrans==TRANS_WRITE );
  9270   9271     assert( iTable>=2 );
         9272  +  if( iTable>btreePagecount(pBt) ){
         9273  +    return SQLITE_CORRUPT_BKPT;
         9274  +  }
  9271   9275   
  9272   9276     rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0);
  9273   9277     if( rc ) return rc;
  9274   9278     rc = sqlite3BtreeClearTable(p, iTable, 0);
  9275   9279     if( rc ){
  9276   9280       releasePage(pPage);
  9277   9281       return rc;

Changes to src/pager.c.

  7173   7173     /* If the cache contains a page with page-number pgno, remove it
  7174   7174     ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for 
  7175   7175     ** page pgno before the 'move' operation, it needs to be retained 
  7176   7176     ** for the page moved there.
  7177   7177     */
  7178   7178     pPg->flags &= ~PGHDR_NEED_SYNC;
  7179   7179     pPgOld = sqlite3PagerLookup(pPager, pgno);
  7180         -  assert( !pPgOld || pPgOld->nRef==1 );
         7180  +  assert( !pPgOld || pPgOld->nRef==1 || CORRUPT_DB );
  7181   7181     if( pPgOld ){
         7182  +    if( pPgOld->nRef>1 ){
         7183  +      sqlite3PagerUnrefNotNull(pPgOld);
         7184  +      return SQLITE_CORRUPT_BKPT;
         7185  +    }
  7182   7186       pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC);
  7183   7187       if( pPager->tempFile ){
  7184   7188         /* Do not discard pages from an in-memory database since we might
  7185   7189         ** need to rollback later.  Just move the page out of the way. */
  7186   7190         sqlite3PcacheMove(pPgOld, pPager->dbSize+1);
  7187   7191       }else{
  7188   7192         sqlite3PcacheDrop(pPgOld);

Changes to src/shell.c.in.

  3054   3054   
  3055   3055         /* echo the sql statement if echo on */
  3056   3056         if( pArg && ShellHasFlag(pArg, SHFLG_Echo) ){
  3057   3057           utf8_printf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
  3058   3058         }
  3059   3059   
  3060   3060         /* Show the EXPLAIN QUERY PLAN if .eqp is on */
  3061         -      if( pArg && pArg->autoEQP && sqlite3_strlike("EXPLAIN%",zStmtSql,0)!=0 ){
         3061  +      if( pArg && pArg->autoEQP && sqlite3_stmt_isexplain(pStmt)==0 ){
  3062   3062           sqlite3_stmt *pExplain;
  3063   3063           char *zEQP;
  3064   3064           int triggerEQP = 0;
  3065   3065           disable_debug_trace_modes();
  3066   3066           sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, -1, &triggerEQP);
  3067   3067           if( pArg->autoEQP>=AUTOEQP_trigger ){
  3068   3068             sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0);
................................................................................
  3103   3103           }
  3104   3104           restore_debug_trace_modes();
  3105   3105         }
  3106   3106   
  3107   3107         if( pArg ){
  3108   3108           pArg->cMode = pArg->mode;
  3109   3109           if( pArg->autoExplain ){
  3110         -          if( sqlite3_column_count(pStmt)==8
  3111         -           && sqlite3_strlike("EXPLAIN%", zStmtSql,0)==0
  3112         -          ){
         3110  +          if( sqlite3_stmt_isexplain(pStmt)==1 ){
  3113   3111               pArg->cMode = MODE_Explain;
  3114   3112             }
  3115         -          if( sqlite3_column_count(pStmt)==4
  3116         -           && sqlite3_strlike("EXPLAIN QUERY PLAN%", zStmtSql,0)==0 ){
         3113  +          if( sqlite3_stmt_isexplain(pStmt)==2 ){
  3117   3114               pArg->cMode = MODE_EQP;
  3118   3115             }
  3119   3116           }
  3120   3117   
  3121   3118           /* If the shell is currently in ".explain" mode, gather the extra
  3122   3119           ** data required to add indents to the output.*/
  3123   3120           if( pArg->cMode==MODE_Explain ){

Changes to src/sqlite.h.in.

  3890   3890   ** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since
  3891   3891   ** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and
  3892   3892   ** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so
  3893   3893   ** sqlite3_stmt_readonly() returns false for those commands.
  3894   3894   */
  3895   3895   int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
  3896   3896   
         3897  +/*
         3898  +** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement
         3899  +** METHOD: sqlite3_stmt
         3900  +**
         3901  +** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the
         3902  +** prepared statement S is an EXPLAIN statement, or 2 if the
         3903  +** statement S is an EXPLAIN QUERY PLAN.
         3904  +** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is
         3905  +** an ordinary statement or a NULL pointer.
         3906  +*/
         3907  +int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
         3908  +
  3897   3909   /*
  3898   3910   ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
  3899   3911   ** METHOD: sqlite3_stmt
  3900   3912   **
  3901   3913   ** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
  3902   3914   ** [prepared statement] S has been stepped at least once using 
  3903   3915   ** [sqlite3_step(S)] but has neither run to completion (returned

Changes to src/test1.c.

  2669   2669     }
  2670   2670   
  2671   2671     if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
  2672   2672     rc = sqlite3_stmt_readonly(pStmt);
  2673   2673     Tcl_SetObjResult(interp, Tcl_NewBooleanObj(rc));
  2674   2674     return TCL_OK;
  2675   2675   }
         2676  +
         2677  +/*
         2678  +** Usage:  sqlite3_stmt_isexplain  STMT
         2679  +**
         2680  +** Return 1, 2, or 0 respectively if STMT is an EXPLAIN statement, an
         2681  +** EXPLAIN QUERY PLAN statement or an ordinary statement or NULL pointer.
         2682  +*/
         2683  +static int SQLITE_TCLAPI test_stmt_isexplain(
         2684  +  void * clientData,
         2685  +  Tcl_Interp *interp,
         2686  +  int objc,
         2687  +  Tcl_Obj *CONST objv[]
         2688  +){
         2689  +  sqlite3_stmt *pStmt;
         2690  +  int rc;
         2691  +
         2692  +  if( objc!=2 ){
         2693  +    Tcl_AppendResult(interp, "wrong # args: should be \"",
         2694  +        Tcl_GetStringFromObj(objv[0], 0), " STMT", 0);
         2695  +    return TCL_ERROR;
         2696  +  }
         2697  +
         2698  +  if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
         2699  +  rc = sqlite3_stmt_isexplain(pStmt);
         2700  +  Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
         2701  +  return TCL_OK;
         2702  +}
  2676   2703   
  2677   2704   /*
  2678   2705   ** Usage:  sqlite3_stmt_busy  STMT
  2679   2706   **
  2680   2707   ** Return true if STMT is a non-NULL pointer to a statement
  2681   2708   ** that has been stepped but not to completion.
  2682   2709   */
................................................................................
  7836   7863        { "sqlite3_sql",                   test_sql           ,0 },
  7837   7864        { "sqlite3_expanded_sql",          test_ex_sql        ,0 },
  7838   7865   #ifdef SQLITE_ENABLE_NORMALIZE
  7839   7866        { "sqlite3_normalized_sql",        test_norm_sql      ,0 },
  7840   7867   #endif
  7841   7868        { "sqlite3_next_stmt",             test_next_stmt     ,0 },
  7842   7869        { "sqlite3_stmt_readonly",         test_stmt_readonly ,0 },
         7870  +     { "sqlite3_stmt_isexplain",        test_stmt_isexplain,0 },
  7843   7871        { "sqlite3_stmt_busy",             test_stmt_busy     ,0 },
  7844   7872        { "uses_stmt_journal",             uses_stmt_journal ,0 },
  7845   7873   
  7846   7874        { "sqlite3_release_memory",        test_release_memory,     0},
  7847   7875        { "sqlite3_db_release_memory",     test_db_release_memory,  0},
  7848   7876        { "sqlite3_db_cacheflush",         test_db_cacheflush,      0},
  7849   7877        { "sqlite3_system_errno",          test_system_errno,       0},

Changes to src/vdbeapi.c.

  1603   1603   /*
  1604   1604   ** Return true if the prepared statement is guaranteed to not modify the
  1605   1605   ** database.
  1606   1606   */
  1607   1607   int sqlite3_stmt_readonly(sqlite3_stmt *pStmt){
  1608   1608     return pStmt ? ((Vdbe*)pStmt)->readOnly : 1;
  1609   1609   }
         1610  +
         1611  +/*
         1612  +** Return 1 if the statement is an EXPLAIN and return 2 if the
         1613  +** statement is an EXPLAIN QUERY PLAN
         1614  +*/
         1615  +int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt){
         1616  +  return pStmt ? ((Vdbe*)pStmt)->explain : 0;
         1617  +}
  1610   1618   
  1611   1619   /*
  1612   1620   ** Return true if the prepared statement is in need of being reset.
  1613   1621   */
  1614   1622   int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
  1615   1623     Vdbe *v = (Vdbe*)pStmt;
  1616   1624     return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;

Changes to test/capi3d.test.

   111    111   ifcapable wal {
   112    112     test_is_readonly capi3d-2.6 {PRAGMA journal_mode=WAL} 0
   113    113     test_is_readonly capi3d-2.7 {PRAGMA wal_checkpoint} 0
   114    114   }
   115    115   test_is_readonly capi3d-2.8 {PRAGMA application_id=1234} 0
   116    116   test_is_readonly capi3d-2.9 {VACUUM} 0
   117    117   test_is_readonly capi3d-2.10 {PRAGMA integrity_check} 1
   118         -do_test capi3-2.99 {
          118  +do_test capi3-2.49 {
   119    119     sqlite3_stmt_readonly 0
   120    120   } 1
   121    121   
          122  +
          123  +# Tests for the is-explain interface.
          124  +#
          125  +proc test_is_explain {testname sql truth} {
          126  +  do_test $testname [format {
          127  +    set DB [sqlite3_connection_pointer db]
          128  +    set STMT [sqlite3_prepare $DB {%s} -1 TAIL]
          129  +    set rc [sqlite3_stmt_isexplain $STMT]
          130  +    sqlite3_finalize $STMT
          131  +    set rc
          132  +  } $sql] $truth
          133  +}
          134  +
          135  +test_is_explain capi3d-2.51 {SELECT * FROM sqlite_master} 0
          136  +test_is_explain capi3d-2.52 { explain SELECT * FROM sqlite_master} 1
          137  +test_is_explain capi3d-2.53 {  Explain Query Plan select * FROM sqlite_master} 2
          138  +do_test capi3-2.99 {
          139  +  sqlite3_stmt_isexplain 0
          140  +} 0
          141  +
   122    142   # Tests for sqlite3_stmt_busy
   123    143   #
   124    144   do_test capi3d-3.1 {
   125    145     db eval {INSERT INTO t1 VALUES(6); INSERT INTO t1 VALUES(7);}
   126    146     set STMT [sqlite3_prepare db {SELECT * FROM t1} -1 TAIL]
   127    147     sqlite3_stmt_busy $STMT
   128    148   } {0}

Changes to test/fts3corrupt4.test.

  3692   3692   | end crash-b794c89d922ac9.db
  3693   3693   }]} {}
  3694   3694   
  3695   3695   do_catchsql_test 22.1 {
  3696   3696     SELECT snippet(t1,'', '', '--',-1,01)==0
  3697   3697       FROM t1 WHERE a MATCH 'rtree OR json1rtree OR json1';
  3698   3698   } {0 {0 0 0 0 0 0 0}}
         3699  +
         3700  +#-------------------------------------------------------------------------
         3701  +reset_db
         3702  +do_test 23.0 {
         3703  +  sqlite3 db {}
         3704  +  db deserialize [decode_hexdb {
         3705  +.open --hexdb
         3706  +| size 28672 pagesize 4096 filename crash-670b15f2955a36.db
         3707  +| page 1 offset 0
         3708  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
         3709  +|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 07   .....@  ........
         3710  +|     32: 00 00 00 02 10 00 00 01 00 00 00 07 00 00 00 00   ................
         3711  +|     96: 00 00 00 00 0d 0e b1 00 06 0d a4 00 0f 8d 0f 21   ...............!
         3712  +|    112: 0e b9 0d c8 0e 7e 0d a4 00 00 00 00 00 00 00 00   .....~..........
         3713  +|   3488: 00 00 00 00 22 07 06 17 11 11 01 31 74 61 62 6c   ...........1tabl
         3714  +|   3504: 65 74 32 74 32 07 43 52 45 41 54 45 20 54 41 42   et2t2.CREATE TAB
         3715  +|   3520: 4c 45 20 74 32 28 78 29 81 33 05 07 17 1f 1f 01   LE t2(x).3......
         3716  +|   3536: 82 35 74 61 62 6c 65 74 31 5f 73 65 67 64 69 72   .5tablet1_segdir
         3717  +|   3552: 74 31 5f 73 65 67 64 69 72 05 43 52 45 41 54 45   t1_segdir.CREATE
         3718  +|   3568: 20 54 41 42 4c 45 20 27 74 31 5f 73 65 67 64 69    TABLE 't1_segdi
         3719  +|   3584: 72 27 28 6c 65 76 65 6c 20 49 4e 54 45 47 45 52   r'(level INTEGER
         3720  +|   3600: 2c 69 64 78 20 49 4e 54 45 47 45 52 2c 73 74 61   ,idx INTEGER,sta
         3721  +|   3616: 72 74 5f 62 6c 6f 63 6b 20 49 4e 54 45 47 45 52   rt_block INTEGER
         3722  +|   3632: 2c 6c 65 61 76 65 73 5f 65 6e 64 5f 62 6c 6f 63   ,leaves_end_bloc
         3723  +|   3648: 6b 20 49 4e 54 45 47 45 52 2c 65 6e 64 5f 62 6c   k INTEGER,end_bl
         3724  +|   3664: 6f 63 6b 20 49 4e 54 45 47 45 52 2c 72 6f 6f 74   ock INTEGER,root
         3725  +|   3680: 20 42 4c 4f 42 2c 50 52 49 4d 41 52 59 20 4b 45    BLOB,PRIMARY KE
         3726  +|   3696: 59 28 6c 65 76 65 6c 2c 20 69 64 78 29 29 31 06   Y(level, idx))1.
         3727  +|   3712: 06 17 45 1f 01 00 69 6e 64 65 78 73 71 6c 69 74   ..E...indexsqlit
         3728  +|   3728: 65 5f 61 75 74 6f 69 6e 64 65 78 5f 74 31 5f 73   e_autoindex_t1_s
         3729  +|   3744: 65 67 64 69 72 5f 31 74 31 5f 73 65 67 64 69 72   egdir_1t1_segdir
         3730  +|   3760: 06 0f c7 00 08 00 00 00 00 66 04 07 17 23 23 01   .........f...##.
         3731  +|   3776: 81 13 74 61 62 6c 75 74 31 5f 73 65 67 6d 65 6e   ..tablut1_segmen
         3732  +|   3792: 74 73 74 31 5f 73 65 67 6d 65 6e 74 73 04 43 52   tst1_segments.CR
         3733  +|   3808: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 73   EATE TABLE 't1_s
         3734  +|   3824: 65 67 6d 65 6e 74 73 27 28 62 6c 6f 63 6b 69 64   egments'(blockid
         3735  +|   3840: 20 49 4e 54 45 47 45 42 20 50 52 49 4d 41 52 59    INTEGEB PRIMARY
         3736  +|   3856: 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42    KEY, block BLOB
         3737  +|   3872: 29 6a 03 07 17 21 21 01 81 1f 74 61 62 6c 65 74   )j...!!...tablet
         3738  +|   3888: 31 5f 63 6f 6e 74 65 6e 74 74 31 5f 63 6f 6e 74   1_contentt1_cont
         3739  +|   3904: 65 6e 74 03 43 52 45 41 54 45 20 54 41 42 4c 45   ent.CREATE TABLE
         3740  +|   3920: 20 27 74 31 5f 63 6f 6e 74 65 6e 74 27 28 64 6f    't1_content'(do
         3741  +|   3936: 63 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d   cid INTEGER PRIM
         3742  +|   3952: 41 52 59 20 4b 45 59 2c 20 27 63 30 61 27 2c 20   ARY KEY, 'c0a', 
         3743  +|   3968: 27 63 31 62 27 2c 20 27 63 32 63 27 29 38 02 06   'c1b', 'c2c')8..
         3744  +|   3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52   ...._tablet1t1CR
         3745  +|   4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42   EATE VIRTUAL TAB
         3746  +|   4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 33   LE t1 USING fts3
         3747  +|   4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00   (a,b,c).........
         3748  +| page 3 offset 8192
         3749  +|      0: 0d 00 00 00 25 0b 48 01 0f d8 00 2f 0f 86 0f 74   ....%.H..../...t
         3750  +|     16: 0f 61 0f 4e 0f 2f 0f 0f 0e ef 0e d7 0e be 0e a5   .a.N./..........
         3751  +|     32: 0e 8d 0e 74 0e 5a fe 40 0e 24 0e 08 0d ef 0d d5   ...t.Z.@.$......
         3752  +|     48: 0d bb 0d a0 0d 84 0d 68 0d 4f 81 35 0d 1b 0c fb   .......h.O.5....
         3753  +|     64: 0c da 0c b9 0c 99 0c 78 0c 57 0c 3e 00 00 00 00   .......x.W.>....
         3754  +|   2880: 00 00 00 00 00 00 00 00 81 3f 25 06 00 82 7f 10   .........?%.....
         3755  +|   2896: 00 43 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e   .COMPILER=gcc-5.
         3756  +|   2912: 34 2e 30 20 32 30 31 36 30 36 30 39 20 44 45 42   4.0 20160609 DEB
         3757  +|   2928: 55 47 20 45 4e 41 42 4c 45 20 44 42 53 54 41 54   UG ENABLE DBSTAT
         3758  +|   2944: 20 56 54 41 42 20 45 4e 41 42 4c 45 20 46 54 53    VTAB ENABLE FTS
         3759  +|   2960: 34 20 45 4e 41 42 4c 45 20 46 54 53 35 20 45 4e   4 ENABLE FTS5 EN
         3760  +|   2976: 41 42 4c 45 20 47 45 4f 50 4f 4c 59 20 45 4e 41   ABLE GEOPOLY ENA
         3761  +|   2992: 42 4c 45 20 4a 53 4f 4e 31 20 45 4e 41 42 4c 45   BLE JSON1 ENABLE
         3762  +|   3008: 20 4d 45 4d 53 59 53 35 20 45 4e 41 42 4c 45 20    MEMSYS5 ENABLE 
         3763  +|   3024: 52 54 52 45 45 20 4d 41 58 20 4d 45 4d 4f 52 59   RTREE MAX MEMORY
         3764  +|   3040: 3d 35 30 30 30 30 30 30 30 20 4f 4d 49 54 20 4c   =50000000 OMIT L
         3765  +|   3056: 4f 41 44 20 45 58 54 45 4e 53 49 4f 4e 20 54 48   OAD EXTENSION TH
         3766  +|   3072: 52 45 41 44 53 41 46 45 3d 30 18 24 05 00 35 0f   READSAFE=0.$..5.
         3767  +|   3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49   .THREADSAFE=0XBI
         3768  +|   3104: 4e 41 52 59 18 23 55 00 25 0f 19 54 48 52 45 41   NARY.#U.%..THREA
         3769  +|   3120: 44 53 41 46 45 3d 30 58 4e 4f 43 41 53 45 17 22   DSAFE=0XNOCASE..
         3770  +|   3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 45 3d   ..%..THREADSAFE=
         3771  +|   3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d   0XRTRIM.!..3..OM
         3772  +|   3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49 4f   IT LOAD EXTENSIO
         3773  +|   3184: 4e 58 42 49 4e 41 52 59 1f 20 05 00 33 0f 19 4f   NXBINARY. ..3..O
         3774  +|   3200: 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49   MIT LOAD EXTENSI
         3775  +|   3216: 4f 4e 58 4e 4f 43 41 53 45 1e 1f 05 00 33 0f 17   ONXNOCASE....3..
         3776  +|   3232: 4f 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53   OMIT LOAD EXTENS
         3777  +|   3248: 49 4f 4e 58 52 54 52 49 4d 1f 1e 05 00 33 0f 19   IONXRTRIM....3..
         3778  +|   3264: 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 30   MAX MEMORY=50000
         3779  +|   3280: 30 30 30 58 42 49 4e 41 52 59 1f 1d 05 00 33 0f   000XBINARY....3.
         3780  +|   3296: 19 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30   .MAX MEMORY=5000
         3781  +|   3312: 30 30 30 30 58 4e 4f 43 41 53 45 1e 1c 05 00 33   0000XNOCASE....3
         3782  +|   3328: 0f 17 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30   ..MAX MEMORY=500
         3783  +|   3344: 30 30 30 30 30 58 52 54 52 49 4d 18 1b 05 00 25   00000XRTRIM....%
         3784  +|   3360: 0f 19 45 4e 41 42 4c 44 20 52 54 52 45 45 58 42   ..ENABLD RTREEXB
         3785  +|   3376: 49 4e 41 52 59 18 1a 05 00 25 0f 19 45 4e 41 42   INARY....%..ENAB
         3786  +|   3392: 4c 45 20 52 54 52 45 45 58 4e 4f 43 41 53 45 17   LE RTREEXNOCASE.
         3787  +|   3408: 19 05 00 24 0f 17 45 4e 40 42 4c 45 20 52 54 52   ...$..EN@BLE RTR
         3788  +|   3424: 45 45 58 52 54 52 49 4d 1a 18 05 00 29 0f 19 45   EEXRTRIM....)..E
         3789  +|   3440: 4e 41 42 4c 45 20 4d 45 4d 53 59 53 35 58 42 49   NABLE MEMSYS5XBI
         3790  +|   3456: 4e 41 52 59 1a 17 05 00 29 0f 19 45 4d 41 42 4c   NARY....)..EMABL
         3791  +|   3472: 45 20 4d 45 4d 53 59 53 35 58 4e 4f 43 41 4c 45   E MEMSYS5XNOCALE
         3792  +|   3488: 19 16 05 00 29 0f 17 45 4e 41 42 4c 45 20 4d 45   ....)..ENABLE ME
         3793  +|   3504: 4e 53 59 53 35 58 52 54 52 49 4d 18 15 05 00 25   NSYS5XRTRIM....%
         3794  +|   3520: 0f 19 45 4e 41 42 4c 45 20 4a 53 4f 4e 31 58 42   ..ENABLE JSON1XB
         3795  +|   3536: 49 4e 41 52 59 18 14 05 00 25 0f 19 45 4e 41 42   INARY....%..ENAB
         3796  +|   3552: 4c 45 20 4a 53 4f 4e 31 58 4e 4f 43 41 53 45 17   LE JSON1XNOCASE.
         3797  +|   3568: 13 05 00 25 0f 17 45 4e 41 42 4c 45 20 4a 53 4f   ...%..ENABLE JSO
         3798  +|   3584: 4e 31 58 52 54 5f b9 4d 1a 12 05 00 29 0f 19 45   N1XRT_.M....)..E
         3799  +|   3600: 4e 41 42 4c 45 20 47 45 4f 50 31 4c 59 58 42 49   NABLE GEOP1LYXBI
         3800  +|   3616: 4e 41 52 58 1a 11 05 00 29 0f 19 45 4e 41 42 4c   NARX....)..ENABL
         3801  +|   3632: 45 20 47 45 4f 50 4f 4c 59 58 4e 4f 43 41 53 45   E GEOPOLYXNOCASE
         3802  +|   3648: 19 10 05 00 29 0f 17 45 4e 41 42 4c 45 20 57 45   ....)..ENABLE WE
         3803  +|   3664: 4f 50 4f 4c 59 48 52 54 52 49 4d 17 0f 05 00 23   OPOLYHRTRIM....#
         3804  +|   3680: 0f 19 45 4e 41 42 4c 45 20 46 54 53 35 58 42 49   ..ENABLE FTS5XBI
         3805  +|   3696: 4e 41 53 59 17 0e 05 00 23 0f 19 45 4e 40 42 4b   NASY....#..EN@BK
         3806  +|   3712: 45 20 46 54 53 35 58 4e 4f 43 41 53 45 16 0d 05   E FTS5XNOCASE...
         3807  +|   3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58   .#..ENABLE FTS5X
         3808  +|   3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42   RTRIM....#..ENAB
         3809  +|   3760: 4c 45 20 46 54 94 34 58 42 49 4e 41 52 59 17 0b   LE FT.4XBINARY..
         3810  +|   3776: 05 00 23 0f 19 45 4e 41 42 4c 43 70 46 54 53 34   ..#..ENABLCpFTS4
         3811  +|   3792: 58 4e 4f 43 41 53 45 16 0a 05 00 23 0f 17 45 4e   XNOCASE....#..EN
         3812  +|   3808: 41 42 4c 45 20 46 54 53 34 58 52 54 52 49 4d 1e   ABLE FTS4XRTRIM.
         3813  +|   3824: 09 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         3814  +|   3840: 54 41 54 20 56 54 41 42 58 42 49 4e 41 52 59 1e   TAT VTABXBINARY.
         3815  +|   3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 32 53   ...1..ENABLE D2S
         3816  +|   3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d   TAT VTABXNOCASE.
         3817  +|   3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         3818  +|   3904: 54 41 54 20 56 54 41 42 58 52 54 52 49 4d 11 06   TAT VTABXRTRIM..
         3819  +|   3920: 05 0b 27 0f 19 44 45 42 55 47 58 42 49 4e 41 52   ..'..DEBUGXBINAR
         3820  +|   3936: 59 11 05 05 00 17 0f 19 44 45 42 55 47 58 4e 4f   Y.......DEBUGXNO
         3821  +|   3952: 43 41 53 45 10 03 05 00 17 0f 17 44 45 42 55 47   CASE.......DEBUG
         3822  +|   3968: 58 52 54 52 49 4d 27 03 05 00 43 0f 19 43 4f 4d   XRTRIM'...C..COM
         3823  +|   3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20   PILER=gcc-5.4.0 
         3824  +|   4000: 32 30 31 36 30 36 30 39 58 42 49 4e 41 52 59 27   20160609XBINARY'
         3825  +|   4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 35 52 3d 67   ...C..COMPIL5R=g
         3826  +|   4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30   cc-5.4.0 2016060
         3827  +|   4048: 39 58 4e 4f 43 41 53 45 26 01 05 00 43 0f 02 43   9XNOCASE&...C..C
         3828  +|   4064: 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e   OMPILER=gcc-5.4.
         3829  +|   4080: 30 20 32 30 31 36 30 36 30 39 58 00 00 00 00 00   0 20160609X.....
         3830  +| page 5 offset 16384
         3831  +|      0: 0d 00 00 00 02 0b a0 00 0c ad 0b a0 00 00 00 00   ................
         3832  +|   2976: 82 0a 02 08 08 09 08 08 17 84 06 30 20 32 35 33   ...........0 253
         3833  +|   2992: 00 01 30 04 25 06 1b 00 00 08 32 30 31 36 30 36   ..0.%.....201606
         3834  +|   3008: 30 39 03 25 07 00 00 01 34 03 25 05 00 00 01 35   09.%....4.%....5
         3835  +|   3024: 03 25 04 00 01 07 30 30 30 30 30 30 30 08 55 1a   .%....0000000.U.
         3836  +|   3040: 00 00 08 63 6f 6d 70 69 6c 65 72 03 25 02 00 00   ...compiler.%...
         3837  +|   3056: 06 64 62 73 74 61 74 03 25 0a 00 01 04 65 61 75   .dbstat.%....eau
         3838  +|   3072: 67 03 25 08 00 00 06 65 6e 61 62 6c 65 09 25 09   g.%....enable.%.
         3839  +|   3088: 05 04 04 04 04 04 00 01 08 78 74 65 6e 73 69 6f   .........xtensio
         3840  +|   3104: 6e 03 25 1d 00 00 04 66 74 73 34 03 25 0d 00 03   n.%....fts4.%...
         3841  +|   3120: 01 35 03 25 0f 00 00 0c 97 63 63 03 25 03 00 01   .5.%.....cc.%...
         3842  +|   3136: 06 65 6f 70 6f 6c 7a 03 25 11 00 00 05 6a 73 6f   .eopolz.%....jso
         3843  +|   3152: 6e 31 03 25 13 00 00 04 6c 6f 61 64 03 25 1c 00   n1.%....load.%..
         3844  +|   3168: 00 03 6d 61 78 03 25 18 00 01 05 65 6d 6f 72 79   ..max.%....emory
         3845  +|   3184: 03 25 3d f0 03 04 73 79 73 35 03 25 15 00 00 04   .%=...sys5.%....
         3846  +|   3200: 6f 6d 69 74 03 25 1b 00 00 05 72 74 72 65 65 03   omit.%....rtree.
         3847  +|   3216: 25 17 00 00 0a 74 68 72 65 61 64 73 61 66 65 03   %....threadsafe.
         3848  +|   3232: 25 1e 00 00 04 76 74 61 62 03 25 0b 00 86 50 01   %....vtab.%...P.
         3849  +|   3248: 08 08 08 09 08 17 8d 12 30 20 38 33 37 e3 aa e0   ........0 837...
         3850  +|   3264: 12 d1 06 00 01 06 00 01 06 00 1f 03 00 01 03 00   ................
         3851  +|   3280: 01 03 00 00 08 32 30 31 36 30 36 30 49 09 01 07   .....2016060I...
         3852  +|   3296: 00 01 07 00 01 07 00 00 01 34 09 01 05 00 01 05   .........4......
         3853  +|   3312: 00 01 05 00 00 01 35 09 01 04 00 01 04 00 01 04   ......5.........
         3854  +|   3328: 00 01 07 30 30 30 30 30 30 30 09 1c 04 00 01 04   ...0000000......
         3855  +|   3344: 00 01 04 00 00 06 62 69 6e 61 72 79 3c 03 01 02   ......binary<...
         3856  +|   3360: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         3857  +|   3376: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00   ................
         3858  +|   3392: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03   ................
         3859  +|   3408: 01 02 02 00 03 01 02 02 00 00 08 63 6f 6d 70 69   ...........compi
         3860  +|   3424: 6c 65 72 09 01 02 00 01 02 00 01 02 00 00 06 64   ler............d
         3861  +|   3440: 62 73 74 61 74 09 07 03 00 01 03 00 01 03 00 01   bstat...........
         3862  +|   3456: 04 65 62 75 67 09 04 01 f0 01 02 00 01 02 00 00   .ebug...........
         3863  +|   3472: 06 65 6e 61 62 6c 65 3f 07 02 00 01 02 00 01 02   .enable?........
         3864  +|   3488: 00 01 02 00 01 02 00 01 02 00 01 02 00 01 02 00   ................
         3865  +|   3504: 01 02 00 01 02 00 01 02 00 01 02 00 01 02 00 01   ................
         3866  +|   3520: 02 00 01 02 00 01 02 00 01 02 00 01 02 00 01 02   ................
         3867  +|   3536: 00 01 02 00 01 02 00 01 08 78 74 65 6e 73 69 6f   .........xtensio
         3868  +|   3552: 6e 09 1f 04 00 01 04 00 01 04 00 00 04 66 74 73   n............fts
         3869  +|   3568: 34 09 0a 03 f3 01 03 00 01 03 00 19 01 35 09 0d   4............5..
         3870  +|   3584: 03 00 01 03 00 01 03 00 00 03 67 63 63 09 01 03   ..........gcc...
         3871  +|   3600: 00 01 03 00 01 03 00 01 06 65 6f 70 6f 6c 79 09   .........eopoly.
         3872  +|   3616: 10 03 00 01 03 00 01 03 00 00 05 6a 73 6f 6e 31   ...........json1
         3873  +|   3632: 09 13 03 00 01 03 00 00 f3 00 00 04 6c 6f 61 64   ............load
         3874  +|   3648: 09 1f 03 00 01 03 00 01 03 00 00 03 6d 61 78 09   ............max.
         3875  +|   3664: 1c 02 00 01 02 00 01 02 00 01 05 65 6d 6f 72 79   ...........emory
         3876  +|   3680: 09 1c 03 00 01 03 00 01 03 00 03 04 73 79 73 35   ............sys5
         3877  +|   3696: 09 16 03 00 01 03 00 01 03 00 00 06 6e 6f 63 61   ............noca
         3878  +|   3712: 73 65 3c 02 01 02 02 00 03 01 02 02 00 03 01 02   se<.............
         3879  +|   3728: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         3880  +|   3744: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00   ................
         3881  +|   3760: 03 01 02 02 00 03 01 02 02 00 46 01 02 02 00 00   ..........F.....
         3882  +|   3776: 04 6f 6d 69 74 09 1f 02 00 01 02 00 01 02 00 00   .omit...........
         3883  +|   3792: 05 72 74 72 64 65 09 19 03 00 01 03 00 01 03 00   .rtrde..........
         3884  +|   3808: 03 02 69 6d 3c 01 01 02 02 00 03 01 02 02 00 03   ..im<...........
         3885  +|   3824: 01 02 02 00 03 01 02 01 ff 03 01 02 02 00 03 01   ................
         3886  +|   3840: 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02   ................
         3887  +|   3856: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         3888  +|   3872: 00 00 0a 74 68 72 65 61 64 73 61 66 65 09 22 02   ...threadsafe...
         3889  +|   3888: 00 01 02 00 01 02 00 00 04 76 74 61 62 09 07 04   .........vtab...
         3890  +|   3904: 00 01 04 00 01 04 00 00 01 78 b4 01 01 01 01 02   .........x......
         3891  +|   3920: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         3892  +|   3936: 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01   ................
         3893  +|   3952: 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01   ................
         3894  +|   3968: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01   ................
         3895  +|   3984: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02   ................
         3896  +|   4000: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         3897  +|   4016: 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01   ................
         3898  +|   4032: 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01   ................
         3899  +|   4048: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01   ................
         3900  +|   4064: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 02 02   ................
         3901  +|   4080: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         3902  +| page 6 offset 20480
         3903  +|      0: 0a 00 00 00 02 0f f5 00 0f fb 0f f5 00 00 00 00   ................
         3904  +|   4080: 00 00 00 00 00 05 04 08 09 01 02 04 04 08 09 09   ................
         3905  +| page 7 offset 24576
         3906  +|      0: 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
         3907  +|   4016: 00 00 00 00 00 00 00 00 0d 05 02 23 61 75 74 6f   ...........#auto
         3908  +|   4032: 6d 65 71 97 65 3d 35 0d 04 02 23 6d 65 72 67 65   meq.e=5...#merge
         3909  +|   4048: 3d 31 30 30 2c 38 11 03 02 2b 69 6e 74 65 67 72   =100,8...+integr
         3910  +|   4064: 69 74 79 00 00 00 00 00 00 00 00 00 00 00 00 00   ity.............
         3911  +| end crash-670b15f2955a36.db
         3912  +}]} {}
         3913  +
         3914  +do_catchsql_test 23.1 {
         3915  +  SELECT 'FyzLy'FROM t1 WHERE t1 MATCH 'j';
         3916  +} {1 {database disk image is malformed}}
  3699   3917   
  3700   3918   finish_test
  3701   3919   

Changes to test/fuzzdata7.db.

cannot compute difference between binary files

Changes to test/fuzzdata8.db.

cannot compute difference between binary files

Added tool/extract-sqlite3h.tcl.

            1  +#!/usr/bin/tclsh
            2  +#
            3  +# Given an sqlite3.c source file identified by the command-line
            4  +# argument, extract the "sqlite3.h" header file that is embedded inside
            5  +# the sqlite3.c source file and write it to standard output.
            6  +#
            7  +if {[llength $argv]!=1} {
            8  +  puts stderr "Usage: $argv0 sqlite3.c >sqlite3.h"
            9  +  exit 1
           10  +}
           11  +set in [open [lindex $argv 0] rb]
           12  +while {![eof $in]} {
           13  +  set line [gets $in]
           14  +  if {[string match {* Begin file sqlite3.h *} $line]} break
           15  +}
           16  +while {![eof $in]} {
           17  +  set line [gets $in]
           18  +  if {[string match {* End of sqlite3.h *} $line]} break
           19  +  puts $line
           20  +}
           21  +close $in

Changes to tool/showdb.c.

   824    824     }
   825    825     if( nLocal<nPayload ){
   826    826       int ovfl = decodeInt32(a+nLocal);
   827    827       int cnt = 0;
   828    828       while( ovfl && (cnt++)<g.mxPage ){
   829    829         page_usage_msg(ovfl, "overflow %d from cell %d of page %d",
   830    830                        cnt, cellno, pgno);
   831         -      a = fileRead((ovfl-1)*g.pagesize, 4);
          831  +      a = fileRead((ovfl-1)*(sqlite3_int64)g.pagesize, 4);
   832    832         ovfl = decodeInt32(a);
   833    833         sqlite3_free(a);
   834    834       }
   835    835     }
   836    836   }
   837    837   
   838    838