Skip to content

Allow setting sql_mode #52

Closed
Closed
@back-2-95

Description

If MySQL server has sql_mode which has ANSI or ANSI_QUOTES, it might results double quotes in dump file instead of backticks. And this might then break importing that dump back.

Always changing sql_mode on server side is not possible or it is for some other reason blocked.

If mysqldump-php would allow setting sql_mode, then developer using this library could go around the issue.

This is possible and I tested it by adding following to src/DumpSettings.php

$this->settings['init_commands'][] = "SET SESSION sql_mode='REAL_AS_FLOAT,PIPES_AS_CONCAT,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES'";

See Smile-SA/gdpr-dump#145 for related discussion.

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions