From 74fd649485ebd70eaba669912335682d4b7a0e5d Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 30 Dec 2017 15:53:13 +0100 Subject: [PATCH] better log of SQL queries --- ipf/database.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ipf/database.php b/ipf/database.php index 9250d86..2c593e1 100644 --- a/ipf/database.php +++ b/ipf/database.php @@ -128,9 +128,21 @@ class PDOProfileStatement extends PDOStatement $this->start = microtime(true); } + function bindValue($parameter, $value, $data_type = null) + { + $success = parent::bindValue($parameter, $value, $data_type); + if ($this->params === null) { + $this->params = []; + } + $this->params[$parameter] = $value; + return $success; + } + function execute($params=null) { - $this->params = $params; + if ($this->params === null) { + $this->params = $params; + } $start = microtime(true); $result = $params ? parent::execute($params) : parent::execute(); $this->execute_time = microtime(true) - $start; @@ -143,4 +155,3 @@ class PDOProfileStatement extends PDOStatement $this->pdo->report($this->q, $this->params, $total, $this->execute_time); } } - -- 2.49.0