From 4d828fe6b1caf9febeb77dab3ced4d36261d7bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Sat, 27 Apr 2013 13:14:51 +0200 Subject: [PATCH] Fixed two SQLiteC++ Coverity Issues in Database::execAndGet() and Database::tableExists() - adding a (void) cast in front of query.executeStep() - adding comments explaining how errors are handled in this thow methods Thank you to Donald Jones and Mark Pashley of Ubiquisys for reporting this to me. --- src/Database.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Database.cpp b/src/Database.cpp index eccb9ec..84c6cc4 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -59,7 +59,7 @@ int Database::exec(const char* apQueries) // throw(SQLite::Exception); Column Database::execAndGet(const char* apQuery) // throw(SQLite::Exception) { Statement query(*this, apQuery); - query.executeStep(); + (void)query.executeStep(); // Can return false if no result, which will throw next line in getColumn() return query.getColumn(0); } @@ -68,7 +68,7 @@ bool Database::tableExists(const char* apTableName) // throw(SQLite::Exception) { Statement query(*this, "SELECT count(*) FROM sqlite_master WHERE type='table' AND name=?"); query.bind(1, apTableName); - query.executeStep(); + (void)query.executeStep(); // Cannot return false, as the above query always return a result int Nb = query.getColumn(0); return (1 == Nb); }