diff options
-rw-r--r-- | src/database-sqlite3.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/database-sqlite3.cpp b/src/database-sqlite3.cpp index 07df976d4..095d485c0 100644 --- a/src/database-sqlite3.cpp +++ b/src/database-sqlite3.cpp @@ -56,8 +56,14 @@ SQLite format specification: SQLOK(sqlite3_prepare_v2(m_database, query, -1, &m_stmt_##name, NULL),\ "Failed to prepare query '" query "'") -#define FINALIZE_STATEMENT(statement) \ - SQLOK(sqlite3_finalize(statement), "Failed to finalize " #statement) +#define SQLOK_ERRSTREAM(s, m) \ + if ((s) != SQLITE_OK) { \ + errorstream << (m) << ": " \ + << sqlite3_errmsg(m_database) << std::endl; \ + } + +#define FINALIZE_STATEMENT(statement) SQLOK_ERRSTREAM(sqlite3_finalize(statement), \ + "Failed to finalize " #statement) int Database_SQLite3::busyHandler(void *data, int count) { @@ -289,6 +295,6 @@ Database_SQLite3::~Database_SQLite3() FINALIZE_STATEMENT(m_stmt_end) FINALIZE_STATEMENT(m_stmt_delete) - SQLOK(sqlite3_close(m_database), "Failed to close database"); + SQLOK_ERRSTREAM(sqlite3_close(m_database), "Failed to close database"); } |