@@ -14,7 +14,6 @@ class ez_mysqli extends ezsqlModel implements DatabaseInterface
1414{
1515 private $ return_val = 0 ;
1616 private $ is_insert = false ;
17- private $ shortcutUsed = false ;
1817 private $ isTransactional = false ;
1918
2019 /**
@@ -34,6 +33,7 @@ class ez_mysqli extends ezsqlModel implements DatabaseInterface
3433 * @var ConfigInterface
3534 */
3635 private $ database ;
36+ protected $ shortcutUsed = false ;
3737
3838 public function __construct (ConfigInterface $ settings = null )
3939 {
@@ -82,7 +82,7 @@ public function quick_connect(
8282 $ charset = empty ($ charset ) ? $ this ->database ->getCharset () : $ charset ;
8383
8484 if (!$ this ->connect ($ user , $ password , $ host , (int ) $ port , $ charset ));
85- else if (!$ this ->select ($ name , $ charset ));
85+ else if (!$ this ->dbSelect ($ name , $ charset ));
8686
8787 return $ this ->_connected ;
8888 } // quick_connect
@@ -125,13 +125,13 @@ public function connect(
125125 } // connect
126126
127127 /**
128- * Try to select a mySQL database
128+ * Try to select the default database for mySQL
129129 *
130130 * @param string $name The name of the database
131131 * @param string $charset Encoding of the database
132132 * @return boolean
133133 */
134- public function select ($ name = '' , $ charset = '' )
134+ public function dbSelect ($ name = '' , $ charset = '' )
135135 {
136136 $ name = empty ($ name ) ? $ this ->database ->getName () : $ name ;
137137 try {
@@ -213,9 +213,9 @@ private function fetch_prepared_result(&$stmt, $query)
213213 if (\preg_match ("/^(insert|delete|update|replace)\s+/i " , $ query )) {
214214 $ this ->_affectedRows = \mysqli_stmt_affected_rows ($ stmt );
215215
216- // Take note of the insert_id
216+ // Take note of the insert id
217217 if (\preg_match ("/^(insert|replace)\s+/i " , $ query )) {
218- $ this ->insert_id = $ stmt ->insert_id ;
218+ $ this ->insertId = $ stmt ->insert_id ;
219219 }
220220 } else {
221221 $ this ->_affectedRows = $ stmt ->num_rows ;
@@ -226,7 +226,7 @@ private function fetch_prepared_result(&$stmt, $query)
226226 while ($ field = $ meta ->fetch_field ()) {
227227 $ col_info [$ field ->name ] = "" ;
228228 $ variables [$ field ->name ] = &$ col_info [$ field ->name ];
229- $ this ->col_info [$ x ] = $ field ;
229+ $ this ->colInfo [$ x ] = $ field ;
230230 $ x ++;
231231 }
232232
@@ -241,7 +241,7 @@ private function fetch_prepared_result(&$stmt, $query)
241241 foreach ($ variables as $ key => $ value ) {
242242 $ resultObject ->$ key = $ value ;
243243 }
244- $ this ->last_result [$ i ] = $ resultObject ;
244+ $ this ->lastResult [$ i ] = $ resultObject ;
245245 $ i ++;
246246 }
247247 }
@@ -252,7 +252,7 @@ private function fetch_prepared_result(&$stmt, $query)
252252 $ this ->register_error ($ str );
253253
254254 // If debug ALL queries
255- $ this ->trace || $ this ->debug_all ? $ this ->debug () : null ;
255+ $ this ->trace || $ this ->debugAll ? $ this ->debug () : null ;
256256 return false ;
257257 }
258258
@@ -263,7 +263,7 @@ private function fetch_prepared_result(&$stmt, $query)
263263 $ this ->store_cache ($ query , $ is_insert );
264264
265265 // If debug ALL queries
266- $ this ->trace || $ this ->debug_all ? $ this ->debug () : null ;
266+ $ this ->trace || $ this ->debugAll ? $ this ->debug () : null ;
267267
268268 return $ return_val ;
269269 }
@@ -283,7 +283,7 @@ public function query_prepared(string $query, array $param = null)
283283 $ stmt = $ this ->dbh ->prepare ($ query );
284284 if (!$ stmt instanceof \mysqli_stmt) {
285285 if ($ this ->isTransactional )
286- throw new \Exception ($ this ->getLast_Error () );
286+ throw new \Exception ($ this ->lastError );
287287
288288 return false ;
289289 }
@@ -339,7 +339,7 @@ private function processQueryResult(string $query, $result = null)
339339 $ this ->register_error ($ str );
340340
341341 // If debug ALL queries
342- $ this ->trace || $ this ->debug_all ? $ this ->debug () : null ;
342+ $ this ->trace || $ this ->debugAll ? $ this ->debug () : null ;
343343 return false ;
344344 }
345345
@@ -351,7 +351,7 @@ private function processQueryResult(string $query, $result = null)
351351
352352 // Take note of the insert_id
353353 if (\preg_match ("/^(insert|replace)\s+/i " , $ query )) {
354- $ this ->insert_id = \mysqli_insert_id ($ this ->dbh );
354+ $ this ->insertId = \mysqli_insert_id ($ this ->dbh );
355355 }
356356
357357 // Return number of rows affected
@@ -363,25 +363,25 @@ private function processQueryResult(string $query, $result = null)
363363 // Take note of column info
364364 $ i = 0 ;
365365 while ($ i < \mysqli_num_fields ($ this ->result )) {
366- $ this ->col_info [$ i ] = \mysqli_fetch_field ($ this ->result );
366+ $ this ->colInfo [$ i ] = \mysqli_fetch_field ($ this ->result );
367367 $ i ++;
368368 }
369369
370370 // Store Query Results
371371 $ num_rows = 0 ;
372372 while ($ row = \mysqli_fetch_object ($ this ->result )) {
373373 // Store results as an objects within main array
374- $ this ->last_result [$ num_rows ] = $ row ;
374+ $ this ->lastResult [$ num_rows ] = $ row ;
375375 $ num_rows ++;
376376 }
377377
378378 \mysqli_free_result ($ this ->result );
379379
380380 // Log number of rows the query returned
381- $ this ->num_rows = $ num_rows ;
381+ $ this ->numRows = $ num_rows ;
382382
383383 // Return number of rows selected
384- $ this ->return_val = $ this ->num_rows ;
384+ $ this ->return_val = $ this ->numRows ;
385385 }
386386 }
387387 }
@@ -415,10 +415,10 @@ public function query(string $query, bool $use_prepare = false)
415415 $ this ->log_query ("\$db->query( \"$ query \") " );
416416
417417 // Keep track of the last query for debug..
418- $ this ->last_query = $ query ;
418+ $ this ->lastQuery = $ query ;
419419
420420 // Count how many queries there have been
421- $ this ->num_queries ++;
421+ $ this ->numQueries ++;
422422
423423 // Use core file cache function
424424 if ($ cache = $ this ->get_cache ($ query )) {
@@ -441,7 +441,7 @@ public function query(string $query, bool $use_prepare = false)
441441
442442 if ($ this ->processQueryResult ($ query ) === false ) {
443443 if ($ this ->isTransactional )
444- throw new \Exception ($ this ->getLast_Error () );
444+ throw new \Exception ($ this ->lastError );
445445
446446 return false ;
447447 }
@@ -450,7 +450,7 @@ public function query(string $query, bool $use_prepare = false)
450450 $ this ->store_cache ($ query , $ this ->is_insert );
451451
452452 // If debug ALL queries
453- $ this ->trace || $ this ->debug_all ? $ this ->debug () : null ;
453+ $ this ->trace || $ this ->debugAll ? $ this ->debug () : null ;
454454
455455 return $ this ->return_val ;
456456 } // query
@@ -515,7 +515,7 @@ public function getCharset()
515515 }
516516
517517 /**
518- * Returns the last inserted auto-increment
518+ * Returns the last inserted Id - auto generated
519519 *
520520 * @return int
521521 */
@@ -531,7 +531,7 @@ public function beginTransaction()
531531 {
532532 /* turn autocommit off */
533533 $ this ->dbh ->autocommit (false );
534- $ this ->dbh ->begin_transaction (MYSQLI_TRANS_START_READ_WRITE );
534+ $ this ->dbh ->begin_transaction (\ MYSQLI_TRANS_START_READ_WRITE );
535535 $ this ->isTransactional = true ;
536536 }
537537
0 commit comments