From 329eae0abd8fd3297e90577d7922864ce8078571 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 9 Jul 2012 19:29:18 +0200 Subject: Fix debugging in sqlite driver --- program/include/rcube_db.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'program/include/rcube_db.php') 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 @@ -251,6 +251,18 @@ class rcube_db $this->options['debug_mode'] = $dbg; } + /** + * 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 * @@ -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); -- cgit v1.2.3