Exemple #1
0
/*
** Fill the InitData structure with an error message that indicates
** that the database is corrupt.
*/
static void corruptSchema(
    InitData *pData,     /* Initialization context */
    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 ) {
        if( zObj==0 ) zObj = "?";
        sqlite3SetString(pData->pzErrMsg, db,
                         "malformed database schema (%s)", zObj);
        if( zExtra ) {
            *pData->pzErrMsg = sqlite3MAppendf(db, *pData->pzErrMsg,
                                               "%s - %s", *pData->pzErrMsg, zExtra);
        }
    }
    pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT;
}
Exemple #2
0
static void corruptSchema(
    InitData *pData,
    const char *zObj,
    const char *zExtra
) {
    sqlite3 *db = pData->db;
    if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ) {
        if( zObj==0 ) zObj = "?";
        sqlite3SetString(pData->pzErrMsg, db,
                         "malformed database schema (%s)", zObj);
        if( zExtra ) {
            *pData->pzErrMsg = sqlite3MAppendf(db, *pData->pzErrMsg,
                                               "%s - %s", *pData->pzErrMsg, zExtra);
        }
    }
    pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT;
}