Skip to content

Commit 37b144f

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 9ec6a52 commit 37b144f

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
@@ -262,7 +262,7 @@ void findAllSortedWithNullHandling_ignoresNullHandlingWhenDialectDoesNotSupportI
262262

263263
String sql = sqlGenerator.getFindAll(Sort.by(new Sort.Order(Sort.Direction.ASC, "name", Sort.NullHandling.NULLS_LAST)));
264264

265-
assertThat(sql).endsWith("ORDER BY dummy_entity.x_name ASC");
265+
assertThat(sql).endsWith("ORDER BY \"dummy_entity\".\"x_name\" ASC");
266266
}
267267

268268
@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
@@ -162,7 +165,7 @@ public SelectRenderContext getSelectContext() {
162165

163166
@Override
164167
public IdentifierProcessing getIdentifierProcessing() {
165-
return IdentifierProcessing.NONE;
168+
return IDENTIFIER_PROCESSING;
166169
}
167170

168171
@Override

0 commit comments

Comments
 (0)