aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/connection.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/sqlite/connection.hxx')
-rw-r--r--odb/sqlite/connection.hxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx
index e487e6b..c1133eb 100644
--- a/odb/sqlite/connection.hxx
+++ b/odb/sqlite/connection.hxx
@@ -21,6 +21,8 @@
#include <odb/sqlite/version.hxx>
#include <odb/sqlite/forward.hxx>
#include <odb/sqlite/transaction-impl.hxx>
+#include <odb/sqlite/auto-handle.hxx>
+
#include <odb/sqlite/details/export.hxx>
namespace odb
@@ -102,7 +104,12 @@ namespace odb
private:
database_type& db_;
- sqlite3* handle_;
+ auto_handle<sqlite3> handle_;
+
+ // Keep statement_cache_ after handle_ so that it is destroyed before
+ // the connection is closed.
+ //
+ std::auto_ptr<statement_cache_type> statement_cache_;
// Unlock notification machinery.
//
@@ -120,8 +127,6 @@ namespace odb
private:
friend class statement;
statement* statements_;
-
- std::auto_ptr<statement_cache_type> statement_cache_;
};
}
}