mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-08 14:48:32 -04:00
DBD::SQLite: previous disconnect procedure doesn't work properly as it doesn't take several things into account. it seems better to fix other parts that start to break again...
This commit is contained in:
parent
6c8539ef43
commit
e4ccb21f9c
1 changed files with 17 additions and 3 deletions
20
dbdimp.c
20
dbdimp.c
|
@ -155,14 +155,28 @@ sqlite_db_disconnect(SV *dbh, imp_dbh_t *imp_dbh)
|
|||
sqlite_db_rollback(dbh, imp_dbh);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
** This cause segfaults when we have virtual tables, as sqlite3 seems
|
||||
** to try to finalize the statements for the tables (freed here) while
|
||||
** closing. So we need to find other ways to do the right thing.
|
||||
*/
|
||||
while ( (pStmt = sqlite3_next_stmt(imp_dbh->db, 0)) != NULL ) {
|
||||
sqlite3_finalize(pStmt);
|
||||
}
|
||||
#endif
|
||||
|
||||
rc = sqlite3_close(imp_dbh->db);
|
||||
if (rc == SQLITE_BUSY) {
|
||||
/* active statements! */
|
||||
warn("closing dbh with active statement handles");
|
||||
if (rc != SQLITE_OK) {
|
||||
/*
|
||||
** "closing dbh with ..." message is not always true.
|
||||
** (SQLITE_BUSY may occur due to the unfinished backup operation)
|
||||
** We may need to wait for a while if we get SQLITE_BUSY.
|
||||
** XXX: Putting "warn" here is just for the debugging purpose.
|
||||
*/
|
||||
warn((char*)sqlite3_errmsg(imp_dbh->db));
|
||||
sqlite_error(dbh, imp_dbh, rc, (char*)sqlite3_errmsg(imp_dbh->db));
|
||||
/* warn("closing dbh with active statement handles"); */
|
||||
}
|
||||
imp_dbh->db = NULL;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue