diff --git a/src/NodaDistinctlyTypedStrings.php b/src/NodaDistinctlyTypedStrings.php new file mode 100644 index 0000000..aef90f2 --- /dev/null +++ b/src/NodaDistinctlyTypedStrings.php @@ -0,0 +1,44 @@ +query_by_stmt("SELECT `type` + FROM `distinctly_typed_strings` + WHERE `input_string` = ? + AND `language` = ?", "ss", $search_term, $lang); + + if (!($cur = $result->fetch_row())) { + $result->close(); + return ''; + } + $result->close(); + + if (!in_array($cur[0], ['persinst', 'zeiten', 'orte', 'tag', ''], true)) { + throw new Exception("Distinctly typed string of unknown type: " . $cur[0]); + } + + return $cur[0]; + + } + +}