Fix select without from in old versions of MySQL and MariaDB

This commit is contained in:
Marco Belladelli 2023-01-12 13:46:33 +01:00 committed by Christian Beikov
parent 7b308d048f
commit 73da49626d
4 changed files with 30 additions and 0 deletions

View File

@ -221,6 +221,16 @@ public class MariaDBLegacySqlAstTranslator<T extends JdbcOperation> extends Abst
return true;
}
@Override
protected String getFromDual() {
return " from dual";
}
@Override
protected String getFromDualForSelectOnly() {
return getDialect().getVersion().isBefore( 10, 4 ) ? getFromDual() : "";
}
@Override
public MariaDBLegacyDialect getDialect() {
return this.dialect;

View File

@ -238,6 +238,11 @@ public class MySQLLegacySqlAstTranslator<T extends JdbcOperation> extends Abstra
return " from dual";
}
@Override
protected String getFromDualForSelectOnly() {
return getDialect().getVersion().isBefore( 5, 7 ) ? getFromDual() : "";
}
@Override
public MySQLDialect getDialect() {
return (MySQLDialect) super.getDialect();

View File

@ -215,6 +215,16 @@ public class MariaDBSqlAstTranslator<T extends JdbcOperation> extends AbstractSq
return true;
}
@Override
protected String getFromDual() {
return " from dual";
}
@Override
protected String getFromDualForSelectOnly() {
return getDialect().getVersion().isBefore( 10, 4 ) ? getFromDual() : "";
}
@Override
public MariaDBDialect getDialect() {
return this.dialect;

View File

@ -274,6 +274,11 @@ public class MySQLSqlAstTranslator<T extends JdbcOperation> extends AbstractSqlA
return " from dual";
}
@Override
protected String getFromDualForSelectOnly() {
return getDialect().getVersion().isBefore( 5, 7 ) ? getFromDual() : "";
}
@Override
public MySQLDialect getDialect() {
return (MySQLDialect) super.getDialect();