@@ -13,6 +13,7 @@ class ez_mysqli extends ezsqlModel implements DatabaseInterface
1313{
1414 private $ return_val = 0 ;
1515 private $ is_insert = false ;
16+ private $ shortcutUsed = false ;
1617 private $ isTransactional = false ;
1718
1819 /**
@@ -32,7 +33,6 @@ class ez_mysqli extends ezsqlModel implements DatabaseInterface
3233 * @var ConfigInterface
3334 */
3435 private $ database ;
35- protected $ shortcutUsed = false ;
3636
3737 public function __construct (ConfigInterface $ settings = null )
3838 {
@@ -124,7 +124,7 @@ public function connect(
124124 } // connect
125125
126126 /**
127- * Try to select the default database for mySQL
127+ * Try to select a mySQL database
128128 *
129129 * @param string $name The name of the database
130130 * @param string $charset Encoding of the database
@@ -212,9 +212,9 @@ private function fetch_prepared_result(&$stmt, $query)
212212 if (\preg_match ("/^(insert|delete|update|replace)\s+/i " , $ query )) {
213213 $ this ->_affectedRows = \mysqli_stmt_affected_rows ($ stmt );
214214
215- // Take note of the insert id
215+ // Take note of the insert_id
216216 if (\preg_match ("/^(insert|replace)\s+/i " , $ query )) {
217- $ this ->insertId = $ stmt ->insert_id ;
217+ $ this ->insert_id = $ stmt ->insert_id ;
218218 }
219219 } else {
220220 $ this ->_affectedRows = $ stmt ->num_rows ;
@@ -225,7 +225,7 @@ private function fetch_prepared_result(&$stmt, $query)
225225 while ($ field = $ meta ->fetch_field ()) {
226226 $ col_info [$ field ->name ] = "" ;
227227 $ variables [$ field ->name ] = &$ col_info [$ field ->name ];
228- $ this ->colInfo [$ x ] = $ field ;
228+ $ this ->col_info [$ x ] = $ field ;
229229 $ x ++;
230230 }
231231
@@ -240,7 +240,7 @@ private function fetch_prepared_result(&$stmt, $query)
240240 foreach ($ variables as $ key => $ value ) {
241241 $ resultObject ->$ key = $ value ;
242242 }
243- $ this ->lastResult [$ i ] = $ resultObject ;
243+ $ this ->last_result [$ i ] = $ resultObject ;
244244 $ i ++;
245245 }
246246 }
@@ -251,7 +251,7 @@ private function fetch_prepared_result(&$stmt, $query)
251251 $ this ->register_error ($ str );
252252
253253 // If debug ALL queries
254- $ this ->trace || $ this ->debugAll ? $ this ->debug () : null ;
254+ $ this ->trace || $ this ->debug_all ? $ this ->debug () : null ;
255255 return false ;
256256 }
257257
@@ -262,7 +262,7 @@ private function fetch_prepared_result(&$stmt, $query)
262262 $ this ->store_cache ($ query , $ is_insert );
263263
264264 // If debug ALL queries
265- $ this ->trace || $ this ->debugAll ? $ this ->debug () : null ;
265+ $ this ->trace || $ this ->debug_all ? $ this ->debug () : null ;
266266
267267 return $ return_val ;
268268 }
@@ -282,7 +282,7 @@ public function query_prepared(string $query, array $param = null)
282282 $ stmt = $ this ->dbh ->prepare ($ query );
283283 if (!$ stmt instanceof \mysqli_stmt) {
284284 if ($ this ->isTransactional )
285- throw new \Exception ($ this ->lastError );
285+ throw new \Exception ($ this ->getLast_Error () );
286286
287287 return false ;
288288 }
@@ -338,7 +338,7 @@ private function processQueryResult(string $query, $result = null)
338338 $ this ->register_error ($ str );
339339
340340 // If debug ALL queries
341- $ this ->trace || $ this ->debugAll ? $ this ->debug () : null ;
341+ $ this ->trace || $ this ->debug_all ? $ this ->debug () : null ;
342342 return false ;
343343 }
344344
@@ -350,7 +350,7 @@ private function processQueryResult(string $query, $result = null)
350350
351351 // Take note of the insert_id
352352 if (\preg_match ("/^(insert|replace)\s+/i " , $ query )) {
353- $ this ->insertId = \mysqli_insert_id ($ this ->dbh );
353+ $ this ->insert_id = \mysqli_insert_id ($ this ->dbh );
354354 }
355355
356356 // Return number of rows affected
@@ -362,25 +362,25 @@ private function processQueryResult(string $query, $result = null)
362362 // Take note of column info
363363 $ i = 0 ;
364364 while ($ i < \mysqli_num_fields ($ this ->result )) {
365- $ this ->colInfo [$ i ] = \mysqli_fetch_field ($ this ->result );
365+ $ this ->col_info [$ i ] = \mysqli_fetch_field ($ this ->result );
366366 $ i ++;
367367 }
368368
369369 // Store Query Results
370370 $ num_rows = 0 ;
371371 while ($ row = \mysqli_fetch_object ($ this ->result )) {
372372 // Store results as an objects within main array
373- $ this ->lastResult [$ num_rows ] = $ row ;
373+ $ this ->last_result [$ num_rows ] = $ row ;
374374 $ num_rows ++;
375375 }
376376
377377 \mysqli_free_result ($ this ->result );
378378
379379 // Log number of rows the query returned
380- $ this ->numRows = $ num_rows ;
380+ $ this ->num_rows = $ num_rows ;
381381
382382 // Return number of rows selected
383- $ this ->return_val = $ this ->numRows ;
383+ $ this ->return_val = $ this ->num_rows ;
384384 }
385385 }
386386 }
@@ -414,10 +414,10 @@ public function query(string $query, bool $use_prepare = false)
414414 $ this ->log_query ("\$db->query( \"$ query \") " );
415415
416416 // Keep track of the last query for debug..
417- $ this ->lastQuery = $ query ;
417+ $ this ->last_query = $ query ;
418418
419419 // Count how many queries there have been
420- $ this ->numQueries ++;
420+ $ this ->num_queries ++;
421421
422422 // Use core file cache function
423423 if ($ cache = $ this ->get_cache ($ query )) {
@@ -440,7 +440,7 @@ public function query(string $query, bool $use_prepare = false)
440440
441441 if ($ this ->processQueryResult ($ query ) === false ) {
442442 if ($ this ->isTransactional )
443- throw new \Exception ($ this ->lastError );
443+ throw new \Exception ($ this ->getLast_Error () );
444444
445445 return false ;
446446 }
@@ -449,7 +449,7 @@ public function query(string $query, bool $use_prepare = false)
449449 $ this ->store_cache ($ query , $ this ->is_insert );
450450
451451 // If debug ALL queries
452- $ this ->trace || $ this ->debugAll ? $ this ->debug () : null ;
452+ $ this ->trace || $ this ->debug_all ? $ this ->debug () : null ;
453453
454454 return $ this ->return_val ;
455455 } // query
@@ -514,7 +514,7 @@ public function getCharset()
514514 }
515515
516516 /**
517- * Returns the last inserted Id - auto generated
517+ * Returns the last inserted auto-increment
518518 *
519519 * @return int
520520 */
@@ -530,7 +530,7 @@ public function beginTransaction()
530530 {
531531 /* turn autocommit off */
532532 $ this ->dbh ->autocommit (false );
533- $ this ->dbh ->begin_transaction (\ MYSQLI_TRANS_START_READ_WRITE );
533+ $ this ->dbh ->begin_transaction (MYSQLI_TRANS_START_READ_WRITE );
534534 $ this ->isTransactional = true ;
535535 }
536536
0 commit comments