aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-04-29 18:36:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-04-29 18:37:38 +0200
commitd4be234991f2a2e6abd8b2c0d585eb4ae6216979 (patch)
tree530b4abd13508080e632d542b75ecb06a5a42f70
parenta74741210f2224b6ec3e06d9ee198caff519beb1 (diff)
Add prepared_query_impl::verify_connection()
-rw-r--r--odb/prepared-query.cxx7
-rw-r--r--odb/prepared-query.hxx6
2 files changed, 13 insertions, 0 deletions
diff --git a/odb/prepared-query.cxx b/odb/prepared-query.cxx
index 65779aa..70bcaa1 100644
--- a/odb/prepared-query.cxx
+++ b/odb/prepared-query.cxx
@@ -2,6 +2,7 @@
// license : GNU GPL v2; see accompanying LICENSE file
#include <odb/connection.hxx>
+#include <odb/transaction.hxx>
#include <odb/prepared-query.hxx>
namespace odb
@@ -26,6 +27,12 @@ namespace odb
next_->prev_ = this;
}
+ bool prepared_query_impl::
+ verify_connection (transaction& t)
+ {
+ return &t.connection () == &stmt->connection ();
+ }
+
void prepared_query_impl::
list_remove ()
{
diff --git a/odb/prepared-query.hxx b/odb/prepared-query.hxx
index 37d2b76..7cac6da 100644
--- a/odb/prepared-query.hxx
+++ b/odb/prepared-query.hxx
@@ -24,6 +24,12 @@ namespace odb
prepared_query_impl (connection&);
+ // Verify this prepared query and the specified transaction use the
+ // same connection.
+ //
+ virtual bool
+ verify_connection (transaction&);
+
bool cached;
connection& conn;
const char* name;