]> git.andy128k.dev Git - ipf.git/commitdiff
better log of SQL queries
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 30 Dec 2017 14:53:13 +0000 (15:53 +0100)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 30 Dec 2017 14:53:13 +0000 (15:53 +0100)
ipf/database.php

index 9250d8671d96b8bdd576275d72a239050278e7ea..2c593e138a44a45ac5fe32d060422132dc4308a0 100644 (file)
@@ -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);
     }
 }
-