#1841 - SqlServer findCount with @Aggregation gives SQLException:No column name was specified for column 2 of 'c'

This commit is contained in:
rob bygrave
2019-10-11 20:18:18 +13:00
parent b665d8375c
commit e00aa479ae
6 changed files with 29 additions and 32 deletions
@@ -96,7 +96,7 @@ public final class SqlTreeBuilder {
* support the where and/or order by clause. If so these extra joins are added
* to the root node.
*/
SqlTreeBuilder(CQueryBuilder builder, OrmQueryRequest<?> request, CQueryPredicates predicates) {
SqlTreeBuilder(String columnAliasPrefix, CQueryBuilder builder, OrmQueryRequest<?> request, CQueryPredicates predicates) {
this.rawSql = false;
this.rawNoId = false;
@@ -116,7 +116,8 @@ public final class SqlTreeBuilder {
String fromForUpdate = builder.fromForUpdate(query);
CQueryHistorySupport historySupport = builder.getHistorySupport(query);
CQueryDraftSupport draftSupport = builder.getDraftSupport(query);
this.ctx = new DefaultDbSqlContext(alias, builder, !subQuery, historySupport, draftSupport, fromForUpdate);
String colAlias = subQuery ? null : columnAliasPrefix;
this.ctx = new DefaultDbSqlContext(alias, colAlias, historySupport, draftSupport, fromForUpdate);
}
/**