ifsnop / mysqldump-php

PHP version of mysqldump cli that comes with MySQL
https://github.com/ifsnop/mysqldump-php
GNU General Public License v3.0
1.25k stars 300 forks source link

Not normalize line ending (CRLF, LF mixed in one export) #281

Closed ve3 closed 2 months ago

ve3 commented 6 months ago

MySQLDump-PHP version 2.12

Export settings:

$dumpSettings = [
    'include-tables' => $tables,
    'add-drop-table' => true,
    'default-character-set' => \Ifsnop\Mysqldump\Mysqldump::UTF8MB4,
    'routines' => true,
];

When I export with functions, or routines. It exports with line ending CRLF and LF mixed together. Example:

DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `udf_NaturalSortFormat`(`instring` varchar(4000), `numberLength` int, `sameOrderChars` char(50)) RETURNS varchar(4000) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci
    NO SQL
    DETERMINISTIC
    SQL SECURITY INVOKER

From the code above, the line DELIMITER end with CRLF but other lines in the functions or routines are end with LF.

I think it would be better if we normalize the line ending to be the same on all lines.

ifsnop commented 2 months ago

That code is created by the mysql server side, not by mysqldump-php. I see some danger trying to modify mysql generated code. This issue should be reported upstream as far as I understand.