@@ -111,7 +111,7 @@ function query($sql, $file='', $line=0, $funktion='', $params=[]) {
111111 if (empty ($ params )) {
112112 $ result = mysqli_query ($ this ->conn , $ sql );
113113 /* Log SQL-Queries not upgraded to Prepared Statements */
114- if ( DEVELOPMENT ) error_log ( sprintf ( ' [DEPRECATED] <%s> Required SQL-Query update for mysqli_prepare(): %s:%d ' , $ funktion , $ file , $ line) );
114+ zorgDebugger:: me ()-> debug ( ' <%s> is no SQL prepared statement, in %s:%d ' , [ $ funktion , $ file , $ line] );
115115 } else {
116116 $ stmt = mysqli_prepare ($ this ->conn , $ sql );
117117 if ($ stmt === false ) throw new mysqli_sql_exception (mysqli_error ($ this ->conn ));
@@ -187,7 +187,7 @@ function query($sql, $file='', $line=0, $funktion='', $params=[]) {
187187 }
188188 }
189189 } catch (mysqli_sql_exception $ e ) {
190- if ( DEVELOPMENT === true ) var_dump ([ $ file , $ funktion , $ line , $ sql , $ params ]);
190+ zorgDebugger:: me ()-> debug ( ' %s ' , [ $ e -> getMessage () ]);
191191 die ($ e ->getMessage ());
192192 }
193193 }
@@ -310,7 +310,7 @@ function numfields($result) {
310310 * @return array
311311 */
312312 function tables () {
313- $ query = " SHOW TABLES FROM " . $ _ENV ['MYSQL_DATABASE ' ];
313+ $ query = ' SHOW TABLES FROM ' . $ _ENV ['MYSQL_DATABASE ' ];
314314 $ result = mysqli_query ($ this ->conn , $ query );
315315 $ tables = array ();
316316 while ($ row = mysqli_fetch_row ($ result )) {
@@ -348,7 +348,7 @@ function insert($table, $values, $file='', $line=0, $funktion=null)
348348 $ insertKeys = '(` ' .implode ('`,` ' , array_keys ($ values )).'`) ' ;
349349 $ insertValues = implode (', ' , array_fill (0 , count ($ values ), '? ' ));
350350 $ sql = sprintf ('INSERT INTO `%s` %s VALUES (%s) ' , $ table , $ insertKeys , $ insertValues );
351- if ( DEVELOPMENT === true ) error_log ( sprintf ( ' [DEBUG] <%s:%d> $db->insert() query : %s%s ' , __METHOD__ , __LINE__ , $ sql , print_r ($ values ,true )) );
351+ zorgDebugger:: me ()-> debug ( ' $db->insert() SQL : %s%s ' , [ $ sql , print_r ($ values ,true )] );
352352 foreach ($ values as $ key => $ val ) {
353353 if (strtolower ($ val ) === 'now() ' ) {
354354 $ values [$ key ] = timestamp (true ); // Fix "NOW()" => NOW() without quotes
@@ -429,15 +429,14 @@ function update($table, $id, $values, $file='', $line='', $funktion='')
429429 $ conditions [$ id [$ i ]] = $ id [$ i +1 ]; // map $id[0] => $id[1], $id[2] => $id[3],... to $conditions-Array
430430 $ i ++;
431431 }
432- //if (DEVELOPMENT === true) error_log(sprintf('[DEBUG] <%s:%d> $db->update() $conditions[ %s ]', __METHOD__, __LINE__, print_r($conditions,true)));
433432 foreach ($ conditions as $ field => $ value ) {
434433 $ sql .= $ field .'=? ' ;//.(is_numeric($value) ? $value : '"'.$value.'"');
435434 $ params [] = $ value ;
436435 end ($ conditions ); // @link https://stackoverflow.com/a/8780881/5750030
437436 if ($ field !== key ($ conditions )) $ sql .= ' OR ' ; // Add Separator if not last Array-Iteration
438437 }
439438 }
440- if ( DEVELOPMENT === true ) error_log ( sprintf ( ' [DEBUG] <%s:%d> $db->update() $sql : %s ' , __METHOD__ , __LINE__ , $ sql) );
439+ zorgDebugger:: me ()-> debug ( ' $db->update() SQL : %s ' , [ $ sql] );
441440 return $ this ->query ($ sql , $ file , $ line , $ funktion , $ params );
442441 //return mysql_affected_rows();
443442 }
0 commit comments