SQLite

Check-in [7780f5e9d5]
Login

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

Overview
Comment:sqlite3_column_int() and similar routines return 0 or 0.0 on an out-of-memory condition, not some mysterious error code. (CVS 2759)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7780f5e9d504926f11bd0662c03c88c76fb1d416
User & Date: drh 2005-11-03 14:29:55.000
Context
2005-11-04
22:03
VACUUM works even on an empty database. Ticket #1512. (CVS 2760) (check-in: 1b6bf4188e user: drh tags: trunk)
2005-11-03
14:29
sqlite3_column_int() and similar routines return 0 or 0.0 on an out-of-memory condition, not some mysterious error code. (CVS 2759) (check-in: 7780f5e9d5 user: drh tags: trunk)
12:33
Prohibit parameters in CHECK constraint expressions. (CVS 2758) (check-in: bb94ef64b2 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbemem.c.
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
    return pMem->i;
  }else if( flags & MEM_Real ){
    return (i64)pMem->r;
  }else if( flags & (MEM_Str|MEM_Blob) ){
    i64 value;
    if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
       || sqlite3VdbeMemNulTerminate(pMem) ){
      return SQLITE_NOMEM;
    }
    assert( pMem->z );
    sqlite3atoi64(pMem->z, &value);
    return value;
  }else{
    return 0;
  }







|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
    return pMem->i;
  }else if( flags & MEM_Real ){
    return (i64)pMem->r;
  }else if( flags & (MEM_Str|MEM_Blob) ){
    i64 value;
    if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
       || sqlite3VdbeMemNulTerminate(pMem) ){
      return 0;
    }
    assert( pMem->z );
    sqlite3atoi64(pMem->z, &value);
    return value;
  }else{
    return 0;
  }
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
    return pMem->r;
  }else if( pMem->flags & MEM_Int ){
    return (double)pMem->i;
  }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
    double val = 0.0;
    if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
       || sqlite3VdbeMemNulTerminate(pMem) ){
      return SQLITE_NOMEM;
    }
    assert( pMem->z );
    sqlite3AtoF(pMem->z, &val);
    return val;
  }else{
    return 0.0;
  }







|







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
    return pMem->r;
  }else if( pMem->flags & MEM_Int ){
    return (double)pMem->i;
  }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
    double val = 0.0;
    if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
       || sqlite3VdbeMemNulTerminate(pMem) ){
      return 0.0;
    }
    assert( pMem->z );
    sqlite3AtoF(pMem->z, &val);
    return val;
  }else{
    return 0.0;
  }