diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-09-27 21:40:52 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-09-27 21:40:52 -0400 |
commit | 38c17f093615a16a4b4ec6dc2b5d3edb5c1d3895 (patch) | |
tree | 8da5a3d0eacf5e2fd04c33f57d592e4c1ca303ad /lib/notion.cpp | |
parent | 3a8bfa95a5df04d97f05545d5bb8df5f3c3f96a3 (diff) | |
download | verbly-38c17f093615a16a4b4ec6dc2b5d3edb5c1d3895.tar.gz verbly-38c17f093615a16a4b4ec6dc2b5d3edb5c1d3895.tar.bz2 verbly-38c17f093615a16a4b4ec6dc2b5d3edb5c1d3895.zip |
More hkutil refactoring
All database access goes through hatkirby::database now. verbly::token, verbly::statement::condition, and verbly::part have been converted to use mpark::variant now. verbly::binding has been deleted, and replaced with a mpark::variant typedef in statement.h. This means that the only remaining tagged union class is verbly::generator::part. refs #5
Diffstat (limited to 'lib/notion.cpp')
-rw-r--r-- | lib/notion.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/notion.cpp b/lib/notion.cpp index c227b46..733c852 100644 --- a/lib/notion.cpp +++ b/lib/notion.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "notion.h" | 1 | #include "notion.h" |
2 | #include <sqlite3.h> | ||
3 | #include <sstream> | 2 | #include <sstream> |
3 | #include <hkutil/database.h> | ||
4 | 4 | ||
5 | namespace verbly { | 5 | namespace verbly { |
6 | 6 | ||
@@ -58,21 +58,21 @@ namespace verbly { | |||
58 | const field notion::preposition_group_field::isA = field::joinField(object::notion, "notion_id", "is_a"); | 58 | const field notion::preposition_group_field::isA = field::joinField(object::notion, "notion_id", "is_a"); |
59 | const field notion::preposition_group_field::groupNameField = field::stringField("is_a", "groupname"); | 59 | const field notion::preposition_group_field::groupNameField = field::stringField("is_a", "groupname"); |
60 | 60 | ||
61 | notion::notion(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) | 61 | notion::notion(const database& db, hatkirby::row row) : valid_(true) |
62 | { | 62 | { |
63 | id_ = sqlite3_column_int(row, 0); | 63 | id_ = mpark::get<int>(row[0]); |
64 | partOfSpeech_ = static_cast<part_of_speech>(sqlite3_column_int(row, 1)); | 64 | partOfSpeech_ = static_cast<part_of_speech>(mpark::get<int>(row[1])); |
65 | 65 | ||
66 | if (sqlite3_column_type(row, 2) != SQLITE_NULL) | 66 | if (!mpark::holds_alternative<std::nullptr_t>(row[2])) |
67 | { | 67 | { |
68 | hasWnid_ = true; | 68 | hasWnid_ = true; |
69 | wnid_ = sqlite3_column_int(row, 2); | 69 | wnid_ = mpark::get<int>(row[2]); |
70 | } | 70 | } |
71 | 71 | ||
72 | if (sqlite3_column_type(row, 3) != SQLITE_NULL) | 72 | if (!mpark::holds_alternative<std::nullptr_t>(row[3])) |
73 | { | 73 | { |
74 | hasNumOfImages_ = true; | 74 | hasNumOfImages_ = true; |
75 | numOfImages_ = sqlite3_column_int(row, 3); | 75 | numOfImages_ = mpark::get<int>(row[3]); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||