[#2383] Remove org.jooq.Context marker interface - Removed references to
org.jooq.Context
This commit is contained in:
parent
39b20216a9
commit
427a09ecac
@ -37,7 +37,6 @@ package org.jooq.impl;
|
||||
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.DataType;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.QueryPart;
|
||||
@ -65,25 +64,17 @@ abstract class AbstractFunction<T> extends AbstractField<T> {
|
||||
|
||||
@Override
|
||||
public final void toSQL(RenderContext ctx) {
|
||||
ctx.sql(getFunction(ctx));
|
||||
ctx.sql(getFunction0(ctx.configuration()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void bind(BindContext ctx) {
|
||||
ctx.bind(getFunction(ctx));
|
||||
}
|
||||
|
||||
final QueryPart getFunction(Context<?> ctx) {
|
||||
return getFunction0(ctx);
|
||||
ctx.bind(getFunction0(ctx.configuration()));
|
||||
}
|
||||
|
||||
final Field<?>[] getArguments() {
|
||||
return arguments;
|
||||
}
|
||||
|
||||
final QueryPart getFunction0(Context<?> ctx) {
|
||||
return getFunction0(ctx.configuration());
|
||||
}
|
||||
|
||||
abstract QueryPart getFunction0(Configuration configuration);
|
||||
}
|
||||
|
||||
@ -38,11 +38,12 @@ package org.jooq.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.ContextDSL;
|
||||
import org.jooq.QueryPart;
|
||||
import org.jooq.QueryPartInternal;
|
||||
import org.jooq.RenderContext;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
import org.jooq.exception.SQLDialectNotSupportedException;
|
||||
|
||||
@ -142,7 +143,14 @@ abstract class AbstractQueryPart implements QueryPartInternal {
|
||||
/**
|
||||
* Internal convenience method
|
||||
*/
|
||||
protected final ContextDSL create(Context<?> ctx) {
|
||||
protected final ContextDSL create(RenderContext ctx) {
|
||||
return Factory.using(ctx.configuration());
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal convenience method
|
||||
*/
|
||||
protected final ContextDSL create(BindContext ctx) {
|
||||
return Factory.using(ctx.configuration());
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ import java.util.List;
|
||||
|
||||
import org.jooq.ArrayRecord;
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.Param;
|
||||
import org.jooq.Record;
|
||||
@ -164,17 +164,17 @@ class ArrayTable extends AbstractTable<Record> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void toSQL(RenderContext context) {
|
||||
context.sql(table(context));
|
||||
public final void toSQL(RenderContext ctx) {
|
||||
ctx.sql(table(ctx.configuration()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void bind(BindContext context) {
|
||||
context.bind(table(context));
|
||||
public final void bind(BindContext ctx) {
|
||||
ctx.bind(table(ctx.configuration()));
|
||||
}
|
||||
|
||||
private final Table<Record> table(Context<?> ctx) {
|
||||
switch (ctx.configuration().getDialect()) {
|
||||
private final Table<Record> table(Configuration configuration) {
|
||||
switch (configuration.getDialect()) {
|
||||
case ORACLE: {
|
||||
if (array.getDataType().getType().isArray()) {
|
||||
return simulate().as(alias);
|
||||
@ -202,7 +202,7 @@ class ArrayTable extends AbstractTable<Record> {
|
||||
}
|
||||
|
||||
else {
|
||||
throw new SQLDialectNotSupportedException("ARRAY TABLE is not supported for " + ctx.configuration().getDialect());
|
||||
throw new SQLDialectNotSupportedException("ARRAY TABLE is not supported for " + configuration.getDialect());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,9 +38,10 @@ package org.jooq.impl;
|
||||
import static org.jooq.impl.Factory.falseCondition;
|
||||
import static org.jooq.impl.Factory.fieldByName;
|
||||
import static org.jooq.impl.Factory.one;
|
||||
import static org.jooq.impl.Factory.using;
|
||||
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.RenderContext;
|
||||
@ -116,13 +117,13 @@ class ArrayTableSimulation extends AbstractTable<Record> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void toSQL(RenderContext context) {
|
||||
context.sql(table(context));
|
||||
public final void toSQL(RenderContext ctx) {
|
||||
ctx.sql(table(ctx.configuration()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void bind(BindContext context) throws DataAccessException {
|
||||
context.bind(table(context));
|
||||
public final void bind(BindContext ctx) throws DataAccessException {
|
||||
ctx.bind(table(ctx.configuration()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -130,7 +131,7 @@ class ArrayTableSimulation extends AbstractTable<Record> {
|
||||
return field;
|
||||
}
|
||||
|
||||
private final Table<Record> table(Context<?> ctx) {
|
||||
private final Table<Record> table(Configuration configuration) {
|
||||
if (table == null) {
|
||||
Select<Record> select = null;
|
||||
|
||||
@ -138,7 +139,7 @@ class ArrayTableSimulation extends AbstractTable<Record> {
|
||||
|
||||
// [#1081] Be sure to get the correct cast type also for null
|
||||
Field<?> val = Factory.val(element, field.fields[0].getDataType());
|
||||
Select<Record> subselect = create(ctx).select(val.as("COLUMN_VALUE")).select();
|
||||
Select<Record> subselect = using(configuration).select(val.as("COLUMN_VALUE")).select();
|
||||
|
||||
if (select == null) {
|
||||
select = subselect;
|
||||
@ -150,7 +151,7 @@ class ArrayTableSimulation extends AbstractTable<Record> {
|
||||
|
||||
// Empty arrays should result in empty tables
|
||||
if (select == null) {
|
||||
select = create(ctx).select(one().as("COLUMN_VALUE")).select().where(falseCondition());
|
||||
select = using(configuration).select(one().as("COLUMN_VALUE")).select().where(falseCondition());
|
||||
}
|
||||
|
||||
table = select.asTable(alias);
|
||||
|
||||
@ -53,7 +53,7 @@ import static org.jooq.impl.Factory.val;
|
||||
import org.jooq.BetweenAndStep;
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.QueryPartInternal;
|
||||
import org.jooq.RenderContext;
|
||||
@ -90,17 +90,17 @@ class BetweenCondition<T> extends AbstractCondition implements BetweenAndStep<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void bind(BindContext context) {
|
||||
delegate(context).bind(context);
|
||||
public final void bind(BindContext ctx) {
|
||||
delegate(ctx.configuration()).bind(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void toSQL(RenderContext context) {
|
||||
delegate(context).toSQL(context);
|
||||
public final void toSQL(RenderContext ctx) {
|
||||
delegate(ctx.configuration()).toSQL(ctx);
|
||||
}
|
||||
|
||||
private final QueryPartInternal delegate(Context<?> ctx) {
|
||||
if (symmetric && asList(ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, MYSQL, ORACLE, SQLSERVER, SQLITE, SYBASE).contains(ctx.configuration().getDialect())) {
|
||||
private final QueryPartInternal delegate(Configuration configuration) {
|
||||
if (symmetric && asList(ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, MYSQL, ORACLE, SQLSERVER, SQLITE, SYBASE).contains(configuration.getDialect())) {
|
||||
if (not) {
|
||||
return (QueryPartInternal) field.notBetween(minValue, maxValue).and(field.notBetween(maxValue, minValue));
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.Factory.trueCondition;
|
||||
import static org.jooq.impl.Factory.using;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -44,7 +45,6 @@ import java.util.List;
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.PivotForStep;
|
||||
import org.jooq.PivotInStep;
|
||||
@ -128,20 +128,20 @@ implements
|
||||
private static final long serialVersionUID = -5930286639571867314L;
|
||||
|
||||
@Override
|
||||
public void toSQL(RenderContext context) {
|
||||
context.declareTables(true)
|
||||
.sql(select(context))
|
||||
.declareTables(false);
|
||||
public void toSQL(RenderContext ctx) {
|
||||
ctx.declareTables(true)
|
||||
.sql(select(ctx.configuration()))
|
||||
.declareTables(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(BindContext context) throws DataAccessException {
|
||||
context.declareTables(true)
|
||||
.bind(select(context))
|
||||
.declareTables(false);
|
||||
public void bind(BindContext ctx) throws DataAccessException {
|
||||
ctx.declareTables(true)
|
||||
.bind(select(ctx.configuration()))
|
||||
.declareTables(false);
|
||||
}
|
||||
|
||||
private Table<Record> select(Context<?> context) {
|
||||
private Table<Record> select(Configuration configuration) {
|
||||
List<Field<?>> groupingFields = new ArrayList<Field<?>>();
|
||||
List<Field<?>> aliasedGroupingFields = new ArrayList<Field<?>>();
|
||||
List<Field<?>> aggregatedFields = new ArrayList<Field<?>>();
|
||||
@ -184,11 +184,11 @@ implements
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Select<?> aggregateSelect = create(context)
|
||||
.select(aggregateFunction)
|
||||
.from(table)
|
||||
.where(on.equal((Field<T>) inField))
|
||||
.and(join);
|
||||
Select<?> aggregateSelect = using(configuration)
|
||||
.select(aggregateFunction)
|
||||
.from(table)
|
||||
.where(on.equal((Field<T>) inField))
|
||||
.and(join);
|
||||
|
||||
aggregationSelects.add(aggregateSelect.asField(inField.getName() + "_" + aggregateFunction.getName()));
|
||||
}
|
||||
@ -196,12 +196,14 @@ implements
|
||||
|
||||
// This is the complete select
|
||||
Table<Record> select =
|
||||
create(context).select(aliasedGroupingFields)
|
||||
.select(aggregationSelects)
|
||||
.from(pivot)
|
||||
.where(pivot.field(on).in(in.toArray(new Field[0])))
|
||||
.groupBy(aliasedGroupingFields)
|
||||
.asTable();
|
||||
using(configuration)
|
||||
.select(aliasedGroupingFields)
|
||||
.select(aggregationSelects)
|
||||
.from(pivot)
|
||||
.where(pivot.field(on).in(in.toArray(new Field[0])))
|
||||
.groupBy(aliasedGroupingFields)
|
||||
.asTable();
|
||||
|
||||
return select;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user