diff options
-rw-r--r-- | odb/sqlite/connection.cxx | 2 | ||||
-rw-r--r-- | odb/sqlite/connection.hxx | 3 | ||||
-rw-r--r-- | odb/sqlite/transaction-impl.cxx | 24 |
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 (); |