diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index 43c88f553e..47c7c9e94c 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -204,7 +204,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} * @author Mike Beck */ function PMA_format_sql ($sql) { - global $cfg; + global $cfg, $mult; $_sfuncs = '^' . implode('$|^', $cfg['Functions']) . '$'; $_skeyw = '^' . implode('$|^', $cfg['keywords']) . '$'; @@ -218,6 +218,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} $sql = str_replace(',', ', ', $sql); $sql = str_replace(')', ' ) ', $sql); $sql = str_replace('(', ' ( ', $sql); + $sql = str_replace(';', ' ; ', $sql); // now split everything by the blanks $_sql_parts=explode(' ',$sql); // start a loop over the parts check each word and put them back into $sql @@ -251,7 +252,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} $_word = '' . $_word . ''; } else { if(eregi($_skeyw, $_word)) { - $_word = "\n".'' . $_word . ''; + $_word = '' . $_word . ''; + if(isset($mult) && $mult == TRUE){ + } else { + $_word = "\n" . $_word; + } + } else { if(eregi($_scoltype, $_word)) { $_word = '' . $_word . ''; @@ -268,6 +274,10 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} } else { $_brack_c[]=$s_nr; } + } else { + if($_word==';') { + $_word = ";\n"; + } } } } @@ -293,7 +303,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} } } $sql = implode(' ',$_sql_p); - return $sql; + return nl2br($sql); } // End of PMA_format_sql function /** @@ -338,9 +348,9 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} . ']' . "\n"; } // end if if($cfg['UseSyntaxColoring']){ - echo '
' . "\n" . PMA_format_sql($query_base) . "\n" . '
' . "\n"; + echo '

' . "\n" . PMA_format_sql($query_base) . "\n" . '

' . "\n"; } else { - echo '
' . "\n" . $query_base . "\n" . '
' . "\n"; + echo '

' . "\n" . $query_base . "\n" . '

' . "\n"; } echo '

' . "\n"; } // end if diff --git a/read_dump.php3 b/read_dump.php3 index 7e1604e75c..ceb3db286c 100644 --- a/read_dump.php3 +++ b/read_dump.php3 @@ -320,6 +320,7 @@ if ($sql_query != '') { $pieces = array(); PMA_splitSqlFile($pieces, $sql_query, PMA_MYSQL_INT_VERSION); $pieces_count = count($pieces); + if($pieces_count>1){$is_multiple = TRUE;} // Copy of the cleaned sql statement for display purpose only (see near the // beginning of "db_details.php3" & "tbl_properties.php3") @@ -349,6 +350,7 @@ if ($sql_query != '') { // Runs multiple queries else if (mysql_select_db($db)) { + $mult = TRUE; for ($i = 0; $i < $pieces_count; $i++) { $a_sql_query = $pieces[$i]; $result = mysql_query($a_sql_query);