aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-04-29 09:13:01 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-04-30 10:07:08 +0200
commit344fd3309516aaa7faa8d0b91511ed868a5d60a4 (patch)
tree1c75868f6afa68958e5ac446e8f68f2e278a4735
parent79cb2f05559e1ed9e724efd4f5dbceca794e7162 (diff)
Move call to connection::invalidate_results() to clear()
-rw-r--r--odb/sqlite/connection.cxx2
-rw-r--r--odb/sqlite/connection.hxx3
-rw-r--r--odb/sqlite/transaction-impl.cxx24
3 files changed, 11 insertions, 18 deletions
diff --git a/odb/sqlite/connection.cxx b/odb/sqlite/connection.cxx
index a807949..c9e5d75 100644
--- a/odb/sqlite/connection.cxx
+++ b/odb/sqlite/connection.cxx
@@ -185,6 +185,8 @@ namespace odb
void connection::
clear ()
{
+ invalidate_results ();
+
// The current first active_object will remove itself from the list
// and make the second object (if any) the new first.
//
diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx
index 5bc95c6..783ef5b 100644
--- a/odb/sqlite/connection.hxx
+++ b/odb/sqlite/connection.hxx
@@ -156,7 +156,8 @@ namespace odb
wait ();
public:
- // Reset active statements.
+ // Reset active statements. Also invalidates query results by first
+ // calling invalidate_results().
//
void
clear ();
diff --git a/odb/sqlite/transaction-impl.cxx b/odb/sqlite/transaction-impl.cxx
index 315af70..b1b83c8 100644
--- a/odb/sqlite/transaction-impl.cxx
+++ b/odb/sqlite/transaction-impl.cxx
@@ -95,15 +95,12 @@ namespace odb
void transaction_impl::
commit ()
{
- // Invalidate query results.
+ // Invalidate query results and reset active statements.
//
- connection_->invalidate_results ();
-
- // Reset active statements. Active statements will prevent COMMIT
- // from completing (write statements) or releasing the locks (read
- // statements). Normally, a statement is automatically reset on
- // completion, however, if an exception is thrown, that may not
- // happen.
+ // Active statements will prevent COMMIT from completing (write
+ // statements) or releasing the locks (read statements). Normally, a
+ // statement is automatically reset on completion, however, if an
+ // exception is thrown, that may not happen.
//
connection_->clear ();
@@ -121,15 +118,8 @@ namespace odb
void transaction_impl::
rollback ()
{
- // Invalidate query results.
- //
- connection_->invalidate_results ();
-
- // Reset active statements. Active statements will prevent ROLLBACK
- // from completing (write statements) or releasing the locks (read
- // statements). Normally, a statement is automatically reset on
- // completion, however, if an exception is thrown, that may not
- // happen.
+ // Invalidate query results and reset active statements (the same
+ // reasoning as in commit()).
//
connection_->clear ();