/ Check-in [f332ffc39b]
Login

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

Overview
Comment:Make sure sqlite3_value_dup() works correctly even for sqlite3_value objects that are marked SQLITE_STATIC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | value-dup
Files: files | file ages | folders
SHA1: f332ffc39b7a17fd6254d8dc699293a57a508ba0
User & Date: drh 2015-05-22 21:04:54
Context
2015-05-22
21:12
Add the sqlite3_value_dup() and sqlite3_value_free() interfaces. Use these interfaces to enhance R-Tree to add the sqlite3_rtree_query_info.apSqlParam field. check-in: c1814242e6 user: drh tags: trunk
21:04
Make sure sqlite3_value_dup() works correctly even for sqlite3_value objects that are marked SQLITE_STATIC. Closed-Leaf check-in: f332ffc39b user: drh tags: value-dup
19:55
Fix minor issues with the sqlite3_value_dup() interface. check-in: 95edcf5010 user: drh tags: value-dup
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbeapi.c.

220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
  pNew = sqlite3_malloc( sizeof(*pNew) );
  if( pNew==0 ) return 0;
  memset(pNew, 0, sizeof(*pNew));
  memcpy(pNew, pOrig, MEMCELLSIZE);
  pNew->flags &= ~MEM_Dyn;
  pNew->db = 0;
  if( pNew->flags&(MEM_Str|MEM_Blob) ){
    if( 0==(pOrig->flags&MEM_Static) ){
      pNew->flags |= MEM_Ephem;
      if( sqlite3VdbeMemMakeWriteable(pNew)!=SQLITE_OK ){
        sqlite3ValueFree(pNew);
        pNew = 0;
      }
    }
  }
  return pNew;
}

/* Destroy an sqlite3_value object previously obtained from
** sqlite3_value_dup().







|
|
|
|
|
<







220
221
222
223
224
225
226
227
228
229
230
231

232
233
234
235
236
237
238
  pNew = sqlite3_malloc( sizeof(*pNew) );
  if( pNew==0 ) return 0;
  memset(pNew, 0, sizeof(*pNew));
  memcpy(pNew, pOrig, MEMCELLSIZE);
  pNew->flags &= ~MEM_Dyn;
  pNew->db = 0;
  if( pNew->flags&(MEM_Str|MEM_Blob) ){
    pNew->flags &= ~(MEM_Static|MEM_Dyn);
    pNew->flags |= MEM_Ephem;
    if( sqlite3VdbeMemMakeWriteable(pNew)!=SQLITE_OK ){
      sqlite3ValueFree(pNew);
      pNew = 0;

    }
  }
  return pNew;
}

/* Destroy an sqlite3_value object previously obtained from
** sqlite3_value_dup().