mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Add the xIntegrity method to the sqlite3_module object. Implement this
method in RTREE, FTS3/4, and FTS5 so that "PRAGMA integrity_check" also verifies the correctness of shadow tables associated with those virtual tables. FossilOrigin-Name: 17bede8cdefd968210dd8a5a2617acbe12ba2c99fdd5e88c5def8665e7bec2d7
This commit is contained in:
36
src/vdbe.c
36
src/vdbe.c
@@ -8128,6 +8128,42 @@ case OP_VOpen: { /* ncycle */
|
||||
}
|
||||
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
/* Opcode: VCheck * P2 * P4 *
|
||||
**
|
||||
** P4 is a pointer to a Table object that is a virtual table that
|
||||
** supports the xIntegrity() method. This opcode runs the xIntegrity()
|
||||
** method for that virtual table. If an error is reported back, the error
|
||||
** message is stored in register P2. If no errors are seen, register P2
|
||||
** is set to NULL.
|
||||
*/
|
||||
case OP_VCheck: { /* out2 */
|
||||
Table *pTab;
|
||||
sqlite3_vtab *pVtab;
|
||||
const sqlite3_module *pModule;
|
||||
char *zErr;
|
||||
|
||||
pOut = &aMem[pOp->p2];
|
||||
sqlite3VdbeMemSetNull(pOut); /* Innocent until proven guilty */
|
||||
assert( pOp->p4type==P4_TABLE );
|
||||
pTab = pOp->p4.pTab;
|
||||
assert( pTab!=0 );
|
||||
assert( IsVirtual(pTab) );
|
||||
assert( pTab->u.vtab.p!=0 );
|
||||
pVtab = pTab->u.vtab.p->pVtab;
|
||||
assert( pVtab!=0 );
|
||||
pModule = pVtab->pModule;
|
||||
assert( pModule!=0 );
|
||||
assert( pModule->iVersion>=4 );
|
||||
assert( pModule->xIntegrity!=0 );
|
||||
zErr = pModule->xIntegrity(pVtab);
|
||||
if( zErr ){
|
||||
sqlite3VdbeMemSetStr(pOut, zErr, -1, SQLITE_UTF8, sqlite3_free);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
/* Opcode: VInitIn P1 P2 P3 * *
|
||||
** Synopsis: r[P2]=ValueList(P1,P3)
|
||||
|
Reference in New Issue
Block a user