Added inline company switching with set_global_connection()
[fa-stable.git] / includes / errors.inc
index cafa86f48cb266eb3c492e92b5dfcac95ebeb722..c584d175f79e831d3855d0fb672910e55c8df844 100644 (file)
@@ -108,7 +108,7 @@ function end_flush() {
 
 function display_db_error($msg, $sql_statement=null, $exit=true)
 {
-       global $db, $debug, $go_debug;
+       global $db, $debug, $go_debug, $db_connections;
 
        $warning = $msg==null;
        $db_error = db_error_no();
@@ -127,7 +127,9 @@ function display_db_error($msg, $sql_statement=null, $exit=true)
        
        if ($debug == 1) 
        {
-               $str .= "sql that failed was : " . $sql_statement . "<br>";
+               $cur_prefix = $db_connections[$_SESSION["wa_current_user"]->cur_con]['tbpref'];
+
+               $str .= "sql that failed was : ".str_replace(TB_PREF, $cur_prefix, $sql_statement)."<br>";
                if ($go_debug > 1) display_backtrace();
        }