1
0
Fork 0
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:
Kenichi Ishigaki 2009-10-19 07:05:44 +00:00
parent 6c8539ef43
commit e4ccb21f9c

View file

@ -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;