diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-30 16:10:02 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-30 16:10:02 +0200 |
commit | 1c1544f5297f88bbbcbbad2d21c4ec7b62bb9a28 (patch) | |
tree | 10db5dc702376bdc14777e1e7d2afbab0ce8dc10 /odb/sqlite/statement.hxx | |
parent | 8568cd25d943636e33ec00a935ad8a67d4876e14 (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/statement.hxx')
-rw-r--r-- | odb/sqlite/statement.hxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/odb/sqlite/statement.hxx b/odb/sqlite/statement.hxx index 5ddb56b..1d48cd4 100644 --- a/odb/sqlite/statement.hxx +++ b/odb/sqlite/statement.hxx @@ -20,6 +20,8 @@ #include <odb/sqlite/version.hxx> #include <odb/sqlite/binding.hxx> #include <odb/sqlite/connection.hxx> +#include <odb/sqlite/auto-handle.hxx> + #include <odb/sqlite/details/export.hxx> namespace odb @@ -131,19 +133,14 @@ namespace odb finilize () { list_remove (); - - if (stmt_ != 0) - { - sqlite3_finalize (stmt_); - stmt_ = 0; - } + stmt_.reset (); } protected: friend class connection; connection& conn_; - sqlite3_stmt* stmt_; + auto_handle<sqlite3_stmt> stmt_; bool active_; bool cached_; |