Skip to content

Commit 12500c1

Browse files
committed
Fix identifier escaping.
Relates to #47
1 parent 2a61005 commit 12500c1

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

storm-core/src/main/java/st/orm/core/template/impl/DeleteProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public Object getCompilationKey(@Nonnull Delete delete) {
5252
*/
5353
@Override
5454
public CompiledElement compile(@Nonnull Delete delete, @Nonnull TemplateCompiler compiler) throws SqlTemplateException {
55-
return new CompiledElement(delete.alias().isEmpty() ? "" : compiler.dialect().getSafeIdentifier(delete.alias()));
55+
return new CompiledElement(delete.alias().isEmpty() ? "" : delete.alias());
5656
}
5757

5858
/**

storm-core/src/main/java/st/orm/core/template/impl/FromProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public Object getCompilationKey(@Nonnull From from, @Nonnull Function<TemplateSt
6464
* @throws SqlTemplateException if compilation fails.
6565
*/
6666
public CompiledElement compile(@Nonnull From from, @Nonnull TemplateCompiler compiler) throws SqlTemplateException {
67-
final String alias = from.alias().isEmpty() ? "" : " " + compiler.dialect().getSafeIdentifier(from.alias());
67+
final String alias = from.alias().isEmpty() ? "" : " " + from.alias();
6868
return new CompiledElement(switch (from) {
6969
case From(TableSource ts, String s, boolean b) ->
7070
compiler.dialectTemplate().process("\0\0", getTableName(ts.table(), compiler.template().tableNameResolver()), alias);

storm-core/src/main/java/st/orm/core/template/impl/QueryModelFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Optional<QueryModel> getQueryModel(@Nonnull List<Element> elements,
9393
var aliasedTable = new AliasedTable(
9494
primaryTable.table(),
9595
getTableName(primaryTable.table(), template.tableNameResolver()).qualified(template.dialect()),
96-
primaryTable.alias().isEmpty() ? "" : template.dialect().getSafeIdentifier(primaryTable.alias()));
96+
primaryTable.alias().isEmpty() ? "" : primaryTable.alias());
9797
validateDataType(aliasedTable.type());
9898
validateWhere(elements);
9999
return Optional.of(new QueryModelImpl(template, modelBuilder, aliasedTable, tableMapper, aliasMapper));

storm-core/src/main/java/st/orm/core/template/impl/SetProcessor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private CompiledElement compileSet(@Nonnull Data record, @Nonnull Collection<Met
160160
if (!column.version()) {
161161
args.add("%s%s = %s".formatted(table.alias().isEmpty()
162162
? ""
163-
: compiler.dialect().getSafeIdentifier(table.alias()) + ".",
163+
: table.alias() + ".",
164164
column.qualifiedName(compiler.dialect()), compiler.mapParameter(entry.getValue())));
165165
args.add(", ");
166166
} else {
@@ -197,7 +197,7 @@ private CompiledElement compileSetBindVars(@Nonnull BindVars bindVars, @Nonnull
197197
if (!column.version()) {
198198
bindVarsCount.incrementAndGet();
199199
return "%s%s = ?".formatted(
200-
table.alias().isEmpty() ? "" : compiler.dialect().getSafeIdentifier(table.alias()) + ".",
200+
table.alias().isEmpty() ? "" : table.alias() + ".",
201201
column.qualifiedName(compiler.dialect())
202202
);
203203
}
@@ -221,7 +221,7 @@ private CompiledElement compileSetBindVars(@Nonnull BindVars bindVars, @Nonnull
221221
* @return the version string for the version column.
222222
*/
223223
private static String compileVersion(@Nonnull String columnName, @Nonnull Class<?> type, @Nonnull String alias, @Nonnull SqlDialect dialect) {
224-
String a = alias.isEmpty() ? "" : dialect.getSafeIdentifier(alias) + ".";
224+
String a = alias.isEmpty() ? "" : alias + ".";
225225
String value = switch (type) {
226226
case Class<?> c when
227227
Integer.TYPE.isAssignableFrom(c)

0 commit comments

Comments
 (0)