]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/PlaceLookup.php
use chksql everywhere in lib/
[nominatim.git] / lib / PlaceLookup.php
index be60ff0782ba02221ae60ed369455b895a4c6bc8..831f6ef6ca4d4e838696843f9db89c709c6cfefb 100644 (file)
                function setOSMID($sType, $iID)
                {
                        $sSQL = "select place_id from placex where osm_type = '".pg_escape_string($sType)."' and osm_id = ".(int)$iID." order by type = 'postcode' asc";
-                       $this->iPlaceID = $this->oDB->getOne($sSQL);
+                       $this->iPlaceID = chksql($this->oDB->getOne($sSQL));
                }
 
                function lookupPlace($details)
                                $sSQL .= " from placex where place_id = ".(int)$this->iPlaceID;
                        }
 
-                       $aPlace = $this->oDB->getRow($sSQL);
-
-
-                       if (PEAR::IsError($aPlace))
-                       {
-                               failInternalError("Could not lookup place.", $sSQL, $aPlace);
-                       }
+                       $aPlace = chksql($this->oDB->getRow($sSQL), "Could not lookup place");
 
                        if (!$aPlace['place_id']) return null;
 
                        if (!$bAll) $sSQL .= " WHERE isaddress OR type = 'country_code'";
                        $sSQL .= " order by rank_address desc,isaddress desc";
 
-                       $aAddressLines = $this->oDB->getAll($sSQL);
-                       if (PEAR::IsError($aAddressLines))
-                       {
-                               var_dump($aAddressLines);
-                               exit;
-                       }
-                       return $aAddressLines;
+                       return chksql($this->oDB->getAll($sSQL));
                }
 
                function getAddressNames($housenumber = -1)
                                        $sSQL .= $sFrom;
                                }
 
-                               $aPointPolygon = $this->oDB->getRow($sSQL);
-                               if (PEAR::IsError($aPointPolygon))
-                               {
-                                       echo var_dump($aPointPolygon);
-                                       failInternalError("Could not get outline.", $sSQL, $aPointPolygon);
-                               }
+                               $aPointPolygon = chksql($this->oDB->getRow($sSQL),
+                                                       "Could not get outline");
 
                                if ($aPointPolygon['place_id'])
                                {