9
9
* @author Alexander V. Butenko <[email protected] >
10
10
* @copyright Copyright (c) 2010
11
11
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
12
+ * @link http://github.com/joshcam/PHP-MySQLi-Database-Class
12
13
* @version 2.2
13
14
**/
14
15
class MysqliDb
@@ -307,7 +308,7 @@ public function rawQuery ($query, $bindParams = null)
307
308
$ this ->_query = $ query ;
308
309
$ stmt = $ this ->_prepareQuery ();
309
310
310
- if (is_array ($ bindParams ) === true ) {
311
+ if (is_array ($ bindParams ) === true ) {
311
312
foreach ($ bindParams as $ prop => $ val ) {
312
313
$ params [0 ] .= $ this ->_determineType ($ val );
313
314
array_push ($ params , $ bindParams [$ prop ]);
@@ -915,9 +916,8 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
915
916
916
917
// if $meta is false yet sqlstate is true, there's no sql error but the query is
917
918
// most likely an update/insert/delete which doesn't produce any results
918
- if (!$ meta && $ stmt ->sqlstate ) {
919
+ if (!$ meta && $ stmt ->sqlstate )
919
920
return array ();
920
- }
921
921
922
922
$ row = array ();
923
923
while ($ field = $ meta ->fetch_field ()) {
@@ -975,9 +975,8 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
975
975
$ totalCount = $ stmt ->fetch_row ();
976
976
$ this ->totalCount = $ totalCount [0 ];
977
977
}
978
- if ($ this ->returnType == 'Json ' ) {
978
+ if ($ this ->returnType == 'Json ' )
979
979
return json_encode ($ results );
980
- }
981
980
982
981
return $ results ;
983
982
}
@@ -1188,9 +1187,8 @@ protected function _buildLimit ($numRows) {
1188
1187
*/
1189
1188
protected function _prepareQuery ()
1190
1189
{
1191
- if (!$ stmt = $ this ->mysqli ()->prepare ($ this ->_query )) {
1192
- throw new Exception ("Problem preparing query ( $ this ->_query ) " . $ this ->mysqli ()->error );
1193
- }
1190
+ if (!$ stmt = $ this ->mysqli ()->prepare ($ this ->_query ))
1191
+ throw new Exception ("Problem preparing query ( $ this ->_query ) " . $ this ->mysqli ()->error );
1194
1192
if ($ this ->traceEnabled )
1195
1193
$ this ->traceStartQ = microtime (true );
1196
1194
@@ -1218,11 +1216,10 @@ protected function refValues(Array &$arr)
1218
1216
//Reference in the function arguments are required for HHVM to work
1219
1217
//https://github.com/facebook/hhvm/issues/5155
1220
1218
//Referenced data array is required by mysqli since PHP 5.3+
1221
- if (strnatcmp (phpversion (), '5.3 ' ) >= 0 ) {
1219
+ if (strnatcmp (phpversion (), '5.3 ' ) >= 0 ) {
1222
1220
$ refs = array ();
1223
- foreach ($ arr as $ key => $ value ) {
1221
+ foreach ($ arr as $ key => $ value )
1224
1222
$ refs [$ key ] = & $ arr [$ key ];
1225
- }
1226
1223
return $ refs ;
1227
1224
}
1228
1225
return $ arr ;
@@ -1340,9 +1337,8 @@ public function now ($diff = null, $func = "NOW()") {
1340
1337
* @param int increment by int or float. 1 by default
1341
1338
*/
1342
1339
public function inc ($ num = 1 ) {
1343
- if (!is_numeric ($ num )){
1344
- throw new Exception ('Argument supplied to inc must be a number ' );
1345
- }
1340
+ if (!is_numeric ($ num ))
1341
+ throw new Exception ('Argument supplied to inc must be a number ' );
1346
1342
return Array ("[I] " => "+ " . $ num );
1347
1343
}
1348
1344
@@ -1351,9 +1347,8 @@ public function inc($num = 1) {
1351
1347
* @param int increment by int or float. 1 by default
1352
1348
*/
1353
1349
public function dec ($ num = 1 ) {
1354
- if (!is_numeric ($ num )){
1355
- throw new Exception ('Argument supplied to dec must be a number ' );
1356
- }
1350
+ if (!is_numeric ($ num ))
1351
+ throw new Exception ('Argument supplied to dec must be a number ' );
1357
1352
return Array ("[I] " => "- " . $ num );
1358
1353
}
1359
1354
0 commit comments