From 6adfdb3b440b9757d97f3d3c3ef49777656ba347 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Sun, 27 Mar 2011 12:40:55 +0100 Subject: [PATCH] Feature Request #3163355 - Skip dumping data comment if table is empty. --- libraries/export/sql.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/libraries/export/sql.php b/libraries/export/sql.php index 778662c8c..acfdf11f8 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -953,15 +953,6 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) } // it's not a VIEW - $head = PMA_possibleCRLF() - . PMA_exportComment() - . PMA_exportComment(__('Dumping data for table') . ' ' . $formatted_table_name) - . PMA_exportComment(); - - if (! PMA_exportOutputHandler($head)) { - return FALSE; - } - $buffer = ''; // analyze the query to get the true column names, not the aliases @@ -977,13 +968,6 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) } if ($result != FALSE) { - // emit a single CRLF before the first data statement (produces - // an unintended CRLF when there is no data, but I don't see how it - // can be avoided, as we are in UNBUFFERED mode) - if (! PMA_exportOutputHandler($crlf)) { - return FALSE; - } - $fields_cnt = PMA_DBI_num_fields($result); // Get field information @@ -1053,6 +1037,16 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) } while ($row = PMA_DBI_fetch_row($result)) { + if ($current_row == 0) { + $head = PMA_possibleCRLF() + . PMA_exportComment() + . PMA_exportComment(__('Dumping data for table') . ' ' . $formatted_table_name) + . PMA_exportComment() + . $crlf; + if (! PMA_exportOutputHandler($head)) { + return FALSE; + } + } $current_row++; for ($j = 0; $j < $fields_cnt; $j++) { // NULL