Skip to content

Commit

Permalink
odbc_result/connection: better reference accounting (#731)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Simon P. Couch <simonpatrickcouch@gmail.com>
  • Loading branch information
detule and simonpcouch committed Jan 20, 2024
1 parent e2b2eaa commit 11d48a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# odbc (development version)

* freetds: Fix regression when executing multiple queries
(@detule, #731).

* `dbAppendTable()` Improve performance by checking existence once (#691).

* Teradata: Fix usage of `exact` argument in internal methods
Expand Down
1 change: 1 addition & 0 deletions src/odbc_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class odbc_result;

class odbc_connection {
public:
friend odbc_result;
odbc_connection(
std::string connection_string,
std::string timezone = "UTC",
Expand Down
6 changes: 6 additions & 0 deletions src/odbc_result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ odbc_result::~odbc_result() {
try {
c_->set_current_result(nullptr);
} catch (...) {
// SQLCancel may throw an error.
// Regardless, as this object is
// getting destroyed, we need to
// make sure the connection is not
// holding onto an invalid reference
c_->current_result_ = nullptr;
};
}
}
Expand Down

0 comments on commit 11d48a3

Please sign in to comment.