Commit f68a33d6 authored by Alexander Butenko's avatar Alexander Butenko

Fix #210 empty getLastQuery after rawQuery() execution

parent 76f43dd3
...@@ -218,6 +218,7 @@ class MysqliDb ...@@ -218,6 +218,7 @@ class MysqliDb
*/ */
public function rawQuery ($query, $bindParams = null, $sanitize = true) public function rawQuery ($query, $bindParams = null, $sanitize = true)
{ {
$params = array(''); // Create the empty 0 index
$this->_query = $query; $this->_query = $query;
if ($sanitize) if ($sanitize)
$this->_query = filter_var ($query, FILTER_SANITIZE_STRING, $this->_query = filter_var ($query, FILTER_SANITIZE_STRING,
...@@ -225,7 +226,6 @@ class MysqliDb ...@@ -225,7 +226,6 @@ class MysqliDb
$stmt = $this->_prepareQuery(); $stmt = $this->_prepareQuery();
if (is_array($bindParams) === true) { if (is_array($bindParams) === true) {
$params = array(''); // Create the empty 0 index
foreach ($bindParams as $prop => $val) { foreach ($bindParams as $prop => $val) {
$params[0] .= $this->_determineType($val); $params[0] .= $this->_determineType($val);
array_push($params, $bindParams[$prop]); array_push($params, $bindParams[$prop]);
...@@ -237,6 +237,7 @@ class MysqliDb ...@@ -237,6 +237,7 @@ class MysqliDb
$stmt->execute(); $stmt->execute();
$this->_stmtError = $stmt->error; $this->_stmtError = $stmt->error;
$this->_lastQuery = $this->replacePlaceHolders ($this->_query, $params);
$this->reset(); $this->reset();
return $this->_dynamicBindResults($stmt); return $this->_dynamicBindResults($stmt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment