From 8623ab291736c61721ae3b21435564b56c69be26 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 30 Jan 2012 04:56:08 +0000 Subject: [PATCH 1/2] _count_execs actually works nicely for PDO, if called... --- core/database.class.php | 1 + index.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/core/database.class.php b/core/database.class.php index c42ce366..b17a8625 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -326,6 +326,7 @@ class Database { */ public function execute($query, $args=array()) { try { + _count_execs($this->db, $query, $args); $stmt = $this->db->prepare($query); if (!array_key_exists(0, $args)) { foreach($args as $name=>$value) { diff --git a/index.php b/index.php index 54194b10..9df65aeb 100644 --- a/index.php +++ b/index.php @@ -106,7 +106,6 @@ try { ctx_log_start("Connecting to DB"); // connect to the database $database = new Database(); - //$database->db->fnExecute = '_count_execs'; // FIXME: PDO equivalent $database->db->beginTransaction(); $config = new DatabaseConfig($database); ctx_log_endok(); From 55447d1aa84f449662a3beeac421a5e04d22961d Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 30 Jan 2012 05:00:21 +0000 Subject: [PATCH 2/2] toggle for sql debugging --- core/util.inc.php | 2 +- index.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/util.inc.php b/core/util.inc.php index 7005d840..1def3356 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -409,7 +409,7 @@ function check_cli() { */ function _count_execs($db, $sql, $inputarray) { global $_execs; - if(DEBUG) { + if(DEBUG_SQL) { $fp = @fopen("data/sql.log", "a"); if($fp) { if(is_array($inputarray)) { diff --git a/index.php b/index.php index 9df65aeb..5a60f335 100644 --- a/index.php +++ b/index.php @@ -61,6 +61,7 @@ function _d($name, $value) {if(!defined($name)) define($name, $value);} _d("DATABASE_DSN", null); // string PDO database connection details _d("CACHE_DSN", null); // string cache connection details _d("DEBUG", false); // boolean print various debugging details +_d("DEBUG_SQL", false); // boolean dump SQL queries to data/sql.log _d("COVERAGE", false); // boolean activate xdebug coverage monitor _d("CONTEXT", null); // string file to log performance data into _d("CACHE_MEMCACHE", false); // boolean store complete rendered pages in memcache