11 public function __construct(&$oDB)
16 public function status()
19 throw new Exception('No database', 700);
23 $this->oDB->connect();
24 } catch (\Nominatim\DatabaseError $e) {
25 throw new Exception('Database connection failed', 700);
28 $sStandardWord = $this->oDB->getOne("SELECT make_standard_name('a')");
29 if ($sStandardWord === false) {
30 throw new Exception('Module failed', 701);
33 if ($sStandardWord != 'a') {
34 throw new Exception('Module call failed', 702);
37 $sSQL = 'SELECT word_id, word_token, word, class, type, country_code, ';
38 $sSQL .= "operator, search_name_count FROM word WHERE word_token IN (' a')";
39 $iWordID = $this->oDB->getOne($sSQL);
40 if ($iWordID === false) {
41 throw new Exception('Query failed', 703);
44 throw new Exception('No value', 704);
48 public function dataDate()
50 $sSQL = 'SELECT EXTRACT(EPOCH FROM lastimportdate) FROM import_status LIMIT 1';
51 $iDataDateEpoch = $this->oDB->getOne($sSQL);
53 if ($iDataDateEpoch === false) {
54 throw Exception('Data date query failed '.$iDataDateEpoch->getMessage(), 705);
57 return $iDataDateEpoch;