diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2015-06-03 23:07:57 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2015-06-03 23:07:57 +0200 |
| commit | 4b467e6a914a8930b83f6483a072e7c9584a4ff5 (patch) | |
| tree | 457ad1a52192500fda74470ab4f768b2927cfc40 /src/sqlite3_db.cc | |
| parent | c9c45371e8eb4f500593a089a6087a26649e0456 (diff) | |
DB::Snapshot::bad() should only return true in case of errors
Diffstat (limited to 'src/sqlite3_db.cc')
| -rw-r--r-- | src/sqlite3_db.cc | 7 |
1 files changed, 5 insertions, 2 deletions
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) { |
