Take an optional debug param in dbQuery

This commit is contained in:
Isaac Connor 2020-12-01 14:07:23 -05:00
parent ae7a706526
commit baeb1dbd5b
1 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ function dbEscape( $string ) {
return $dbConn->quote($string);
}
function dbQuery($sql, $params=NULL) {
function dbQuery($sql, $params=NULL, $debug = false) {
global $dbConn;
if ( dbLog($sql, true) )
return;
@ -142,7 +142,7 @@ function dbQuery($sql, $params=NULL) {
return NULL;
}
} else {
if ( defined('ZM_DB_DEBUG') ) {
if ( defined('ZM_DB_DEBUG') or $debug ) {
ZM\Logger::Debug("SQL: $sql values:" . ($params?implode(',',$params):''));
}
$result = $dbConn->query($sql);
@ -151,7 +151,7 @@ function dbQuery($sql, $params=NULL) {
return NULL;
}
}
if ( defined('ZM_DB_DEBUG') ) {
if ( defined('ZM_DB_DEBUG') or $debug ) {
if ( $params )
ZM\Logger::Debug("SQL: $sql " . implode(',',$params) . ' rows: '.$result->rowCount());
else