[#8547] Fix SQLITE comparisons against dialect
SQLITE should normally be compared against the dialect family. Also replace some occurrences of `context.configuration().dialect()` with `context.dialect()`.
This commit is contained in:
parent
2b26053a64
commit
d751d6edc7
@ -133,6 +133,10 @@ public class Databases {
|
||||
|
||||
|
||||
case POSTGRES: result = PostgresDatabase.class; break;
|
||||
|
||||
|
||||
|
||||
|
||||
case SQLITE: result = SQLiteDatabase.class; break;
|
||||
|
||||
case DEFAULT:
|
||||
|
||||
@ -226,7 +226,7 @@ final class CaseWhenStepImpl<V, T> extends AbstractFunction<T> implements CaseWh
|
||||
.visit(K_CASE);
|
||||
|
||||
int size = compareValues.size();
|
||||
switch (ctx.configuration().dialect()) {
|
||||
switch (ctx.dialect()) {
|
||||
|
||||
// The DERBY dialect doesn't support the simple CASE clause
|
||||
case DERBY: {
|
||||
|
||||
@ -1444,7 +1444,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
final BigInteger get0(BindingGetResultSetContext<U> ctx) throws SQLException {
|
||||
|
||||
// The SQLite JDBC driver doesn't support BigDecimals
|
||||
if (ctx.configuration().dialect() == SQLDialect.SQLITE)
|
||||
if (ctx.family() == SQLDialect.SQLITE)
|
||||
return Convert.convert(ctx.resultSet().getString(ctx.index()), BigInteger.class);
|
||||
|
||||
BigDecimal b = ctx.resultSet().getBigDecimal(ctx.index());
|
||||
|
||||
@ -642,7 +642,7 @@ class Function<T> extends AbstractField<T> implements
|
||||
if (name != null)
|
||||
ctx.visit(name);
|
||||
else if (term != null)
|
||||
ctx.sql(term.translate(ctx.configuration().dialect()));
|
||||
ctx.sql(term.translate(ctx.dialect()));
|
||||
else
|
||||
ctx.sql(getName());
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ final class FunctionTable<R extends Record> extends AbstractTable<R> {
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
switch (ctx.configuration().dialect()) {
|
||||
switch (ctx.dialect()) {
|
||||
case HSQLDB: {
|
||||
ctx.visit(K_TABLE).sql('(').visit(function).sql(')');
|
||||
break;
|
||||
@ -99,7 +99,7 @@ final class FunctionTable<R extends Record> extends AbstractTable<R> {
|
||||
}
|
||||
|
||||
default:
|
||||
throw new SQLDialectNotSupportedException("FUNCTION TABLE is not supported for " + ctx.configuration().dialect());
|
||||
throw new SQLDialectNotSupportedException("FUNCTION TABLE is not supported for " + ctx.dialect());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -429,7 +429,7 @@ final class MetaImpl extends AbstractMeta {
|
||||
|
||||
// SQLite JDBC's DatabaseMetaData.getColumns() can only return a single
|
||||
// table's columns
|
||||
if (columnCache == null && configuration.dialect() != SQLITE) {
|
||||
if (columnCache == null && configuration.family() != SQLITE) {
|
||||
Result<Record> columns = getColumns0(schema, "%");
|
||||
|
||||
Field<String> tableCat = (Field<String>) columns.field(0); // TABLE_CAT
|
||||
|
||||
Loading…
Reference in New Issue
Block a user