aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba.php
diff options
context:
space:
mode:
authorMichael Vogel <icarus@dabo.de>2012-05-09 14:56:48 +0200
committerMichael Vogel <icarus@dabo.de>2012-05-09 14:56:48 +0200
commitf2e648d62fe7cafb9a55c7505687ea4d1c294778 (patch)
tree07a1b31339ccd871bb4fbfe73e3f0d4911689795 /include/dba.php
parenta3f08c44be78d4517e9f1619811def09b2ec7e7a (diff)
parent53157bb954acb7597347c6b4a87e64e7a2f6cc79 (diff)
downloadvolse-hubzilla-f2e648d62fe7cafb9a55c7505687ea4d1c294778.tar.gz
volse-hubzilla-f2e648d62fe7cafb9a55c7505687ea4d1c294778.tar.bz2
volse-hubzilla-f2e648d62fe7cafb9a55c7505687ea4d1c294778.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'include/dba.php')
-rw-r--r--include/dba.php28
1 files changed, 18 insertions, 10 deletions
diff --git a/include/dba.php b/include/dba.php
index 44a663eac..c9f880241 100644
--- a/include/dba.php
+++ b/include/dba.php
@@ -75,22 +75,28 @@ class dba {
if((! $this->db) || (! $this->connected))
return false;
+ $this->error = '';
+
if($this->mysqli)
$result = @$this->db->query($sql);
else
$result = @mysql_query($sql,$this->db);
+ if($this->mysqli) {
+ if($this->db->errno)
+ $this->error = $this->db->error;
+ }
+ elseif(mysql_errno($this->db))
+ $this->error = mysql_error($this->db);
+
+ if(strlen($this->error)) {
+ logger('dba: ' . $this->error);
+ }
+
if($this->debug) {
$mesg = '';
- if($this->mysqli) {
- if($this->db->errno)
- logger('dba: ' . $this->db->error);
- }
- elseif(mysql_errno($this->db))
- logger('dba: ' . mysql_error($this->db));
-
if($result === false)
$mesg = 'false';
elseif($result === true)
@@ -102,7 +108,9 @@ class dba {
$mesg = mysql_num_rows($result) . ' results' . EOL;
}
- $str = 'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg . EOL;
+ $str = 'SQL = ' . printable($sql) . EOL . 'SQL returned ' . $mesg
+ . (($this->error) ? ' error: ' . $this->error : '')
+ . EOL;
logger('dba: ' . $str );
}
@@ -114,9 +122,9 @@ class dba {
*/
if($result === false) {
- logger('dba: ' . printable($sql) . ' returned 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", FILE_APPEND);
+ file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND);
}
if(($result === true) || ($result === false))