diff --git a/db_readdump.php3 b/db_readdump.php3 index 942bd39bf..30f87c4ec 100755 --- a/db_readdump.php3 +++ b/db_readdump.php3 @@ -82,8 +82,10 @@ if ($sql_query != '') { $pieces = split_sql_file($sql_query, ';'); $pieces_count = count($pieces); - for($i = 0; $i < $pieces_count; $i++) - $pieces[$i] = expand_sql_query($pieces[$i]); + // Handles table aliases + for ($i = 0; $i < $pieces_count; $i++) { + $pieces[$i] = expand_sql_query($pieces[$i]); + } // Only one query to run if ($pieces_count == 1 && !empty($pieces[0]) && $view_bookmark == 0) { diff --git a/lib.inc.php3 b/lib.inc.php3 index aa5414d27..befad2f9e 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -606,6 +606,102 @@ window.parent.frames['nav'].location.replace('./left.php3?lang== 2) { + $sql = preg_replace('/\W' . $data[1] . '\./i', ' ' . $data[0] . '.', $sql); + if (!isset($match)) { + $match = $data[0] . ' ' . $data[1]; + } + $sql = str_replace($match, ' ' . $data[0], $sql); + } // end if + } // end while + + return $sql; + } // end of the 'expand_sql_query()' function + + /** * Displays a navigation bar to browse among the results of a sql query * @@ -1549,100 +1645,6 @@ var errorMsg2 = '= 2) //now in form "departments d" - { $sql = preg_replace("/\W$data[1]\./i"," ".$data[0].".",$sql); - if(!isset($match)) - $match = $data[0]." ".$data[1]; - $sql = str_replace($match," ".$data[0],$sql); - } //if - } //foreach - - return $sql; - } // function expand_sql_query /** * Removes # type remarks from large sql files