[Phpmyadmin-devel] export: about using "--"

Marc Delisle DelislMa at CollegeSherbrooke.qc.ca
Sat Sep 18 07:17:09 CEST 2004

Michal C(ihar( a écrit :
> On Mon 13. 9. 2004 19:26, Marc Delisle wrote:
>>here is IMO a MySQL (at least 4.0.20) bug, but maybe we could put a
>>workaround in the export logic.
>>If the last exported table has no data, the export file
>>ends with those ANSI-style comments:
>>-- Dumping data from table table1
>>and MySQL gives an error on this!
>>No problem if the file ends with MySQL-style comments.
> The problem is that phpMyAdmin removes trailing space, so it is not valid ANSI 
> comment then:
> #1064 - You have an error in your SQL syntax.  Check the manual that 
> corresponds to your MySQL server version for the right syntax to use near 
> '--' at line 3
> I currently don't have time to track where the space is being trimmed...

The trim occurs at 2 places:

read_dump.php, line 138
libraries/read_dump.lib.php, line 21

The bug is fixed by replacing the one at line 21 by
$sql          = rtrim($sql, "\n\r");

(avoid removing the last space which is necessary for ANSI-style comment)

and removing the one at line 138, however can someone tell me the 
purpose of the trim at line 138?


More information about the Developers mailing list