From 22d8504b99a6d7115b9353543ba138be0f3bc917 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 29 Apr 2021 18:35:00 +0200 Subject: Use new prepared_query_impl::verify_connection() in execute_query() --- odb/relational/source.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/odb/relational/source.cxx b/odb/relational/source.cxx index 20c431a..62a8b0e 100644 --- a/odb/relational/source.cxx +++ b/odb/relational/source.cxx @@ -4363,16 +4363,15 @@ traverse_object (type& c) << "static_cast (pq.stmt.get ())));" << endl; - os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + os << db << "::transaction& tr (" << db << "::transaction::current ());" << endl << "// The connection used by the current transaction and the" << endl << "// one used to prepare this statement must be the same." << endl << "//" << endl - << "assert (&conn == &st->connection ());" + << "assert (q.verify_connection (tr));" << endl << "statements_type& sts (" << endl - << "conn.statement_cache ().find_object ());"; + << "st->connection ().statement_cache ().find_object ());"; if (versioned) os << "const schema_version_migration& svm (" << @@ -5662,16 +5661,15 @@ traverse_view (type& c) << "static_cast (pq.stmt.get ())));" << endl; - os << db << "::connection& conn (" << endl - << db << "::transaction::current ().connection ());" + os << db << "::transaction& tr (" << db << "::transaction::current ());" << endl << "// The connection used by the current transaction and the" << endl << "// one used to prepare this statement must be the same." << endl << "//" << endl - << "assert (&conn == &st->connection ());" + << "assert (q.verify_connection (tr));" << endl << "statements_type& sts (" << endl - << "conn.statement_cache ().find_view ());"; + << "st->connection ().statement_cache ().find_view ());"; if (versioned) os << "const schema_version_migration& svm (" << -- cgit v1.1