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.cxx | |
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.cxx')
-rw-r--r-- | odb/sqlite/statement.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/odb/sqlite/statement.cxx b/odb/sqlite/statement.cxx index 0fe52f3..d0020d5 100644 --- a/odb/sqlite/statement.cxx +++ b/odb/sqlite/statement.cxx @@ -31,10 +31,11 @@ namespace odb init (const char* s, std::size_t n) { int e; + sqlite3_stmt* stmt (0); while ((e = sqlite3_prepare_v2 (conn_.handle (), s, static_cast<int> (n), - &stmt_, + &stmt, 0)) == SQLITE_LOCKED) { conn_.wait (); @@ -43,6 +44,8 @@ namespace odb if (e != SQLITE_OK) translate_error (e, conn_); + stmt_.reset (stmt); + active_ = false; cached_ = false; |