summary refs log tree commit diff stats
path: root/lib/word.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/word.cpp')
-rw-r--r--lib/word.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/word.cpp b/lib/word.cpp index 60657ba..2fccb9f 100644 --- a/lib/word.cpp +++ b/lib/word.cpp
@@ -44,7 +44,7 @@ namespace verbly {
44 return field::joinThroughWhere(object::word, "lemma_id", object::form, "lemmas_forms", "form_id", "category", static_cast<int>(category)); 44 return field::joinThroughWhere(object::word, "lemma_id", object::form, "lemmas_forms", "form_id", "category", static_cast<int>(category));
45 } 45 }
46 46
47 word::word(const database& db, hatkirby::row row) : db_(db), valid_(true) 47 word::word(const database& db, hatkirby::row row) : db_(&db), valid_(true)
48 { 48 {
49 id_ = mpark::get<int>(row[0]); 49 id_ = mpark::get<int>(row[0]);
50 50
@@ -104,7 +104,12 @@ namespace verbly {
104 104
105 void word::initializeForm(inflection infl) const 105 void word::initializeForm(inflection infl) const
106 { 106 {
107 forms_[infl] = db_.forms(form::words(infl) %= *this, verbly::form::id, -1).all(); 107 if (!db_)
108 {
109 throw std::domain_error("Database not present");
110 }
111
112 forms_[infl] = db_->forms(form::words(infl) %= *this, verbly::form::id, -1).all();
108 } 113 }
109 114
110 filter word::synonyms_field::operator%=(filter joinCondition) const 115 filter word::synonyms_field::operator%=(filter joinCondition) const