/ Check-in [a8846aee]
Login

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

Overview
Comment:Minor simplification of schema error reporting.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | oom-handling
Files: files | file ages | folders
SHA1: a8846aeed9992c6c9f1c8bd6e996a4cbe891751e
User & Date: drh 2016-02-05 02:50:11
Context
2016-02-05
04:50
OOM failures on sqlite3_errmsg16() in an app-defined function are no longer benign. check-in: 9efb223f user: drh tags: oom-handling
02:50
Minor simplification of schema error reporting. check-in: a8846aee user: drh tags: oom-handling
02:42
Further performance improvements that fall out of the mallocFailed changes. check-in: d94416dd user: drh tags: oom-handling
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/prepare.c.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  const char *zObj,    /* Object being parsed at the point of error */
  const char *zExtra   /* Error information */
){
  sqlite3 *db = pData->db;
  if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){
    char *z;
    if( zObj==0 ) zObj = "?";
    z = sqlite3_mprintf("malformed database schema (%s)", zObj);
    if( z && zExtra ) z = sqlite3_mprintf("%z - %s", z, zExtra);
    sqlite3DbFree(db, *pData->pzErrMsg);
    *pData->pzErrMsg = z;
    if( z==0 ) sqlite3OomFault(db);
  }
  pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT;
}

/*
** This is the callback routine for the code that initializes the
** database.  See sqlite3Init() below for additional information.







|
|


<







24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
  const char *zObj,    /* Object being parsed at the point of error */
  const char *zExtra   /* Error information */
){
  sqlite3 *db = pData->db;
  if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){
    char *z;
    if( zObj==0 ) zObj = "?";
    z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
    if( zExtra ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
    sqlite3DbFree(db, *pData->pzErrMsg);
    *pData->pzErrMsg = z;

  }
  pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT;
}

/*
** This is the callback routine for the code that initializes the
** database.  See sqlite3Init() below for additional information.