Skip to content

Commit f68a33d

Browse files
committed
Fix #210 empty getLastQuery after rawQuery() execution
1 parent 76f43dd commit f68a33d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

MysqliDb.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ public function setPrefix($prefix = '')
218218
*/
219219
public function rawQuery ($query, $bindParams = null, $sanitize = true)
220220
{
221+
$params = array(''); // Create the empty 0 index
221222
$this->_query = $query;
222223
if ($sanitize)
223224
$this->_query = filter_var ($query, FILTER_SANITIZE_STRING,
224225
FILTER_FLAG_NO_ENCODE_QUOTES);
225226
$stmt = $this->_prepareQuery();
226227

227228
if (is_array($bindParams) === true) {
228-
$params = array(''); // Create the empty 0 index
229229
foreach ($bindParams as $prop => $val) {
230230
$params[0] .= $this->_determineType($val);
231231
array_push($params, $bindParams[$prop]);
@@ -237,6 +237,7 @@ public function rawQuery ($query, $bindParams = null, $sanitize = true)
237237

238238
$stmt->execute();
239239
$this->_stmtError = $stmt->error;
240+
$this->_lastQuery = $this->replacePlaceHolders ($this->_query, $params);
240241
$this->reset();
241242

242243
return $this->_dynamicBindResults($stmt);

0 commit comments

Comments
 (0)