/ Changes On Branch branch-3.9.2
Login

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

Changes In Branch branch-3.9.2 Excluding Merge-Ins

This is equivalent to a diff from bda77dda96 to c4f798b212

2018-02-02
16:46
Enable the ".wheretrace" and ".selecttrace" options in the shell when configure is run using --enable-debug. This mirrors a similar change that has already occurred on trunk. (Leaf check-in: c4f798b212 user: drh tags: branch-3.9.2)
2017-07-21
07:45
Add new interfaces sqlite3_result_pointer(), and sqlite3_value_pointer() and use them to transfer the eponymous FTS3 column pointer to the snippet() and offsets() routines. This changes is a cherry-pick of [f0f49224] with version-specific edits. That check-in was inspired by check-in [72de49f2]. (check-in: 69906880ce user: drh tags: branch-3.9.2)
2016-03-31
21:16
Enhance the query planner so that IS and IS NULL operators are able to drive an index on a LEFT OUTER JOIN. (check-in: f1e6bb952e user: drh tags: branch-3.9)
2015-11-02
18:31
Version 3.9.2 (check-in: bda77dda96 user: drh tags: release, branch-3.9, version-3.9.2)
11:19
When creating an automatic-index on a sub-query, add a unique integer to the end of each index key to ensure the entire key is unique. Fix for [8a2adec1]. (check-in: c0c4b6b396 user: drh tags: branch-3.9)

Changes to configure.

 11138  11138   if test "${enable_debug+set}" = set; then :
 11139  11139     enableval=$enable_debug; use_debug=$enableval
 11140  11140   else
 11141  11141     use_debug=no
 11142  11142   fi
 11143  11143   
 11144  11144   if test "${use_debug}" = "yes" ; then
 11145         -  TARGET_DEBUG="-DSQLITE_DEBUG=1"
        11145  +  TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0"
 11146  11146   else
 11147  11147     TARGET_DEBUG="-DNDEBUG"
 11148  11148   fi
 11149  11149   
 11150  11150   
 11151  11151   #########
 11152  11152   # See whether we should use the amalgamation to build

Changes to configure.ac.

   528    528   AC_SEARCH_LIBS(fdatasync, [rt])
   529    529   
   530    530   #########
   531    531   # check for debug enabled
   532    532   AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
   533    533         [use_debug=$enableval],[use_debug=no])
   534    534   if test "${use_debug}" = "yes" ; then
   535         -  TARGET_DEBUG="-DSQLITE_DEBUG=1"
          535  +  TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0"
   536    536   else
   537    537     TARGET_DEBUG="-DNDEBUG"
   538    538   fi
   539    539   AC_SUBST(TARGET_DEBUG)
   540    540   
   541    541   #########
   542    542   # See whether we should use the amalgamation to build

Changes to ext/fts3/fts3.c.

  3315   3315       /* This call is a request for the "docid" column. Since "docid" is an 
  3316   3316       ** alias for "rowid", use the xRowid() method to obtain the value.
  3317   3317       */
  3318   3318       sqlite3_result_int64(pCtx, pCsr->iPrevId);
  3319   3319     }else if( iCol==p->nColumn ){
  3320   3320       /* The extra column whose name is the same as the table.
  3321   3321       ** Return a blob which is a pointer to the cursor.  */
  3322         -    sqlite3_result_blob(pCtx, &pCsr, sizeof(pCsr), SQLITE_TRANSIENT);
         3322  +    sqlite3_result_pointer(pCtx, pCsr);
  3323   3323     }else if( iCol==p->nColumn+2 && pCsr->pExpr ){
  3324   3324       sqlite3_result_int64(pCtx, pCsr->iLangid);
  3325   3325     }else{
  3326   3326       /* The requested column is either a user column (one that contains 
  3327   3327       ** indexed data), or the language-id column.  */
  3328   3328       rc = fts3CursorSeek(0, pCsr);
  3329   3329   
................................................................................
  3527   3527   */
  3528   3528   static int fts3FunctionArg(
  3529   3529     sqlite3_context *pContext,      /* SQL function call context */
  3530   3530     const char *zFunc,              /* Function name */
  3531   3531     sqlite3_value *pVal,            /* argv[0] passed to function */
  3532   3532     Fts3Cursor **ppCsr              /* OUT: Store cursor handle here */
  3533   3533   ){
  3534         -  Fts3Cursor *pRet;
  3535         -  if( sqlite3_value_type(pVal)!=SQLITE_BLOB 
  3536         -   || sqlite3_value_bytes(pVal)!=sizeof(Fts3Cursor *)
  3537         -  ){
         3534  +  Fts3Cursor *pRet = (Fts3Cursor*)sqlite3_value_pointer(pVal);
         3535  +  if( pRet==0 ){
  3538   3536       char *zErr = sqlite3_mprintf("illegal first argument to %s", zFunc);
  3539   3537       sqlite3_result_error(pContext, zErr, -1);
  3540   3538       sqlite3_free(zErr);
  3541   3539       return SQLITE_ERROR;
  3542   3540     }
  3543         -  memcpy(&pRet, sqlite3_value_blob(pVal), sizeof(Fts3Cursor *));
  3544   3541     *ppCsr = pRet;
  3545   3542     return SQLITE_OK;
  3546   3543   }
  3547   3544   
  3548   3545   /*
  3549   3546   ** Implementation of the snippet() function for FTS3
  3550   3547   */

Changes to src/sqlite.h.in.

  4348   4348   */
  4349   4349   const void *sqlite3_value_blob(sqlite3_value*);
  4350   4350   int sqlite3_value_bytes(sqlite3_value*);
  4351   4351   int sqlite3_value_bytes16(sqlite3_value*);
  4352   4352   double sqlite3_value_double(sqlite3_value*);
  4353   4353   int sqlite3_value_int(sqlite3_value*);
  4354   4354   sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
         4355  +void *sqlite3_value_pointer(sqlite3_value*);
  4355   4356   const unsigned char *sqlite3_value_text(sqlite3_value*);
  4356   4357   const void *sqlite3_value_text16(sqlite3_value*);
  4357   4358   const void *sqlite3_value_text16le(sqlite3_value*);
  4358   4359   const void *sqlite3_value_text16be(sqlite3_value*);
  4359   4360   int sqlite3_value_type(sqlite3_value*);
  4360   4361   int sqlite3_value_numeric_type(sqlite3_value*);
  4361   4362   
................................................................................
  4660   4661   void sqlite3_result_error16(sqlite3_context*, const void*, int);
  4661   4662   void sqlite3_result_error_toobig(sqlite3_context*);
  4662   4663   void sqlite3_result_error_nomem(sqlite3_context*);
  4663   4664   void sqlite3_result_error_code(sqlite3_context*, int);
  4664   4665   void sqlite3_result_int(sqlite3_context*, int);
  4665   4666   void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
  4666   4667   void sqlite3_result_null(sqlite3_context*);
         4668  +void sqlite3_result_pointer(sqlite3_context*, void*);
  4667   4669   void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
  4668   4670   void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
  4669   4671                              void(*)(void*), unsigned char encoding);
  4670   4672   void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
  4671   4673   void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
  4672   4674   void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
  4673   4675   void sqlite3_result_value(sqlite3_context*, sqlite3_value*);

Changes to src/vdbeInt.h.

   165    165   ** integer etc.) of the same value.
   166    166   */
   167    167   struct Mem {
   168    168     union MemValue {
   169    169       double r;           /* Real value used when MEM_Real is set in flags */
   170    170       i64 i;              /* Integer value used when MEM_Int is set in flags */
   171    171       int nZero;          /* Used when bit MEM_Zero is set in flags */
          172  +    void *pPtr;         /* Pointer when flags==MEM_Ptr|MEM_Null */
   172    173       FuncDef *pDef;      /* Used only when flags==MEM_Agg */
   173    174       RowSet *pRowSet;    /* Used only when flags==MEM_RowSet */
   174    175       VdbeFrame *pFrame;  /* Used when flags==MEM_Frame */
   175    176     } u;
   176    177     u16 flags;          /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
   177    178     u8  enc;            /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */
   178    179     u8  eSubtype;       /* Subtype for this value */
................................................................................
   222    223   
   223    224   
   224    225   /* Whenever Mem contains a valid string or blob representation, one of
   225    226   ** the following flags must be set to determine the memory management
   226    227   ** policy for Mem.z.  The MEM_Term flag tells us whether or not the
   227    228   ** string is \000 or \u0000 terminated
   228    229   */
          230  +#define MEM_Ptr       0x8000   /* u.pPtr is valid if type==SQLITE_NULL */
   229    231   #define MEM_Term      0x0200   /* String rep is nul terminated */
   230    232   #define MEM_Dyn       0x0400   /* Need to call Mem.xDel() on Mem.z */
   231    233   #define MEM_Static    0x0800   /* Mem.z points to a static string */
   232    234   #define MEM_Ephem     0x1000   /* Mem.z points to an ephemeral string */
   233    235   #define MEM_Agg       0x2000   /* Mem.z points to an agg function context */
   234    236   #define MEM_Zero      0x4000   /* Mem.i contains count of 0s appended to blob */
   235    237   #ifdef SQLITE_OMIT_INCRBLOB
................................................................................
   237    239     #define MEM_Zero 0x0000
   238    240   #endif
   239    241   
   240    242   /*
   241    243   ** Clear any existing type flags from a Mem and replace them with f
   242    244   */
   243    245   #define MemSetTypeFlag(p, f) \
   244         -   ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f)
          246  +   ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero|MEM_Ptr))|f)
   245    247   
   246    248   /*
   247    249   ** Return true if a memory cell is not marked as invalid.  This macro
   248    250   ** is for use inside assert() statements only.
   249    251   */
   250    252   #ifdef SQLITE_DEBUG
   251    253   #define memIsValid(M)  ((M)->flags & MEM_Undefined)==0

Changes to src/vdbeapi.c.

   185    185     return (int)sqlite3VdbeIntValue((Mem*)pVal);
   186    186   }
   187    187   sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){
   188    188     return sqlite3VdbeIntValue((Mem*)pVal);
   189    189   }
   190    190   unsigned int sqlite3_value_subtype(sqlite3_value *pVal){
   191    191     return ((Mem*)pVal)->eSubtype;
          192  +}
          193  +void *sqlite3_value_pointer(sqlite3_value *pVal){
          194  +  Mem *p = (Mem*)pVal;
          195  +  if( (p->flags&(MEM_TypeMask|MEM_Ptr))==(MEM_Null|MEM_Ptr) ) return p->u.pPtr;
          196  +  return 0;
   192    197   }
   193    198   const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
   194    199     return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
   195    200   }
   196    201   #ifndef SQLITE_OMIT_UTF16
   197    202   const void *sqlite3_value_text16(sqlite3_value* pVal){
   198    203     return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
................................................................................
   359    364   void sqlite3_result_int(sqlite3_context *pCtx, int iVal){
   360    365     assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
   361    366     sqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal);
   362    367   }
   363    368   void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
   364    369     assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
   365    370     sqlite3VdbeMemSetInt64(pCtx->pOut, iVal);
          371  +}
          372  +void sqlite3_result_pointer(sqlite3_context *pCtx, void *pPtr){
          373  +  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
          374  +  sqlite3VdbeMemSetNull(pCtx->pOut);
          375  +  assert( (pCtx->pOut->flags & (MEM_TypeMask|MEM_Ptr))==MEM_Null );
          376  +  pCtx->pOut->flags |= MEM_Ptr;
          377  +  pCtx->pOut->u.pPtr = pPtr;
   366    378   }
   367    379   void sqlite3_result_null(sqlite3_context *pCtx){
   368    380     assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
   369    381     sqlite3VdbeMemSetNull(pCtx->pOut);
   370    382   }
   371    383   void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
   372    384     assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );