-
Notifications
You must be signed in to change notification settings - Fork 358
DATAJDBC-479 - Use SqlIdentifier in SQL AST #187
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
Conversation
We now use SqlIdentifier to encapsulate names and aliases of tables, columns and functions.
We now use proper delegation to ConditionVisitor to render a JOIN condition. Previously, we used toString() of Condition segments which rendered an approximation of the condition. ConditionVisitor applies RenderContext settings that consider identifier quoting and normalization strategies.
spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java
Outdated
Show resolved
Hide resolved
|
||
private AliasedColumn(String name, Table table, String alias) { | ||
super(name, table); | ||
this.alias = SqlIdentifier.unquoted(alias); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a little inconsistent, since we want to go to "always quoted" as the default otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're preserving the current functionality. Our quoting can be enabled or disabled on PersistentEntity
level which is a different abstraction level. Since we're creating our SQL AST objects from these types, it's fair to not put the always quoting burden on every user of the SQL AST. You can always opt in with using SqlIdentifier
on the consumer side if you're willing to control how identifiers are rendered.
...ational/src/main/java/org/springframework/data/relational/core/sql/DefaultSqlIdentifier.java
Outdated
Show resolved
Hide resolved
SqlIdentifiers are now compared by considering case-sensitivity regardless of quoting.
We now use SqlIdentifier to encapsulate names and aliases of tables, columns and functions. We now use proper delegation to ConditionVisitor to render a JOIN condition. Previously, we used toString() of Condition segments which rendered an approximation of the condition. ConditionVisitor applies RenderContext settings that consider identifier quoting and normalization strategies. Original pull request: #187.
Fixes compiler error from rebase rebase. Removes IdentifierProcessingAdapter since it wasn't used anymore Merged UnquotedDialect with NonQuotingDialect since both served the same purpose of a simple Dialect for testing. Formatting. Original pull request: #187.
Rebased, polished and merged. |
We now use
SqlIdentifier
to encapsulate names and aliases of tables, columns and functions.This change also introduces proper delegation to ConditionVisitor to render a
JOIN
condition. Previously, we usedtoString()
ofCondition
segments which rendered an approximation of the condition.ConditionVisitor
appliesRenderContext
settings that consider identifier quoting and normalization strategies.Related ticket: DATAJDBC-479.