mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-01 06:27:03 +03:00
Change the xIntegrity virtual table method signature so that it returns
an integer error code and writes the error message into a parameter. FossilOrigin-Name: f1d4024a8ca06cf954aaf1f612684d1a5d28492bde757695db3f22c50c649709
This commit is contained in:
@ -3984,22 +3984,22 @@ static int fts3ShadowName(const char *zName){
|
||||
** Implementation of the xIntegrity() method on the FTS3/FTS4 virtual
|
||||
** table.
|
||||
*/
|
||||
static char *fts3Integrity(sqlite3_vtab *pVtab){
|
||||
static int fts3Integrity(sqlite3_vtab *pVtab, char **pzErr){
|
||||
Fts3Table *p = (Fts3Table*)pVtab;
|
||||
char *zSql;
|
||||
int rc;
|
||||
char *zErr = 0;
|
||||
|
||||
zSql = sqlite3_mprintf(
|
||||
"INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');",
|
||||
p->zDb, p->zName, p->zName);
|
||||
rc = sqlite3_exec(p->db, zSql, 0, 0, 0);
|
||||
sqlite3_free(zSql);
|
||||
if( rc ){
|
||||
zErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s",
|
||||
p->bFts4 ? 4 : 3, p->zDb, p->zName);
|
||||
if( (rc&0xff)==SQLITE_CORRUPT ){
|
||||
*pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s",
|
||||
p->bFts4 ? 4 : 3, p->zDb, p->zName);
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
return zErr;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2855,23 +2855,22 @@ static int fts5ShadowName(const char *zName){
|
||||
** if anything is found amiss. Return a NULL pointer if everything is
|
||||
** OK.
|
||||
*/
|
||||
static char *fts5Integrity(sqlite3_vtab *pVtab){
|
||||
static int fts5Integrity(sqlite3_vtab *pVtab, char **pzErr){
|
||||
Fts5FullTable *pTab = (Fts5FullTable*)pVtab;
|
||||
Fts5Config *pConfig = pTab->p.pConfig;
|
||||
char *zSql;
|
||||
int rc;
|
||||
char *zErr = 0;
|
||||
|
||||
zSql = sqlite3_mprintf(
|
||||
"INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');",
|
||||
pConfig->zDb, pConfig->zName, pConfig->zName);
|
||||
rc = sqlite3_exec(pConfig->db, zSql, 0, 0, 0);
|
||||
sqlite3_free(zSql);
|
||||
if( rc ){
|
||||
zErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s",
|
||||
pConfig->zDb, pConfig->zName);
|
||||
if( (rc&0xff)==SQLITE_CORRUPT ){
|
||||
*pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s",
|
||||
pConfig->zDb, pConfig->zName);
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
return zErr;
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
|
@ -3503,7 +3503,7 @@ static int rtreeShadowName(const char *zName){
|
||||
}
|
||||
|
||||
/* Forward declaration */
|
||||
static char *rtreeIntegrity(sqlite3_vtab*);
|
||||
static int rtreeIntegrity(sqlite3_vtab*, char**);
|
||||
|
||||
static sqlite3_module rtreeModule = {
|
||||
4, /* iVersion */
|
||||
@ -4367,21 +4367,15 @@ static int rtreeCheckTable(
|
||||
/*
|
||||
** Implementation of the xIntegrity method for Rtree.
|
||||
*/
|
||||
static char *rtreeIntegrity(sqlite3_vtab *pVtab){
|
||||
static int rtreeIntegrity(sqlite3_vtab *pVtab, char **pzErr){
|
||||
Rtree *pRtree = (Rtree*)pVtab;
|
||||
char *zErr = 0;
|
||||
int rc;
|
||||
|
||||
rc = rtreeCheckTable(pRtree->db, pRtree->zDb, pRtree->zName, &zErr);
|
||||
if( rc ){
|
||||
sqlite3_free(zErr);
|
||||
zErr = sqlite3_mprintf("error code %d while checking RTree %s.%s",
|
||||
rc, pRtree->zDb, pRtree->zName);
|
||||
}else if( zErr ){
|
||||
zErr = sqlite3_mprintf("In RTree %s.%s:\n%z",
|
||||
pRtree->zDb, pRtree->zName, zErr);
|
||||
rc = rtreeCheckTable(pRtree->db, pRtree->zDb, pRtree->zName, pzErr);
|
||||
if( rc==SQLITE_OK && *pzErr ){
|
||||
*pzErr = sqlite3_mprintf("In RTree %s.%s:\n%z",
|
||||
pRtree->zDb, pRtree->zName, *pzErr);
|
||||
}
|
||||
return zErr;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user