From 4b467e6a914a8930b83f6483a072e7c9584a4ff5 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 3 Jun 2015 23:07:57 +0200 Subject: DB::Snapshot::bad() should only return true in case of errors --- src/sqlite3_db.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sqlite3_db.cc b/src/sqlite3_db.cc index d1f0e1b..18399f4 100644 --- a/src/sqlite3_db.cc +++ b/src/sqlite3_db.cc @@ -321,7 +321,8 @@ public: class SnapshotImpl : public Snapshot { public: - SnapshotImpl(unique_stmt& stmt) { + SnapshotImpl(unique_stmt& stmt) + : bad_(false) { stmt_.swap(stmt); } bool get(const std::string& name, std::string* value) override { @@ -438,6 +439,7 @@ public: case SQLITE_ROW: return true; default: + bad_ = true; stmt_.reset(); return false; } @@ -445,7 +447,7 @@ public: } bool bad() override { - return !stmt_; + return bad_; } private: @@ -469,6 +471,7 @@ public: #endif unique_stmt stmt_; + bool bad_; }; std::string compile(const Condition& condition) { -- cgit v1.2.3-70-g09d2