diff options
author | Simon L'nu <simon.lnu@gmail.com> | 2012-04-30 06:02:38 -0400 |
---|---|---|
committer | Simon L'nu <simon.lnu@gmail.com> | 2012-04-30 06:02:38 -0400 |
commit | 9b7dac6ce19e99ae9341329f422685626146fbdb (patch) | |
tree | dbf505881b60a675492d299d94ec6fb7875c8fac /include/dba.php | |
parent | 34eb843fb486b9487f02553c1b791892bb7615fc (diff) | |
parent | 9f18c9d664d44ce4d2bfe092bf1a8a154d31ac5f (diff) | |
download | volse-hubzilla-9b7dac6ce19e99ae9341329f422685626146fbdb.tar.gz volse-hubzilla-9b7dac6ce19e99ae9341329f422685626146fbdb.tar.bz2 volse-hubzilla-9b7dac6ce19e99ae9341329f422685626146fbdb.zip |
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master:
provide "xxx joined yyy" notifications
adding META viewport tag for better look on tablets
Update Esperanto to 100%
DE update to the strings
activitystreams schema constants for "join group"
missed a db field
typo in profile_selectors, fix remote tagging
not all profile selector choices have unique or direct translations
log db error strings in all cases
admin page to manage failed updates
improved db error logging
close one menu (like the notifications menu) when another one is opened (like it is done when clicking somewhere else) (thx to ^mw)
* master:
Diffstat (limited to 'include/dba.php')
-rw-r--r-- | include/dba.php | 28 |
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)) |