Correctly escape backticks in MySQL identifiers#357
Conversation
Update the `escape` function in `mysql_dialect.dart` to escape backticks by doubling them, adhering to MySQL identifier escaping rules. This also adds a unit test in `typed_sql/test/dialect/mysql_escape_test.dart` to verify the correct behavior. Co-authored-by: jonasfj <149732+jonasfj@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| }); | ||
|
|
||
| test('multiple backticks', () { | ||
| expect(escape('`a``b`'), '```a````b```'); |
|
I think generated files may need an update. |
The
escapefunction inmysql_dialect.dartwas incorrectly wrapping identifiers in backticks without escaping any existing backticks within the identifier string. This fix updates the function to double any backticks found in the name before wrapping it in backticks, which is the standard MySQL requirement for escaping identifiers. A new unit test file,typed_sql/test/dialect/mysql_escape_test.dart, was added to verify the fix and prevent future regressions. Verification was performed with a standalone Dart script as the package test environment was experiencing timeouts.PR created automatically by Jules for task 10846423631410528515 started by @jonasfj