diff options
Diffstat (limited to 'tagstats/sqlite.hpp')
-rw-r--r-- | tagstats/sqlite.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tagstats/sqlite.hpp b/tagstats/sqlite.hpp index 45dd2e2..8860fbf 100644 --- a/tagstats/sqlite.hpp +++ b/tagstats/sqlite.hpp @@ -196,6 +196,17 @@ namespace Sqlite { return std::string(textptr); } + const char* get_string(int column) { + if (column >= column_count()) { + throw Sqlite::Exception("Column larger than max columns", ""); + } + const char* textptr = reinterpret_cast<const char*>(sqlite3_column_text(m_statement, column)); + if (!textptr) { + throw Sqlite::Exception("Error reading text column", m_db.errmsg()); + } + return textptr; + } + int get_int(int column) { if (column >= column_count()) { throw Sqlite::Exception("Column larger than max columns", m_db.errmsg()); |