]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/PlaceLookup.php
Merge pull request #1478 from tbertels/patch-1
[nominatim.git] / lib / PlaceLookup.php
index c5aea5887c6cfe59ebcdc1ee27c2e64d0e891e79..fce4970158a9395a6c22301fcae70d6ece185398 100644 (file)
@@ -163,8 +163,8 @@ class PlaceLookup
 
     public function lookupOSMID($sType, $iID)
     {
-        $sSQL = "select place_id from placex where osm_type = '".$sType."' and osm_id = ".$iID;
-        $iPlaceID = chksql($this->oDB->getOne($sSQL));
+        $sSQL = 'select place_id from placex where osm_type = :type and osm_id = :id';
+        $iPlaceID = $this->oDB->getOne($sSQL, array(':type' => $sType, ':id' => $iID));
 
         if (!$iPlaceID) {
             return null;
@@ -425,9 +425,10 @@ class PlaceLookup
 
         $sSQL = join(' UNION ', $aSubSelects);
         Debug::printSQL($sSQL);
-        $aPlaces = chksql($this->oDB->getAll($sSQL), 'Could not lookup place');
+        $aPlaces = $this->oDB->getAll($sSQL, null, 'Could not lookup place');
 
         foreach ($aPlaces as &$aPlace) {
+            $aPlace['importance'] = (float) $aPlace['importance'];
             if ($this->bAddressDetails) {
                 // to get addressdetails for tiger data, the housenumber is needed
                 $aPlace['address'] = new AddressDetails(
@@ -514,7 +515,7 @@ class PlaceLookup
                 $sSQL .= $sFrom;
             }
 
-            $aPointPolygon = chksql($this->oDB->getRow($sSQL), 'Could not get outline');
+            $aPointPolygon = $this->oDB->getRow($sSQL, null, 'Could not get outline');
 
             if ($aPointPolygon && $aPointPolygon['place_id']) {
                 if ($aPointPolygon['centrelon'] !== null && $aPointPolygon['centrelat'] !== null) {