display MySQL warnings in debug mode
[racktables] / wwwroot / inc / interface-lib.php
index 548ad475569828546c8f42fddbf4c07cd3333250..816f95b0d323eff917fafc4be1852dd4f7ccacda 100644 (file)
@@ -1183,4 +1183,28 @@ function makeHtmlTag ($tagname, $attributes = array())
        return $ret;
 }
 
+function showMySQLWarnings()
+{
+       global $debug_mode, $rtdebug_mysql_warnings;
+       if (! isset ($debug_mode) || ! $debug_mode || ! isset ($rtdebug_mysql_warnings))
+               return;
+       foreach ($rtdebug_mysql_warnings as $each)
+       {
+               $text = $each['Code'] . ': ' . $each['Message'];
+               switch ($each['Level'])
+               {
+               case 'Warning':
+                       showWarning ($text);
+                       break;
+               case 'Note':
+                       showNotice ($text);
+                       break;
+               default:
+                       showError ($text);
+                       break;
+               }
+       }
+       $rtdebug_mysql_warnings = array();
+}
+
 ?>