aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/connection.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-30 16:10:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-30 16:10:02 +0200
commit1c1544f5297f88bbbcbbad2d21c4ec7b62bb9a28 (patch)
tree10db5dc702376bdc14777e1e7d2afbab0ce8dc10 /odb/sqlite/connection.hxx
parent8568cd25d943636e33ec00a935ad8a67d4876e14 (diff)
Implement uniform handle management across all databases
Also use the auto_handle template instead of the raw handle in connection, statement, and result classes. This removes a lot of brittle "exception safety guarantee" code that we had in those classes.
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_;
};
}
}