Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Support sql mode NO_BACKSLASH_ESCAPES #267

Closed
mirromutth opened this issue Mar 28, 2024 · 0 comments · Fixed by #268
Closed

[feature] Support sql mode NO_BACKSLASH_ESCAPES #267

mirromutth opened this issue Mar 28, 2024 · 0 comments · Fixed by #268
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mirromutth
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When sql_mode contains NO_BACKSLASH_ESCAPES, MySQL server does not allow the use of \ as an escape character. In this mode, we should not use \ to escape strings.

For example:

CREATE TABLE escape_test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value VARCHAR(50) NOT NULL);

INSERT INTO escape_test (`value`) VALUES ('my\ndata');

SELECT * FROM escape_test WHERE value = 'my
data'; -- 1 row
SELECT * FROM escape_test WHERE value = 'my\ndata'; -- 1 row

SET SESSION sql_mode = 'NO_BACKSLASH_ESCAPES';

SELECT * FROM escape_test WHERE value = 'my
data'; -- 1 row
SELECT * FROM escape_test WHERE value = 'my\ndata'; -- 0 row

Describe the solution you'd like

  • Make ServerStatuses.NO_BACKSLASH_ESCAPES available
  • If NO_BACKSLASH_ESCAPES is set, disable escape
  • For the innodb_lock_wait_timeout, use SHOW VARIABLES LIKE 'innodb\_lock\_wait\_timeout' instead of SHOW VARIABLES LIKE 'innodb\\_lock\\_wait\\_timeout'
@mirromutth mirromutth added the enhancement New feature or request label Mar 28, 2024
@mirromutth mirromutth added this to the 1.1.3 milestone Mar 28, 2024
@mirromutth mirromutth self-assigned this Mar 28, 2024
@mirromutth mirromutth linked a pull request Mar 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant