X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdba_pdo.php;h=a44c447af20fa568d8ed15bb6e6082fc5330b182;hb=4f25396faeaa501907e93b24ee51ebdd08f84993;hp=7cd8c638e7f60955364b93b3ea84a591a5b29adc;hpb=029633c16d30a4d79b31644ff6d30a5504ad16d8;p=friendica.git diff --git a/include/dba_pdo.php b/include/dba_pdo.php index 7cd8c638e7..a44c447af2 100644 --- a/include/dba_pdo.php +++ b/include/dba_pdo.php @@ -44,7 +44,7 @@ class dba { public $error = false; function __construct($server,$user,$pass,$db,$install = false) { - global $a; + $a = get_app(); # work around, to store the database - configuration in DDDBL $objDataObjectPool = new \DDDBL\DataObjectPool('Database-Definition'); @@ -99,7 +99,7 @@ class dba { } public function q($sql, $onlyquery = false) { - global $a; + $a = get_app(); $strHandler = (true === $onlyquery) ? 'PDOStatement' : 'MULTI'; @@ -126,6 +126,7 @@ class dba { # bad workaround to emulate the bizzare behavior of mysql_query if(in_array($strSQLType, array('INSERT', 'UPDATE', 'DELETE', 'CREATE', 'DROP', 'SET'))) $result = true; + $intErrorCode = false; } catch (\Exception $objException) { $result = false; @@ -181,13 +182,13 @@ class dba { * These usually indicate SQL syntax errors that need to be resolved. */ - if($result === false) { + if(isset($result) AND ($result === false)) { logger('dba: ' . printable($sql) . ' returned false.' . "\n" . $this->error); if(file_exists('dbfail.out')) file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND); } - if(($result === true) || ($result === false)) + if(isset($result) AND (($result === true) || ($result === false))) return $result; if ($onlyquery) {