}
@Override
public final void accept(Context<?> context) {
if (context.declareFields() || context.declareTables()) {
SQLDialect dialect = context.configuration().dialect();
boolean simulateDerivedColumnList = false;
// [#454] [#1801] Some databases don't allow "derived column names" in
// "simple class specifications", or "common table expression references".
// Hence, wrap the table reference in a subselect
if (fieldAliases != null
&& asList(CUBRID, FIREBIRD).contains(dialect.family())
&& (wrapped instanceof TableImpl || wrapped instanceof CommonTableExpressionImpl)) {
@SuppressWarnings("unchecked")
Select<Record> select =
select(list(field("*"))).from(((Table<?>) wrapped).as(alias));
context.sql("(").formatIndentStart().formatNewLine()
.visit(select).formatIndentEnd().formatNewLine()
.sql(")");
}
// [#1801] Some databases do not support "derived column names".
// They can be simulated by concatenating a dummy SELECT with no
// results using UNION ALL
else if (fieldAliases != null && asList(H2, MARIADB, MYSQL, SQLITE).contains(dialect.family())) {
simulateDerivedColumnList = true;
SelectFieldList fields = new SelectFieldList();
for (String fieldAlias : fieldAliases) {
switch (dialect.family()) {
/* [pro] xx
xxxx xxxxxxx x
xx xxxxxxxxxxx xx xxxxxx xxxxxxx xxxx xxxxx xxxxxxxxx xxxxx xx x xxxxxxx xxxxxxxxx
xx xx xxx xxxxx xxxxxxxxx xxxxxxx xx xxxxx