log db error strings in all cases

This commit is contained in:
friendica 2012-04-29 19:41:17 -07:00
parent 0153d86b7f
commit 1ebde08415

View File

@ -74,9 +74,9 @@ class dba {
if((! $this->db) || (! $this->connected)) if((! $this->db) || (! $this->connected))
return false; return false;
$this->error = '';
$this->error = '';
if($this->mysqli) if($this->mysqli)
$result = @$this->db->query($sql); $result = @$this->db->query($sql);
else else
@ -122,7 +122,7 @@ class dba {
*/ */
if($result === false) { if($result === false) {
logger('dba: ' . printable($sql) . ' returned false.'); logger('dba: ' . printable($sql) . ' returned false.' . "\n" . $this->error);
if(file_exists('dbfail.out')) if(file_exists('dbfail.out'))
file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND); file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND);
} }