From 653219faa1ef0940851cfa1ad4cf73a39ce0e714 Mon Sep 17 00:00:00 2001 From: detule Date: Wed, 17 Jan 2024 12:34:32 +0000 Subject: [PATCH 1/3] odbc_result/connection: better reference accounting --- src/odbc_connection.h | 1 + src/odbc_result.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/odbc_connection.h b/src/odbc_connection.h index 1e623099..4598671e 100644 --- a/src/odbc_connection.h +++ b/src/odbc_connection.h @@ -18,6 +18,7 @@ class odbc_result; class odbc_connection { public: + friend odbc_result; odbc_connection( std::string connection_string, std::string timezone = "UTC", diff --git a/src/odbc_result.cpp b/src/odbc_result.cpp index e1fe23d8..b7518ab6 100644 --- a/src/odbc_result.cpp +++ b/src/odbc_result.cpp @@ -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; }; } } From 127dbf835f13f3270374a6db03d7a9fe10564c4f Mon Sep 17 00:00:00 2001 From: detule Date: Wed, 17 Jan 2024 12:38:40 +0000 Subject: [PATCH 2/3] update NEWS --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 1167c06e..8966b6b5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # odbc (development version) +* freetds: Fix regression when executing multiple queries + (@detule, #731) + * Oracle: Fix checking for existence when identifier components contain underscores (@detule, #712). From a6f3936d551882ed084ee5bb0e18149ff1748911 Mon Sep 17 00:00:00 2001 From: detule Date: Wed, 17 Jan 2024 15:50:54 -0500 Subject: [PATCH 3/3] Update NEWS.md Co-authored-by: Simon P. Couch --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 8966b6b5..bcf826bf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,7 @@ # odbc (development version) * freetds: Fix regression when executing multiple queries - (@detule, #731) + (@detule, #731). * Oracle: Fix checking for existence when identifier components contain underscores (@detule, #712).