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

Enclose columns in bag quotation marks #385

Merged
merged 4 commits into from
Feb 8, 2025

Conversation

takapi327
Copy link
Owner

@takapi327 takapi327 commented Feb 8, 2025

Implementation Details

Statement columns currently generated by the Query Builder are not enclosed in bag quotes. Therefore, using reserved naming in MySQL will result in an error that the query syntax is incorrect.

case class Hoge(yearMonth: YearMonth) derives Table

println(TableQuery[Hoge].selectAll.statement)
// SELECT year_month FROM hoge

Make the change because this problem can be solved by simply enclosing the columns in bag quotation marks.

case class Hoge(yearMonth: YearMonth) derives Table

println(TableQuery[Hoge].selectAll.statement)
// SELECT `year_month` FROM hoge

Fixes

Fixes #365

Pull Request Checklist

  • Wrote unit and integration tests
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code formatting by scalafmt (sbt scalafmtAll command execution)
  • Add copyright headers to new files

References

@takapi327 takapi327 added the 🔧 refactor Refactoring label Feb 8, 2025
@takapi327 takapi327 added this to the 0.3.0 milestone Feb 8, 2025
@takapi327 takapi327 self-assigned this Feb 8, 2025
@takapi327 takapi327 added project:queryBuilder Addition and modification of functionality to Query Builder projects project:schema Addition and modification of functionality to Schema projects project:statement Addition and modification of functionality to Statement projects labels Feb 8, 2025
@takapi327 takapi327 merged commit 530662f into master Feb 8, 2025
27 checks passed
@takapi327 takapi327 deleted the refactor/2025-02-Issues-365 branch February 8, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project:queryBuilder Addition and modification of functionality to Query Builder projects project:schema Addition and modification of functionality to Schema projects project:statement Addition and modification of functionality to Statement projects 🔧 refactor Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enclose columns in bag quotation marks
1 participant