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/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 54194b10..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 @@ -106,7 +107,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();