Skip to content

Comments

Add dollar-quoting support to MySQL multi-query parser#49

Merged
JanTvrdik merged 1 commit intomainfrom
dollar-quoting-mysql
Feb 24, 2026
Merged

Add dollar-quoting support to MySQL multi-query parser#49
JanTvrdik merged 1 commit intomainfrom
dollar-quoting-mysql

Conversation

@JanTvrdik
Copy link
Member

Summary

  • Add dollar-quoting ($$, $mle$, $tag$, etc.) support to the MySQL parser, reusing the same regex pattern as the PostgreSQL parser
  • MySQL 9.0+ uses dollar-quoted delimiters for JavaScript stored program bodies (CREATE FUNCTION ... LANGUAGE JAVASCRIPT AS $mle$...$mle$)

Closes #34

Test plan

  • Edge case tests for $mle$ and $$ delimiters with semicolons inside JS function bodies
  • Nested dollar-quoted strings with different tags
  • Chunk boundary test for dollar-quoted strings spanning stream chunks
  • Full test suite passes (72 tests)

Copilot AI review requested due to automatic review settings February 24, 2026 09:14
@JanTvrdik JanTvrdik force-pushed the dollar-quoting-mysql branch from 7e5bf2a to 16c93f1 Compare February 24, 2026 09:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the MySQL multi-query parser to recognize PostgreSQL-style dollar-quoted bodies (e.g. $$...$$, $mle$...$mle$) so JavaScript stored program definitions in MySQL 9.0+ can contain semicolons without prematurely terminating statements.

Changes:

  • Add a dollar-quote branch to the MySQL query-splitting regex pattern.
  • Add MySQL edge-case tests for $mle$ / $$ bodies, nested tags, and chunk-boundary splitting.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/MySqlMultiQueryParser.php Adds dollar-quote matching to the MySQL statement regex.
tests/cases/MySqlMultiQueryParserTest.phpt Adds test coverage for dollar-quoted JS stored program bodies (including chunk boundaries).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JanTvrdik JanTvrdik merged commit fcf84f4 into main Feb 24, 2026
16 checks passed
@JanTvrdik JanTvrdik deleted the dollar-quoting-mysql branch February 24, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Javascript code in SQL query in Mysql 9

1 participant