Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions MysqliDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ class MysqliDb
/**
* Variables for query execution tracing
*/
protected $traceStartQ;
protected $traceEnabled;
protected $traceStripPrefix;
protected $traceStartQ = 0;
protected $traceEnabled = false;
protected $traceStripPrefix = '';
public $trace = array();

/**
Expand Down Expand Up @@ -790,11 +790,11 @@ public function getOne($tableName, $columns = '*')
/**
* A convenient SELECT COLUMN function to get a single column value from one row
*
* @param string $tableName The name of the database table to work with.
* @param string $column The desired column
* @param int $limit Limit of rows to select. Use null for unlimited..1 by default
* @param string $tableName The name of the database table to work with.
* @param string $column The desired column
* @param int|null $limit Limit of rows to select. Use null for unlimited. 1 by default
*
* @return mixed Contains the value of a returned column / array of values
* @return mixed Contains the value of a returned column / array of values
* @throws Exception
*/
public function getValue($tableName, $column, $limit = 1)
Expand Down Expand Up @@ -1689,7 +1689,12 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
}
$this->count++;
if ($this->_mapKey) {
$results[$row[$this->_mapKey]] = count($row) > 2 ? $result : end($result);
if (count($row) < 3 && $this->returnType == 'object') {
$res = new ArrayIterator($result);
$res->seek($_res->count() - 1);
$results[$row[$this->_mapKey]] = $res->current();
}
else $results[$row[$this->_mapKey]] = count($row) > 2 ? $result : end($result);
} else {
array_push($results, $result);
}
Expand Down Expand Up @@ -2329,7 +2334,7 @@ public function _transaction_status_check()
*
* @return MysqliDb
*/
public function setTrace($enabled, $stripPrefix = null)
public function setTrace($enabled, $stripPrefix = '')
{
$this->traceEnabled = $enabled;
$this->traceStripPrefix = $stripPrefix;
Expand All @@ -2350,7 +2355,7 @@ private function _traceGetCaller()
}

return __CLASS__ . "->" . $caller["function"] . "() >> file \"" .
str_replace($this->traceStripPrefix, '', $caller["file"]) . "\" line #" . $caller["line"] . " ";
str_replace($this->traceStripPrefix , '', $caller["file"]) . "\" line #" . $caller["line"] . " ";
}

/**
Expand Down