@@ -216,9 +216,9 @@ class MysqliDb
216216 /**
217217 * Variables for query execution tracing
218218 */
219- protected $ traceStartQ ;
220- protected $ traceEnabled ;
221- protected $ traceStripPrefix ;
219+ protected $ traceStartQ = 0 ;
220+ protected $ traceEnabled = false ;
221+ protected $ traceStripPrefix = '' ;
222222 public $ trace = array ();
223223
224224 /**
@@ -794,11 +794,11 @@ public function getOne($tableName, $columns = '*')
794794 /**
795795 * A convenient SELECT COLUMN function to get a single column value from one row
796796 *
797- * @param string $tableName The name of the database table to work with.
798- * @param string $column The desired column
799- * @param int $limit Limit of rows to select. Use null for unlimited.. 1 by default
797+ * @param string $tableName The name of the database table to work with.
798+ * @param string $column The desired column
799+ * @param int|null $limit Limit of rows to select. Use null for unlimited. 1 by default
800800 *
801- * @return mixed Contains the value of a returned column / array of values
801+ * @return mixed Contains the value of a returned column / array of values
802802 * @throws Exception
803803 */
804804 public function getValue ($ tableName , $ column , $ limit = 1 )
@@ -1693,7 +1693,12 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
16931693 }
16941694 $ this ->count ++;
16951695 if ($ this ->_mapKey ) {
1696- $ results [$ row [$ this ->_mapKey ]] = count ($ row ) > 2 ? $ result : end ($ result );
1696+ if (count ($ row ) < 3 && $ this ->returnType == 'object ' ) {
1697+ $ res = new ArrayIterator ($ result );
1698+ $ res ->seek ($ _res ->count () - 1 );
1699+ $ results [$ row [$ this ->_mapKey ]] = $ res ->current ();
1700+ }
1701+ else $ results [$ row [$ this ->_mapKey ]] = count ($ row ) > 2 ? $ result : end ($ result );
16971702 } else {
16981703 array_push ($ results , $ result );
16991704 }
@@ -2333,7 +2338,7 @@ public function _transaction_status_check()
23332338 *
23342339 * @return MysqliDb
23352340 */
2336- public function setTrace ($ enabled , $ stripPrefix = null )
2341+ public function setTrace ($ enabled , $ stripPrefix = '' )
23372342 {
23382343 $ this ->traceEnabled = $ enabled ;
23392344 $ this ->traceStripPrefix = $ stripPrefix ;
@@ -2354,7 +2359,7 @@ private function _traceGetCaller()
23542359 }
23552360
23562361 return __CLASS__ . "-> " . $ caller ["function " ] . "() >> file \"" .
2357- str_replace ($ this ->traceStripPrefix , '' , $ caller ["file " ]) . "\" line # " . $ caller ["line " ] . " " ;
2362+ str_replace ($ this ->traceStripPrefix , '' , $ caller ["file " ]) . "\" line # " . $ caller ["line " ] . " " ;
23582363 }
23592364
23602365 /**
0 commit comments