Fix quoting issue on generate sql statements#1395
Closed
MarcelEeken wants to merge 1 commit intoJSONAPI-Resources:masterfrom
Closed
Fix quoting issue on generate sql statements#1395MarcelEeken wants to merge 1 commit intoJSONAPI-Resources:masterfrom
MarcelEeken wants to merge 1 commit intoJSONAPI-Resources:masterfrom
Conversation
Using the previous method to generate the quote string could lead to incorrect sql statement where double quotes were used for select statements in MySql. By using the `quote_table_name` function from Rails, the correct quoting mechnism will be automatically used for the specific database. Fixes JSONAPI-Resources#1369
7 tasks
bf4
reviewed
Jan 12, 2023
|
|
||
| def quote(field) | ||
| "\"#{field.to_s}\"" | ||
| ActiveRecord::Base.connection.quote_table_name(field) |
Collaborator
There was a problem hiding this comment.
can you write a test for this?
Contributor
Author
There was a problem hiding this comment.
There was an existing open mr that added mysql to the CI workflow. That was opened to cover the same case as this fix.
Would that mr be enough of a test-case
https://github.com/cerebris/jsonapi-resources/pull/1370
Collaborator
|
Here is an example of getting a test to fail for this issue: as others have said, adding MySQL to CI matrix would surface this issue. |
Collaborator
|
resolved in v011-dev via https://github.com/cerebris/jsonapi-resources/pull/1400 and https://github.com/cerebris/jsonapi-resources/pull/1370 if this is needed in another branch, let's re-use those learnings and apply there |
zion
referenced
this pull request
in zion/jsonapi-resources
May 10, 2024
Implementing fix from issue JSONAPI-Resources#1369. https://github.com/cerebris/jsonapi-resources/pull/1395
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.
Using the previous method to generate the quote string could lead to incorrect sql statement where double quotes were used for select statements in MySql.
By using the
quote_table_namefunction from Rails, the correct quoting mechnism will be automatically used for the specific database.Fixes #1369
All Submissions:
Bug fixes and Changes to Core Features:
Test Plan:
Reviewer Checklist: