forked from hans/Nominatim
introduce chksql function for phpscripts
Checks SQL query results for errors and bails out if it finds one. Avoids some heavy code duplication all over the place.
This commit is contained in:
10
lib/cmd.php
10
lib/cmd.php
@@ -143,3 +143,13 @@
|
||||
echo "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
function chksql($oSql, $sMsg = false)
|
||||
{
|
||||
if (PEAR::isError($oSql))
|
||||
{
|
||||
fail($sMsg || $oSql->getMessage(), $oSql->userinfo);
|
||||
}
|
||||
|
||||
return $oSql;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user