-
Notifications
You must be signed in to change notification settings - Fork 373
DATAJDBC-386 - Introduces quoting for all database identifier. #182
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
Conversation
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
22f1b0e to
dcb73d4
Compare
All database indentifiers, i.e. table names, column names and so on, now get quoted. For most databases this means they get enclosed with double quotes. For some databases this makes the the identifiers case sensitive. In order to minimize the impact we convert identifiers their default letter casing. This should be upper case according to the SQL standard but isn't for some databases. The exact behavior regarding quoting and default letter casing gets controlled by a database specific `Dialect`. Future changes will make the quoting of annotated columns and the default quoting behavior configurable.
SqlIdentifier provides now a transform(…) method to transform its content instead of exposing prefix(…) and suffix(…) methods. Composite identifiers are created through SqlIdentifier.from(…) instead of exposing a concat(…) method. We also now apply identifier normalization only to derived identifiers instead of applying normalization to annotated column and table names. This change requires references to derived field names to honor the appropriate letter casing. Identifier quotation can be disabled globally, via RelationalMappingContext.setForceQuote(false).
Tests that used the `@Column` annotation to map multiple properties to a single database column failed. Mapping multiple values to one column is possible to allow for entities inside an aggregate to have the id of the aggregate as ID or as part of the ID. The reason for the test failures was that columns get referred to by different ways: Once per DerivedSqlIdentifier (i.e. with normalized spelling). And Once per `@Column` annotation. SqlIdentifier from an `@Column` annotation have always the same spelling, while the normalized version depends on the `Dialect`. In order to make the tests work for all databases all references to the column in question had to get a `@Column` annotation. This in turn required the create scripts to also use quoting when the normal case of the database did not match the case choosen in the annotation. Finally there were some tests that used hand coded SQL which now uses `SqlIdentifier` and an injected `Dialect` to arrive at the corrrect SQL syntax.
Removed a couple of `@Ignore` annotations that got left in the code.
efb07d6 to
7cefedf
Compare
mp911de
pushed a commit
that referenced
this pull request
Jan 28, 2020
All database identifiers, i.e. table names, column names and so on, now get quoted. For most databases this means they get enclosed with double quotes. For some databases this makes the the identifiers case sensitive. In order to minimize the impact we convert identifiers their default letter casing. This should be upper case according to the SQL standard but isn't for some databases. The exact behavior regarding quoting and default letter casing gets controlled by a database specific `Dialect`. Future changes will make the quoting of annotated columns and the default quoting behavior configurable. Original pull request: #182.
mp911de
added a commit
that referenced
this pull request
Jan 28, 2020
Fix bind marker rendering for delete by Id. SqlIdentifier provides now a transform(…) method to transform its content instead of exposing prefix(…) and suffix(…) methods. Composite identifiers are created through SqlIdentifier.from(…) instead of exposing a concat(…) method. We also now apply identifier normalization only to derived identifiers instead of applying normalization to annotated column and table names. This change requires references to derived field names to honor the appropriate letter casing. Identifier quotation can be disabled globally, via RelationalMappingContext.setForceQuote(false). Move SqlIdentifier to relational.core.sql package. Original pull request: #182.
mp911de
pushed a commit
that referenced
this pull request
Jan 28, 2020
Tests that used the `@Column` annotation to map multiple properties to a single database column failed. Mapping multiple values to one column is possible to allow for entities inside an aggregate to have the id of the aggregate as ID or as part of the ID. The reason for the test failures was that columns get referred to by different ways: Once per DerivedSqlIdentifier (i.e. with normalized spelling). And Once per `@Column` annotation. SqlIdentifier from an `@Column` annotation have always the same spelling, while the normalized version depends on the `Dialect`. In order to make the tests work for all databases all references to the column in question had to get a `@Column` annotation. This in turn required the create scripts to also use quoting when the normal case of the database did not match the case chosen in the annotation. Finally there were some tests that used hand coded SQL which now uses `SqlIdentifier` and an injected `Dialect` to arrive at the correct SQL syntax. Removed a couple of `@Ignore` annotations that got left in the code. Original pull request: #182.
|
That's merged and polished now. |
This was referenced Dec 31, 2020
mp911de
added a commit
that referenced
this pull request
Feb 21, 2022
Disable JAsync tests until JAsync catches up with R2DBC SPI 0.8.
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.
DATAJDBC-386 - Introduces quoting for all database identifier.
All database indentifiers, i.e. table names, column names and so on, now get quoted.
For most databases this means they get enclosed with double quotes.
For some databases this makes the the identifiers case sensitive.
In order to minimize the impact we convert identifiers their default letter casing.
This should be upper case according to the SQL standard but isn't for some databases.
The exact behavior regarding quoting and default letter casing gets controlled by a database specific
Dialect.Future changes will make the quoting of annotated columns and the default quoting behavior configurable.