mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-08 22:58:17 -04:00
DBD-SQLite: restored the previous effort r5858 removed by mistake
This commit is contained in:
parent
9c456f6082
commit
4ceceb07f1
1 changed files with 12 additions and 1 deletions
11
dbdimp.c
11
dbdimp.c
|
@ -144,12 +144,17 @@ int
|
||||||
sqlite_db_disconnect (SV *dbh, imp_dbh_t *imp_dbh)
|
sqlite_db_disconnect (SV *dbh, imp_dbh_t *imp_dbh)
|
||||||
{
|
{
|
||||||
dTHR;
|
dTHR;
|
||||||
|
sqlite3_stmt *pStmt;
|
||||||
DBIc_ACTIVE_off(imp_dbh);
|
DBIc_ACTIVE_off(imp_dbh);
|
||||||
|
|
||||||
if (DBIc_is(imp_dbh, DBIcf_AutoCommit) == FALSE) {
|
if (DBIc_is(imp_dbh, DBIcf_AutoCommit) == FALSE) {
|
||||||
sqlite_db_rollback(dbh, imp_dbh);
|
sqlite_db_rollback(dbh, imp_dbh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while ( (pStmt = sqlite3_next_stmt(imp_dbh->db, 0))!=0 ) {
|
||||||
|
sqlite3_finalize(pStmt);
|
||||||
|
}
|
||||||
|
|
||||||
if (sqlite3_close(imp_dbh->db) == SQLITE_BUSY) {
|
if (sqlite3_close(imp_dbh->db) == SQLITE_BUSY) {
|
||||||
/* active statements! */
|
/* active statements! */
|
||||||
warn("closing dbh with active statement handles");
|
warn("closing dbh with active statement handles");
|
||||||
|
@ -157,9 +162,11 @@ sqlite_db_disconnect (SV *dbh, imp_dbh_t *imp_dbh)
|
||||||
imp_dbh->db = NULL;
|
imp_dbh->db = NULL;
|
||||||
|
|
||||||
av_undef(imp_dbh->functions);
|
av_undef(imp_dbh->functions);
|
||||||
|
SvREFCNT_dec(imp_dbh->functions);
|
||||||
imp_dbh->functions = (AV *)NULL;
|
imp_dbh->functions = (AV *)NULL;
|
||||||
|
|
||||||
av_undef(imp_dbh->aggregates);
|
av_undef(imp_dbh->aggregates);
|
||||||
|
SvREFCNT_dec(imp_dbh->aggregates);
|
||||||
imp_dbh->aggregates = (AV *)NULL;
|
imp_dbh->aggregates = (AV *)NULL;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -605,9 +612,13 @@ sqlite_st_finish3 (SV *sth, imp_sth_t *imp_sth, int is_destroy)
|
||||||
void
|
void
|
||||||
sqlite_st_destroy (SV *sth, imp_sth_t *imp_sth)
|
sqlite_st_destroy (SV *sth, imp_sth_t *imp_sth)
|
||||||
{
|
{
|
||||||
|
D_imp_dbh_from_sth;
|
||||||
/* warn("destroy statement: %s\n", imp_sth->statement); */
|
/* warn("destroy statement: %s\n", imp_sth->statement); */
|
||||||
DBIc_ACTIVE_off(imp_sth);
|
DBIc_ACTIVE_off(imp_sth);
|
||||||
|
if (DBIc_ACTIVE(imp_dbh)) {
|
||||||
|
/* finalize sth when active connection */
|
||||||
sqlite3_finalize(imp_sth->stmt);
|
sqlite3_finalize(imp_sth->stmt);
|
||||||
|
}
|
||||||
Safefree(imp_sth->statement);
|
Safefree(imp_sth->statement);
|
||||||
SvREFCNT_dec((SV*)imp_sth->params);
|
SvREFCNT_dec((SV*)imp_sth->params);
|
||||||
SvREFCNT_dec((SV*)imp_sth->col_types);
|
SvREFCNT_dec((SV*)imp_sth->col_types);
|
||||||
|
|
Loading…
Add table
Reference in a new issue