From: Andrey Kutejko Date: Sat, 30 Dec 2017 14:53:13 +0000 (+0100) Subject: better log of SQL queries X-Git-Tag: 0.6~27 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=74fd649485ebd70eaba669912335682d4b7a0e5d;p=ipf.git better log of SQL queries --- 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); } } -