Skip to content

Commit 0609df0

Browse files
committed
Reenable quoting for SqlServerDialect.
Quoting is important since it allows use of keywords as names. We do not change the letter casing. In a default setup the database does not care since it is case-insensitive. If configured to be case-sensitive it makes sense to pass on what ever letter casing there is, since you seem to care. Closes #1216 See #914
1 parent 7b1f680 commit 0609df0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlGeneratorUnitTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ void findAllSortedWithNullHandling_ignoresNullHandlingWhenDialectDoesNotSupportI
287287
String sql = sqlGenerator
288288
.getFindAll(Sort.by(new Sort.Order(Sort.Direction.ASC, "name", Sort.NullHandling.NULLS_LAST)));
289289

290-
assertThat(sql).endsWith("ORDER BY dummy_entity.x_name ASC");
290+
assertThat(sql).endsWith("ORDER BY \"dummy_entity\".\"x_name\" ASC");
291291
}
292292

293293
@Test // DATAJDBC-101

spring-data-relational/src/main/java/org/springframework/data/relational/core/dialect/SqlServerDialect.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public boolean supportedForBatchOperations() {
4444
}
4545
};
4646

47+
private static final IdentifierProcessing IDENTIFIER_PROCESSING = IdentifierProcessing
48+
.create(IdentifierProcessing.Quoting.ANSI, IdentifierProcessing.LetterCasing.AS_IS);
49+
4750
protected SqlServerDialect() {}
4851

4952
@Override
@@ -122,7 +125,7 @@ public SelectRenderContext getSelectContext() {
122125

123126
@Override
124127
public IdentifierProcessing getIdentifierProcessing() {
125-
return IdentifierProcessing.NONE;
128+
return IDENTIFIER_PROCESSING;
126129
}
127130

128131
@Override

0 commit comments

Comments
 (0)