aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2023-10-25 10:37:11 +0000
committerdrh <>2023-10-25 10:37:11 +0000
commit9f20bde65a26e13b512ec521421c7b892ad6eadd (patch)
tree7bbba72db4a48670fa3eb5d40537bb8161717bda /src
parentf4154879ebb84fc0875d553e2de60d8ed4864da9 (diff)
downloadsqlite-9f20bde65a26e13b512ec521421c7b892ad6eadd.tar.gz
sqlite-9f20bde65a26e13b512ec521421c7b892ad6eadd.zip
Enhance the new xIntegrity method of the sqlite3_module object with new
parameters that provide the name of the table being checked and a flag to indicate a "quick_check". Based on feedback in [forum:/forumpost/965c0d02ea|forum post 965c0d02ea]. FossilOrigin-Name: bc8afa3f15954bb35f65dbf940bf069de5e14d333036676c24430cf17b658d05
Diffstat (limited to 'src')
-rw-r--r--src/pragma.c2
-rw-r--r--src/sqlite.h.in2
-rw-r--r--src/vdbe.c17
3 files changed, 12 insertions, 9 deletions
diff --git a/src/pragma.c b/src/pragma.c
index d310b83a3..90076b0c2 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -1778,7 +1778,7 @@ void sqlite3Pragma(
if( NEVER(pVTab->pModule==0) ) continue;
if( pVTab->pModule->iVersion<4 ) continue;
if( pVTab->pModule->xIntegrity==0 ) continue;
- sqlite3VdbeAddOp2(v, OP_VCheck, 0, 3);
+ sqlite3VdbeAddOp3(v, OP_VCheck, i, 3, isQuick);
sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
a1 = sqlite3VdbeAddOp1(v, OP_IsNull, 3); VdbeCoverage(v);
integrityCheckResultRow(v);
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 43a1d524d..f3db71dea 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -7277,7 +7277,7 @@ struct sqlite3_module {
int (*xShadowName)(const char*);
/* The methods above are in versions 1 through 3 of the sqlite_module object.
** Those below are for version 4 and greater. */
- int (*xIntegrity)(sqlite3_vtab *pVTab, char**);
+ int (*xIntegrity)(sqlite3_vtab *pVTab, const char*, const char*, int, char**);
};
/*
diff --git a/src/vdbe.c b/src/vdbe.c
index 3a5c70d69..221e8847d 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -8162,13 +8162,14 @@ case OP_VOpen: { /* ncycle */
#endif /* SQLITE_OMIT_VIRTUALTABLE */
#ifndef SQLITE_OMIT_VIRTUALTABLE
-/* Opcode: VCheck * P2 * P4 *
+/* Opcode: VCheck P1 P2 P3 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.
+** P4 is a pointer to a Table object that is a virtual table in schema P1
+** that supports the xIntegrity() method. This opcode runs the xIntegrity()
+** method for that virtual table, using P3 as the integer argument. If
+** an error is reported back, the table name is prepended to the error
+** message and that message is stored in P2. If no errors are seen,
+** register P2 is set to NULL.
*/
case OP_VCheck: { /* out2 */
Table *pTab;
@@ -8191,7 +8192,9 @@ case OP_VCheck: { /* out2 */
assert( pModule->xIntegrity!=0 );
pTab->nTabRef++;
sqlite3VtabLock(pTab->u.vtab.p);
- rc = pModule->xIntegrity(pVtab, &zErr);
+ assert( pOp->p1>=0 && pOp->p1<db->nDb );
+ rc = pModule->xIntegrity(pVtab, db->aDb[pOp->p1].zDbSName, pTab->zName,
+ pOp->p3, &zErr);
sqlite3VtabUnlock(pTab->u.vtab.p);
sqlite3DeleteTable(db, pTab);
if( rc ){