X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/e10d11c6c7a5a96f645b9155a55e56f874ed6042..15a1666f8a1e19c338015fccd502be6cfd5c24df:/lib/setup/AddressLevelParser.php diff --git a/lib/setup/AddressLevelParser.php b/lib/setup/AddressLevelParser.php index 5bc17d63..a399c955 100644 --- a/lib/setup/AddressLevelParser.php +++ b/lib/setup/AddressLevelParser.php @@ -9,7 +9,7 @@ class AddressLevelParser { private $aLevels; - public function __construct(string $sDescriptionFile) + public function __construct($sDescriptionFile) { $sJson = file_get_contents($sDescriptionFile); $this->aLevels = json_decode($sJson, true); @@ -53,21 +53,21 @@ class AddressLevelParser */ public function createTable($oDB, $sTable) { - chksql($oDB->query('DROP TABLE IF EXISTS '.$sTable)); + $oDB->exec('DROP TABLE IF EXISTS '.$sTable); $sSql = 'CREATE TABLE '.$sTable; $sSql .= '(country_code varchar(2), class TEXT, type TEXT,'; $sSql .= ' rank_search SMALLINT, rank_address SMALLINT)'; - chksql($oDB->query($sSql)); + $oDB->exec($sSql); - $sSql = 'CREATE UNIQUE INDEX ON '.$sTable.'(country_code, class, type)'; - chksql($oDB->query($sSql)); + $sSql = 'CREATE UNIQUE INDEX ON '.$sTable.' (country_code, class, type)'; + $oDB->exec($sSql); $sSql = 'INSERT INTO '.$sTable.' VALUES '; foreach ($this->aLevels as $aLevel) { $aCountries = array(); if (isset($aLevel['countries'])) { foreach ($aLevel['countries'] as $sCountry) { - $aCountries[$sCountry] = getDBQuoted($sCountry); + $aCountries[$sCountry] = $oDB->getDBQuoted($sCountry); } } else { $aCountries['NULL'] = 'NULL'; @@ -75,8 +75,8 @@ class AddressLevelParser foreach ($aLevel['tags'] as $sKey => $aValues) { foreach ($aValues as $sValue => $mRanks) { $aFields = array( - getDBQuoted($sKey), - $sValue ? getDBQuoted($sValue) : 'NULL' + $oDB->getDBQuoted($sKey), + $sValue ? $oDB->getDBQuoted($sValue) : 'NULL' ); if (is_array($mRanks)) { $aFields[] = (string) $mRanks[0]; @@ -93,6 +93,6 @@ class AddressLevelParser } } } - chksql($oDB->query(rtrim($sSql, ','))); + $oDB->exec(rtrim($sSql, ',')); } }