diff options
author | louiz’ <louiz@louiz.org> | 2017-06-14 00:04:00 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-06-14 00:19:15 +0200 |
commit | 9defd0ccb75b1905c308ed0437e5ccd479e3a7b8 (patch) | |
tree | 7726599198a59da5ffc486d35a372a77c6fd87aa /src/database/count_query.hpp | |
parent | 41c23aab37905a97007d095c3997a0d0a9dfddda (diff) | |
download | biboumi-9defd0ccb75b1905c308ed0437e5ccd479e3a7b8.tar.gz biboumi-9defd0ccb75b1905c308ed0437e5ccd479e3a7b8.tar.bz2 biboumi-9defd0ccb75b1905c308ed0437e5ccd479e3a7b8.tar.xz biboumi-9defd0ccb75b1905c308ed0437e5ccd479e3a7b8.zip |
Add a Statement class to manage the sqlite3_stmt objects and avoid leaks
Diffstat (limited to 'src/database/count_query.hpp')
-rw-r--r-- | src/database/count_query.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database/count_query.hpp b/src/database/count_query.hpp index 863fad1..322ad1b 100644 --- a/src/database/count_query.hpp +++ b/src/database/count_query.hpp @@ -19,14 +19,14 @@ struct CountQuery: public Query { auto statement = this->prepare(db); std::size_t res = 0; - if (sqlite3_step(statement) == SQLITE_ROW) - res = sqlite3_column_int64(statement, 0); + if (sqlite3_step(statement.get()) == SQLITE_ROW) + res = sqlite3_column_int64(statement.get(), 0); else { log_error("Count request didn’t return a result"); return 0; } - if (sqlite3_step(statement) != SQLITE_DONE) + if (sqlite3_step(statement.get()) != SQLITE_DONE) log_warning("Count request returned more than one result."); log_debug("Returning count: ", res); |