{
global $db, $show_sql, $sql_trail, $select_trail, $go_debug;
- if (!$err_msg && $go_debug)
- $err_msg = "Debug mode error";
//echo "<br>$sql<br>";
if ($show_sql)
{
}
}
- if ($err_msg != null)
- if (function_exists('xdebug_call_file'))
- check_db_error('<br>At file '.xdebug_call_file().':'.xdebug_call_line().':<br>'.$err_msg, $sql);
- else
- check_db_error($err_msg, $sql);
-
+ if ($err_msg != null || $go_debug) {
+ $exit = $err_msg != null;
+ if (function_exists('xdebug_call_file'))
+ check_db_error('<br>At file '.xdebug_call_file().':'.xdebug_call_line().':<br>'.$err_msg, $sql, $exit);
+ else
+ check_db_error($err_msg, $sql, $exit);
+ }
return $result;
}
function display_db_error($msg, $sql_statement=null, $exit=true)
{
global $db, $debug;
+
+ $warning = $msg==null;
$db_error = db_error_no();
- $str = "<span class='errortext'><b>" . _("DATABASE ERROR :") . "</b> $msg</span><br>";
+// $str = "<span class='errortext'><b>" . _("DATABASE ERROR :") . "</b> $msg</span><br>";
+ if($warning)
+ $str = "<b>" . _("Debug mode database warning:") . "</b><br>";
+ else
+ $str = "<b>" . _("DATABASE ERROR :") . "</b> $msg<br>";
if ($db_error != 0)
{
}
$str .= "<br><br>";
-
- trigger_error($str, E_USER_ERROR);
-
+ if($msg)
+ trigger_error($str, E_USER_ERROR);
+ else // $msg can be null here only in debug mode, otherwise the error is ignored
+ trigger_error($str, E_USER_WARNING);
if ($exit)
exit;
}
if ($db_error != 0)
{
- if (!frindly_db_error($db_error))
- display_db_error($msg, $sql_statement, false);
+ if (!frindly_db_error($db_error)) {
+ display_db_error($msg, $sql_statement, false);
+ }
if ($rollback_if_error)
{