@@ -216,9 +216,9 @@ class MysqliDb
216
216
/**
217
217
* Variables for query execution tracing
218
218
*/
219
- protected $ traceStartQ ;
220
- protected $ traceEnabled ;
221
- protected $ traceStripPrefix ;
219
+ protected $ traceStartQ = 0 ;
220
+ protected $ traceEnabled = false ;
221
+ protected $ traceStripPrefix = '' ;
222
222
public $ trace = array ();
223
223
224
224
/**
@@ -794,11 +794,11 @@ public function getOne($tableName, $columns = '*')
794
794
/**
795
795
* A convenient SELECT COLUMN function to get a single column value from one row
796
796
*
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
800
800
*
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
802
802
* @throws Exception
803
803
*/
804
804
public function getValue ($ tableName , $ column , $ limit = 1 )
@@ -1693,7 +1693,12 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
1693
1693
}
1694
1694
$ this ->count ++;
1695
1695
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 );
1697
1702
} else {
1698
1703
array_push ($ results , $ result );
1699
1704
}
@@ -2333,7 +2338,7 @@ public function _transaction_status_check()
2333
2338
*
2334
2339
* @return MysqliDb
2335
2340
*/
2336
- public function setTrace ($ enabled , $ stripPrefix = null )
2341
+ public function setTrace ($ enabled , $ stripPrefix = '' )
2337
2342
{
2338
2343
$ this ->traceEnabled = $ enabled ;
2339
2344
$ this ->traceStripPrefix = $ stripPrefix ;
@@ -2354,7 +2359,7 @@ private function _traceGetCaller()
2354
2359
}
2355
2360
2356
2361
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 " ] . " " ;
2358
2363
}
2359
2364
2360
2365
/**
0 commit comments