summaryrefslogtreecommitdiff
path: root/tagstats/sqlite.hpp
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2015-02-26 15:41:23 +0100
committerJochen Topf <jochen@topf.org>2015-02-26 15:41:23 +0100
commit4a2073856b3ca10b61c158a12cc36aaaf8842f46 (patch)
tree5a31a736950594e3e66fe1586b3677d5d9fdbc52 /tagstats/sqlite.hpp
parent0ebe372964cdbb3a1caec14699bdcb0c43c0eafe (diff)
downloadtaginfo-4a2073856b3ca10b61c158a12cc36aaaf8842f46.tar
taginfo-4a2073856b3ca10b61c158a12cc36aaaf8842f46.tar.gz
Add similarity program to check for similar keys.
This adds the 'similarity' program that checks for similar keys in the taginfo-db database. It is not run yet by the update script, but the supporting database tables etc. are added by this commit.
Diffstat (limited to 'tagstats/sqlite.hpp')
-rw-r--r--tagstats/sqlite.hpp11
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());