From b00dbf08f5deeb36ab02472e675e843f89e1cedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 24 Jun 2004 13:02:23 +0000 Subject: Show last SELECT result also when there are comments behind last query. --- read_dump.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'read_dump.php') diff --git a/read_dump.php b/read_dump.php index 93e10be037..a7a27e2eac 100644 --- a/read_dump.php +++ b/read_dump.php @@ -223,7 +223,7 @@ if ($sql_query != '') { $save_bandwidth_pieces = $max_file_pieces; } else { - $sql_query_cpy = implode(";\n", $pieces) . ';'; + $sql_query_cpy = $sql_query; // Be nice with bandwidth... for now, an arbitrary limit of 500, // could be made configurable but probably not necessary if (($max_nofile_length != 0 && (strlen($sql_query_cpy) > $max_nofile_length)) @@ -252,9 +252,14 @@ if ($sql_query != '') { $info_msg = ''; $info_count = 0; - for ($i = 0; $i < $pieces_count; $i++) { - $a_sql_query = $pieces[$i]; - if ($i == $pieces_count - 1 && preg_match('@^(SELECT|SHOW)@i', $a_sql_query)) { + // just skip last empty query (can contain just comments at the end) + $count = $pieces_count; + if ($pieces[$count - 1]['empty']) $count--; + + for ($i = 0; $i < $count; $i++) { + $a_sql_query = $pieces[$i]['query']; + + if ($i == $count - 1 && preg_match('@^(SELECT|SHOW)@i', $a_sql_query)) { $complete_query = $sql_query; $display_query = $sql_query; $sql_query = $a_sql_query; -- cgit v1.2.3