introduce chksql function for website code and move other fail functions

The default error screen now reports the full SQL even when not
in debug mode as this message is often more helpful than our
custom error message.
This commit is contained in:
Sarah Hoffmann
2016-06-12 14:34:57 +02:00
parent 7a50d2f996
commit 95961d098d
9 changed files with 116 additions and 78 deletions

View File

@@ -4,13 +4,8 @@
function &getDB($bNew = false, $bPersistent = false)
{
// Get the database object
$oDB = DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent);
if (PEAR::IsError($oDB))
{
var_dump(CONST_Database_DSN);
var_Dump($oDB);
fail($oDB->getMessage());
}
$oDB = chksql(DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent),
"Failed to establish database connection");
$oDB->setFetchMode(DB_FETCHMODE_ASSOC);
$oDB->query("SET DateStyle TO 'sql,european'");
$oDB->query("SET client_encoding TO 'utf-8'");