mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Modify [2ad1461f25] to avoid leaving a prepared statement in "active" state following an OOM error in FTS3.
FossilOrigin-Name: 69c21ee46aeeb624fd8638b17ff7259a3e5f9a46
This commit is contained in:
@ -1557,14 +1557,23 @@ static int fts3TermSelect(
|
||||
*/
|
||||
rc = sqlite3Fts3SegReaderNew(p, iAge, 0, 0, 0, zRoot, nRoot, &pNew);
|
||||
}else{
|
||||
sqlite3_int64 i1;
|
||||
int rc2; /* Return value of sqlite3Fts3ReadBlock() */
|
||||
sqlite3_int64 i1; /* Blockid of leaf that may contain zTerm */
|
||||
rc = fts3SelectLeaf(p, zTerm, nTerm, zRoot, nRoot, &i1);
|
||||
if( rc==SQLITE_OK ){
|
||||
sqlite3_int64 i2 = sqlite3_column_int64(pStmt, 2);
|
||||
rc = sqlite3Fts3SegReaderNew(p, iAge, i1, i2, 0, 0, 0, &pNew);
|
||||
}
|
||||
|
||||
/* The following call to ReadBlock() serves to reset the SQL statement
|
||||
** used to retrieve blocks of data from the %_segments table. If it is
|
||||
** not reset here, then it may remain classified as an active statement
|
||||
** by SQLite, which may lead to "DROP TABLE" or "DETACH" commands
|
||||
** failing.
|
||||
*/
|
||||
rc2 = sqlite3Fts3ReadBlock(p, 0, 0, 0);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3Fts3ReadBlock(p, 0, 0, 0);
|
||||
rc = rc2;
|
||||
}
|
||||
}
|
||||
iAge++;
|
||||
|
Reference in New Issue
Block a user