feature: Print mysql errors in debug output. (#8414)

* Print mysql errors in debug output.

* drop debug flag

* Fix sensor order...
This commit is contained in:
Tony Murray
2018-03-20 06:05:23 -05:00
committed by Neil Lathwood
parent 2f25d11747
commit a9e31dca0e

View File

@ -117,7 +117,9 @@ function dbQuery($sql, $parameters = array())
$mysql_error = mysqli_error($database_link);
if (isset($config['mysql_log_level']) && ((in_array($config['mysql_log_level'], array('INFO', 'ERROR')) && !preg_match('/Duplicate entry/', $mysql_error)) || in_array($config['mysql_log_level'], array('DEBUG')))) {
if (!empty($mysql_error)) {
logfile(date($config['dateformat']['compact']) . " MySQL Error: $mysql_error ($fullSql)");
$error_msg = "MySQL Error: $mysql_error ($fullSql)";
c_echo("%R$error_msg%n\n");
logfile(date($config['dateformat']['compact']) . ' ' . $error_msg);
}
}
}