[jOOQ/jOOQ#9190] Support Firebird

This includes:

- [jOOQ/jOOQ#11344] Add Context.declareParameters()
This commit is contained in:
Lukas Eder 2021-02-01 15:08:50 +01:00
parent e532485333
commit 8537ae91c1
13 changed files with 262 additions and 29 deletions

View File

@ -174,6 +174,32 @@ public interface Context<C extends Context<C>> extends Scope {
@NotNull
C declareWindows(boolean declareWindows, Consumer<? super C> consumer);
/**
* Whether the current context is rendering a common table expression (e.g.
* a {@link CommonTableExpression} in the <code>WITH</code> clause of the

View File

@ -158,6 +158,22 @@ public interface QueryPartInternal extends QueryPart {
*/
boolean declaresCTE();
/**
* Check whether this {@link QueryPart} is able to generate
* <code>CAST</code> expressions around bind variables.

View File

@ -111,6 +111,10 @@ abstract class AbstractContext<C extends Context<C>> extends AbstractScope imple
boolean declareAliases;
boolean declareWindows;
boolean declareCTE;
int subquery;
BitSet subqueryScopedNestedSetOperations;
int stringLiteral;
@ -258,6 +262,17 @@ abstract class AbstractContext<C extends Context<C>> extends AbstractScope imple
declareCTE(true);
}
else if (!castModeOverride && castMode() != CastMode.DEFAULT && !internal.generatesCast()) {
CastMode previous = castMode();
@ -570,6 +585,29 @@ abstract class AbstractContext<C extends Context<C>> extends AbstractScope imple
return toggle(f, this::declareWindows, this::declareWindows, consumer);
}
@Override
public final boolean declareCTE() {
return declareCTE;

View File

@ -48,6 +48,7 @@ import org.jooq.Clause;
import org.jooq.Configuration;
import org.jooq.Context;
import org.jooq.DSLContext;
// ...
import org.jooq.QueryPart;
import org.jooq.QueryPartInternal;
import org.jooq.RenderContext;
@ -144,6 +145,19 @@ abstract class AbstractQueryPart implements QueryPartInternal {
return false;
}
/**
* Subclasses may override this
*/

View File

@ -253,27 +253,6 @@ package org.jooq.impl;

View File

@ -44,7 +44,9 @@ package org.jooq.impl;
enum DDLStatementType {
ALTER_DATABASE,
ALTER_DOMAIN,
ALTER_FUNCTION,
ALTER_INDEX,
ALTER_PROCEDURE,
ALTER_SCHEMA,
ALTER_SEQUENCE,
ALTER_TABLE,
@ -53,7 +55,9 @@ enum DDLStatementType {
CREATE_DATABASE,
CREATE_DOMAIN,
CREATE_FUNCTION,
CREATE_INDEX,
CREATE_PROCEDURE,
CREATE_SCHEMA,
CREATE_SEQUENCE,
CREATE_TABLE,
@ -62,7 +66,9 @@ enum DDLStatementType {
DROP_DATABASE,
DROP_DOMAIN,
DROP_FUNCTION,
DROP_INDEX,
DROP_PROCEDURE,
DROP_SCHEMA,
DROP_SEQUENCE,
DROP_TABLE,

View File

@ -92,6 +92,19 @@ package org.jooq.impl;

View File

@ -92,6 +92,19 @@ package org.jooq.impl;

View File

@ -38,6 +38,15 @@
package org.jooq.impl;
// ...
import static org.jooq.SQLDialect.POSTGRES;
// ...
// ...
import static org.jooq.impl.Keywords.K_INOUT;
import static org.jooq.impl.Keywords.K_OUT;
import java.util.Set;
import org.jooq.Context;
import org.jooq.DataType;
import org.jooq.Field;
@ -46,6 +55,7 @@ import org.jooq.ParamMode;
import org.jooq.Parameter;
// ...
import org.jooq.Record1;
import org.jooq.SQLDialect;
import org.jooq.Select;
import org.jooq.Statement;
// ...
@ -94,6 +104,13 @@ final class ParameterImpl<T> extends AbstractField<T> implements Parameter<T> {
// XXX: QueryPart API
// -------------------------------------------------------------------------
@Override
public final void accept(Context<?> ctx) {
@ -101,6 +118,27 @@ final class ParameterImpl<T> extends AbstractField<T> implements Parameter<T> {
ctx.visit(getUnqualifiedName());
}
@ -143,6 +181,12 @@ final class ParameterImpl<T> extends AbstractField<T> implements Parameter<T> {

View File

@ -0,0 +1,72 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq.impl;

View File

@ -108,14 +108,6 @@ package org.jooq.impl;

View File

@ -40,6 +40,7 @@ package org.jooq.impl;
import org.jooq.BindContext;
import org.jooq.Clause;
import org.jooq.Context;
// ...
import org.jooq.QueryPartInternal;
import org.jooq.RenderContext;
@ -90,6 +91,16 @@ enum ScopeMarkers implements QueryPartInternal {
return false;
}
@Override
public final boolean generatesCast() {
return false;

View File

@ -117,6 +117,15 @@ package org.jooq.impl;