fix: handle DELIMITER directives when bypassing the parser for MySQL/MariaDB - #308
Open
mvanhorn wants to merge 2 commits into
Open
fix: handle DELIMITER directives when bypassing the parser for MySQL/MariaDB#308mvanhorn wants to merge 2 commits into
mvanhorn wants to merge 2 commits into
Conversation
Parse quoted DELIMITER arguments, treat backslashes literally in quoted identifiers, and seed quote parsing from the connection SQL mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MySQL/MariaDB statements that use the
DELIMITERdirective (and the$$/custom terminators around stored routines) failed when the query was sent through the parser-bypass path: the client split on the literal;inside the routine body instead of the active delimiter, so multi-statement routine definitions were truncated. This handlesDELIMITERdirectives when bypassing the parser so those statements execute intact.Why
DELIMITERis a client-side directive, not SQL the server sees, so the bypass path has to track the active terminator itself. The change parsesDELIMITERlines (including quoted arguments), respects the current SQL mode when interpreting quoted identifiers, treats backslashes literally inside quoted identifiers, and splits the batch on the active delimiter rather than a hardcoded;.Testing
cargo test mysql-- 16 tests pass, including coverage for quotedDELIMITERarguments, backslash handling in quoted identifiers, and SQL-mode-dependent quote parsing.Closes #282