1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

The rtreecheck() SQL function should not invoke BEGIN or COMMIT as this

causes issues for statement transactions.

FossilOrigin-Name: b7b2e30b570efda338c62e88446dedb6667640f33855b2422ad20c7b569b025a
This commit is contained in:
drh
2023-10-14 17:14:53 +00:00
parent c84a0b2195
commit 153790d9ae
4 changed files with 19 additions and 22 deletions

View File

@@ -4132,7 +4132,6 @@ static int rtreeCheckTable(
){
RtreeCheck check; /* Common context for various routines */
sqlite3_stmt *pStmt = 0; /* Used to find column count of rtree table */
int bEnd = 0; /* True if transaction should be closed */
int nAux = 0; /* Number of extra columns. */
/* Initialize the context object */
@@ -4141,14 +4140,6 @@ static int rtreeCheckTable(
check.zDb = zDb;
check.zTab = zTab;
/* If there is not already an open transaction, open one now. This is
** to ensure that the queries run as part of this integrity-check operate
** on a consistent snapshot. */
if( sqlite3_get_autocommit(db) ){
check.rc = sqlite3_exec(db, "BEGIN", 0, 0, 0);
bEnd = 1;
}
/* Find the number of auxiliary columns */
if( check.rc==SQLITE_OK ){
pStmt = rtreeCheckPrepare(&check, "SELECT * FROM %Q.'%q_rowid'", zDb, zTab);
@@ -4189,11 +4180,6 @@ static int rtreeCheckTable(
sqlite3_finalize(check.aCheckMapping[0]);
sqlite3_finalize(check.aCheckMapping[1]);
/* If one was opened, close the transaction */
if( bEnd ){
int rc = sqlite3_exec(db, "END", 0, 0, 0);
if( check.rc==SQLITE_OK ) check.rc = rc;
}
*pzReport = check.zReport;
return check.rc;
}