diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcube_db.php | 16 | ||||
-rw-r--r-- | program/include/rcube_db_sqlite.php | 4 |
2 files changed, 14 insertions, 6 deletions
diff --git a/program/include/rcube_db.php b/program/include/rcube_db.php index 31385d860..d0d213cd0 100644 --- a/program/include/rcube_db.php +++ b/program/include/rcube_db.php @@ -252,6 +252,18 @@ class rcube_db } /** + * Writes debug information/query to 'sql' log file + * + * @param string $query SQL query + */ + protected function debug($query) + { + if ($this->options['debug_mode']) { + rcube::write_log('sql', '[' . (++$this->db_index) . '] ' . $query . ';'); + } + } + + /** * Getter for error state * * @return boolean True on error @@ -378,9 +390,7 @@ class rcube_db $query = rtrim($query, ';'); - if ($this->options['debug_mode']) { - rcube::write_log('sql', '[' . (++$this->db_index) . '] ' . $query . ';'); - } + $this->debug($query); $query = $this->dbh->query($query); diff --git a/program/include/rcube_db_sqlite.php b/program/include/rcube_db_sqlite.php index 0b41ef551..57f8ddc2a 100644 --- a/program/include/rcube_db_sqlite.php +++ b/program/include/rcube_db_sqlite.php @@ -63,9 +63,7 @@ class rcube_db_sqlite extends rcube_db $data = file_get_contents(INSTALL_PATH . 'SQL/sqlite.initial.sql'); if (strlen($data)) { - if ($this->options['debug_mode']) { - $this::debug('INITIALIZE DATABASE'); - } + $this->debug('INITIALIZE DATABASE'); $q = $dbh->exec($data); |