Skip to content

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

Closed
wants to merge 5 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Jan 29, 2020

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 used toString() of Condition segments which rendered an approximation of the condition. ConditionVisitor applies RenderContext settings that consider identifier quoting and normalization strategies.


Related ticket: DATAJDBC-479.

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.

private AliasedColumn(String name, Table table, String alias) {
super(name, table);
this.alias = SqlIdentifier.unquoted(alias);
Copy link
Contributor

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?

Copy link
Member Author

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.

SqlIdentifiers are now compared by considering case-sensitivity regardless of quoting.
schauder pushed a commit that referenced this pull request Feb 11, 2020
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.
schauder added a commit that referenced this pull request Feb 11, 2020
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.
@schauder
Copy link
Contributor

Rebased, polished and merged.

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.

2 participants