From 1c1544f5297f88bbbcbbad2d21c4ec7b62bb9a28 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 30 Aug 2011 16:10:02 +0200 Subject: 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. --- odb/sqlite/statement.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'odb/sqlite/statement.cxx') 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 (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; -- cgit v1.1