[#8213] Move some DataKey values to a new BooleanDataKey enum
This commit is contained in:
parent
3d2d4f1226
commit
3f9cd17d34
@ -4,6 +4,7 @@
|
||||
package org.jooq.example.jpa.jooq.tables;
|
||||
|
||||
|
||||
import java.time.Year;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -31,7 +32,7 @@ import org.jooq.impl.TableImpl;
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class Film extends TableImpl<FilmRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1425273525;
|
||||
private static final long serialVersionUID = 1598245119;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>PUBLIC.FILM</code>
|
||||
@ -57,10 +58,9 @@ public class Film extends TableImpl<FilmRecord> {
|
||||
public final TableField<FilmRecord, Integer> LENGTH = createField(DSL.name("LENGTH"), org.jooq.impl.SQLDataType.INTEGER, this, "");
|
||||
|
||||
/**
|
||||
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using {@literal <deprecationOnUnknownTypes/>} in your code generator configuration.
|
||||
* The column <code>PUBLIC.FILM.RELEASE_YEAR</code>.
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public final TableField<FilmRecord, Object> RELEASE_YEAR = createField(DSL.name("RELEASE_YEAR"), org.jooq.impl.SQLDataType.INTEGER, this, "", new org.jooq.impl.JPAConverter(org.jooq.example.jpa.converters.YearConverter.class));
|
||||
public final TableField<FilmRecord, Year> RELEASE_YEAR = createField(DSL.name("RELEASE_YEAR"), org.jooq.impl.SQLDataType.INTEGER, this, "", new org.jooq.impl.JPAConverter(org.jooq.example.jpa.converters.YearConverter.class));
|
||||
|
||||
/**
|
||||
* The column <code>PUBLIC.FILM.TITLE</code>.
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
package org.jooq.example.jpa.jooq.tables.records;
|
||||
|
||||
|
||||
import java.time.Year;
|
||||
|
||||
import org.jooq.Field;
|
||||
import org.jooq.Record1;
|
||||
import org.jooq.Record6;
|
||||
@ -16,9 +18,9 @@ import org.jooq.impl.UpdatableRecordImpl;
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Record6<Integer, Integer, Object, String, Integer, Integer> {
|
||||
public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Record6<Integer, Integer, Year, String, Integer, Integer> {
|
||||
|
||||
private static final long serialVersionUID = -596044573;
|
||||
private static final long serialVersionUID = 2076456687;
|
||||
|
||||
/**
|
||||
* Setter for <code>PUBLIC.FILM.FILMID</code>.
|
||||
@ -49,19 +51,17 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using {@literal <deprecationOnUnknownTypes/>} in your code generator configuration.
|
||||
* Setter for <code>PUBLIC.FILM.RELEASE_YEAR</code>.
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public void setReleaseYear(Object value) {
|
||||
public void setReleaseYear(Year value) {
|
||||
set(2, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using {@literal <deprecationOnUnknownTypes/>} in your code generator configuration.
|
||||
* Getter for <code>PUBLIC.FILM.RELEASE_YEAR</code>.
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public Object getReleaseYear() {
|
||||
return get(2);
|
||||
public Year getReleaseYear() {
|
||||
return (Year) get(2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,7 +126,7 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Row6<Integer, Integer, Object, String, Integer, Integer> fieldsRow() {
|
||||
public Row6<Integer, Integer, Year, String, Integer, Integer> fieldsRow() {
|
||||
return (Row6) super.fieldsRow();
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Row6<Integer, Integer, Object, String, Integer, Integer> valuesRow() {
|
||||
public Row6<Integer, Integer, Year, String, Integer, Integer> valuesRow() {
|
||||
return (Row6) super.valuesRow();
|
||||
}
|
||||
|
||||
@ -155,11 +155,10 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using {@literal <deprecationOnUnknownTypes/>} in your code generator configuration.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
@Override
|
||||
public Field<Object> field3() {
|
||||
public Field<Year> field3() {
|
||||
return Film.FILM.RELEASE_YEAR;
|
||||
}
|
||||
|
||||
@ -204,11 +203,10 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using {@literal <deprecationOnUnknownTypes/>} in your code generator configuration.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
@Override
|
||||
public Object component3() {
|
||||
public Year component3() {
|
||||
return getReleaseYear();
|
||||
}
|
||||
|
||||
@ -253,11 +251,10 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using {@literal <deprecationOnUnknownTypes/>} in your code generator configuration.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
@Override
|
||||
public Object value3() {
|
||||
public Year value3() {
|
||||
return getReleaseYear();
|
||||
}
|
||||
|
||||
@ -304,11 +301,10 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using {@literal <deprecationOnUnknownTypes/>} in your code generator configuration.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
@Override
|
||||
public FilmRecord value3(Object value) {
|
||||
public FilmRecord value3(Year value) {
|
||||
setReleaseYear(value);
|
||||
return this;
|
||||
}
|
||||
@ -344,7 +340,7 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public FilmRecord values(Integer value1, Integer value2, Object value3, String value4, Integer value5, Integer value6) {
|
||||
public FilmRecord values(Integer value1, Integer value2, Year value3, String value4, Integer value5, Integer value6) {
|
||||
value1(value1);
|
||||
value2(value2);
|
||||
value3(value3);
|
||||
@ -368,7 +364,7 @@ public class FilmRecord extends UpdatableRecordImpl<FilmRecord> implements Recor
|
||||
/**
|
||||
* Create a detached, initialised FilmRecord
|
||||
*/
|
||||
public FilmRecord(Integer filmid, Integer length, Object releaseYear, String title, Integer languageLanguageid, Integer originallanguageLanguageid) {
|
||||
public FilmRecord(Integer filmid, Integer length, Year releaseYear, String title, Integer languageLanguageid, Integer originallanguageLanguageid) {
|
||||
super(Film.FILM);
|
||||
|
||||
set(0, filmid);
|
||||
|
||||
@ -47,8 +47,8 @@ import static java.lang.Boolean.TRUE;
|
||||
import static org.jooq.conf.ParamType.INDEXED;
|
||||
import static org.jooq.impl.Tools.EMPTY_CLAUSE;
|
||||
import static org.jooq.impl.Tools.EMPTY_QUERYPART;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_NESTED_SET_OPERATIONS;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_OMIT_CLAUSE_EVENT_EMISSION;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_NESTED_SET_OPERATIONS;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_OMIT_CLAUSE_EVENT_EMISSION;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.ArrayDeque;
|
||||
@ -235,7 +235,7 @@ abstract class AbstractContext<C extends Context<C>> extends AbstractScope imple
|
||||
* <code>AbstractContext</code>.
|
||||
*/
|
||||
private final Clause[] clause(QueryPart part) {
|
||||
if (part instanceof QueryPartInternal && data(DATA_OMIT_CLAUSE_EVENT_EMISSION) == null)
|
||||
if (part instanceof QueryPartInternal && !TRUE.equals(data(DATA_OMIT_CLAUSE_EVENT_EMISSION)))
|
||||
return ((QueryPartInternal) part).clauses(this);
|
||||
|
||||
return null;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
@ -65,7 +66,7 @@ import static org.jooq.impl.Keywords.K_SELECT;
|
||||
import static org.jooq.impl.Keywords.K_SQL;
|
||||
import static org.jooq.impl.Keywords.K_TABLE;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_EMULATE_BULK_INSERT_RETURNING;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_EMULATE_BULK_INSERT_RETURNING;
|
||||
import static org.jooq.util.sqlite.SQLiteDSL.rowid;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
@ -106,6 +107,7 @@ import org.jooq.conf.ExecuteWithoutWhere;
|
||||
import org.jooq.conf.RenderNameCase;
|
||||
import org.jooq.conf.SettingsTools;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
import org.jooq.impl.Tools.BooleanDataKey;
|
||||
import org.jooq.impl.Tools.DataKey;
|
||||
import org.jooq.tools.JooqLogger;
|
||||
import org.jooq.tools.jdbc.JDBCUtils;
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static org.jooq.Constants.FULL_VERSION;
|
||||
import static org.jooq.ExecuteType.DDL;
|
||||
// ...
|
||||
@ -53,8 +54,8 @@ import static org.jooq.impl.DSL.using;
|
||||
import static org.jooq.impl.Tools.EMPTY_PARAM;
|
||||
import static org.jooq.impl.Tools.blocking;
|
||||
import static org.jooq.impl.Tools.consumeExceptions;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_COUNT_BIND_VALUES;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_FORCE_STATIC_STATEMENT;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_COUNT_BIND_VALUES;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_FORCE_STATIC_STATEMENT;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -357,7 +358,7 @@ abstract class AbstractQuery extends AbstractQueryPart implements Query {
|
||||
executePreparedStatements(c.settings()) &&
|
||||
|
||||
// [#1520] Renderers may enforce static statements, too
|
||||
!Boolean.TRUE.equals(ctx.data(DATA_FORCE_STATIC_STATEMENT))) {
|
||||
!TRUE.equals(ctx.data(DATA_FORCE_STATIC_STATEMENT))) {
|
||||
|
||||
listener.bindStart(ctx);
|
||||
if (rendered.bindValues != null)
|
||||
|
||||
@ -51,7 +51,7 @@ import static org.jooq.impl.DSL.name;
|
||||
import static org.jooq.impl.Tools.blocking;
|
||||
import static org.jooq.impl.Tools.consumeResultSets;
|
||||
import static org.jooq.impl.Tools.executeStatementAndGetFirstResultSet;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_LOCK_ROWS_FOR_UPDATE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_LOCK_ROWS_FOR_UPDATE;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.sql.ResultSet;
|
||||
|
||||
@ -71,7 +71,7 @@ import static org.jooq.impl.DSL.falseCondition;
|
||||
import static org.jooq.impl.DSL.field;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.Keywords.K_AS;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_UNALIAS_ALIASES_IN_ORDER_BY;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_UNALIAS_ALIASES_IN_ORDER_BY;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ import static org.jooq.impl.Tools.toSQLDDLTypeDeclaration;
|
||||
import static org.jooq.impl.Tools.toSQLDDLTypeDeclarationForAddition;
|
||||
import static org.jooq.impl.Tools.toSQLDDLTypeDeclarationIdentityAfterNull;
|
||||
import static org.jooq.impl.Tools.toSQLDDLTypeDeclarationIdentityBeforeNull;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_CONSTRAINT_REFERENCE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_CONSTRAINT_REFERENCE;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.conf.SettingsTools.executeStaticStatements;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_OMIT_RETURNING_CLAUSE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_OMIT_RETURNING_CLAUSE;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@ -57,8 +57,8 @@ import static org.jooq.impl.Keywords.K_EXECUTE_STATEMENT;
|
||||
import static org.jooq.impl.Keywords.K_NOT;
|
||||
import static org.jooq.impl.Tools.decrement;
|
||||
import static org.jooq.impl.Tools.increment;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_FORCE_STATIC_STATEMENT;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_BLOCK_NESTING;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_FORCE_STATIC_STATEMENT;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static org.jooq.Clause.CONSTRAINT;
|
||||
// ...
|
||||
import static org.jooq.impl.ConstraintImpl.Action.CASCADE;
|
||||
@ -58,7 +59,7 @@ import static org.jooq.impl.Keywords.K_REFERENCES;
|
||||
import static org.jooq.impl.Keywords.K_UNIQUE;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.fieldsByName;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_CONSTRAINT_REFERENCE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_CONSTRAINT_REFERENCE;
|
||||
|
||||
import org.jooq.Clause;
|
||||
import org.jooq.Condition;
|
||||
@ -166,7 +167,7 @@ implements
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
if (ctx.data(DATA_CONSTRAINT_REFERENCE) != null) {
|
||||
if (TRUE.equals(ctx.data(DATA_CONSTRAINT_REFERENCE))) {
|
||||
if (getQualifiedName() == AbstractName.NO_NAME)
|
||||
throw new DataAccessException("Cannot ALTER or DROP CONSTRAINT without name");
|
||||
|
||||
|
||||
@ -91,8 +91,8 @@ import static org.jooq.impl.Tools.begin;
|
||||
import static org.jooq.impl.Tools.beginExecuteImmediate;
|
||||
import static org.jooq.impl.Tools.end;
|
||||
import static org.jooq.impl.Tools.endExecuteImmediate;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_SELECT_NO_DATA;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_SELECT_INTO_TABLE;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_SELECT_NO_DATA;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -40,7 +40,7 @@ package org.jooq.impl;
|
||||
import static java.lang.Boolean.TRUE;
|
||||
// ...
|
||||
import static org.jooq.impl.Tools.recordFactory;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_LOCK_ROWS_FOR_UPDATE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_LOCK_ROWS_FOR_UPDATE;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
||||
@ -37,16 +37,20 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jooq.Scope;
|
||||
import org.jooq.impl.Tools.BooleanDataKey;
|
||||
import org.jooq.impl.Tools.DataKey;
|
||||
|
||||
/**
|
||||
@ -56,53 +60,80 @@ import org.jooq.impl.Tools.DataKey;
|
||||
*/
|
||||
final class DataMap extends AbstractMap<Object, Object> {
|
||||
|
||||
final EnumMap<DataKey, Object> internal;
|
||||
Map<Object, Object> external;
|
||||
final EnumSet<BooleanDataKey> internalSet;
|
||||
final EnumMap<DataKey, Object> internalMap;
|
||||
Map<Object, Object> externalMap;
|
||||
final Set<Entry<Object, Object>> entrySet;
|
||||
|
||||
DataMap() {
|
||||
internal = new EnumMap<DataKey, Object>(DataKey.class);
|
||||
internalSet = EnumSet.noneOf(BooleanDataKey.class);
|
||||
internalMap = new EnumMap<DataKey, Object>(DataKey.class);
|
||||
entrySet = new EntrySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int size() {
|
||||
return internal().size() + external(false).size();
|
||||
return internalSet.size() + internalMap().size() + external(false).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isEmpty() {
|
||||
return internal().isEmpty() && external(false).isEmpty();
|
||||
return internalSet.isEmpty() && internalMap().isEmpty() && external(false).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean containsKey(Object key) {
|
||||
return delegate(key, false).containsKey(key);
|
||||
return key instanceof BooleanDataKey
|
||||
? internalSet.contains(key)
|
||||
: delegate(key, false).containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean containsValue(Object value) {
|
||||
return internal().containsValue(value) || external(false).containsValue(value);
|
||||
if (value instanceof Boolean)
|
||||
if ((Boolean) value && internalSet.size() > 0)
|
||||
return true;
|
||||
else if (!((Boolean) value) && internalSet.size() < BooleanDataKey.values().length)
|
||||
return true;
|
||||
|
||||
return internalMap().containsValue(value) || external(false).containsValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object get(Object key) {
|
||||
return delegate(key, false).get(key);
|
||||
return key instanceof BooleanDataKey
|
||||
? internalSet.contains(key)
|
||||
? (Boolean) true
|
||||
: (Boolean) null
|
||||
: delegate(key, false).get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object put(Object key, Object value) {
|
||||
return delegate(key, true).put(key, value);
|
||||
return key instanceof BooleanDataKey
|
||||
? TRUE.equals(value)
|
||||
? internalSet.add((BooleanDataKey) key)
|
||||
? (Boolean) null
|
||||
: TRUE
|
||||
: internalSet.remove(key)
|
||||
? TRUE
|
||||
: (Boolean) null
|
||||
: delegate(key, true).put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object remove(Object key) {
|
||||
return delegate(key, true).remove(key);
|
||||
return key instanceof BooleanDataKey
|
||||
? internalSet.remove(key)
|
||||
? TRUE
|
||||
: (Boolean) null
|
||||
: delegate(key, true).remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void clear() {
|
||||
internal().clear();
|
||||
internalSet.clear();
|
||||
internalMap().clear();
|
||||
external(true).clear();
|
||||
}
|
||||
|
||||
@ -112,41 +143,48 @@ final class DataMap extends AbstractMap<Object, Object> {
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private final Map<Object, Object> internal() {
|
||||
return (Map) internal;
|
||||
private final Map<Object, Object> internalMap() {
|
||||
return (Map) internalMap;
|
||||
}
|
||||
|
||||
private final Map<Object, Object> external(boolean initialise) {
|
||||
if (external == null) {
|
||||
if (externalMap == null) {
|
||||
if (initialise)
|
||||
external = new HashMap<Object, Object>();
|
||||
externalMap = new HashMap<Object, Object>();
|
||||
else
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
return external;
|
||||
return externalMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private final Map<Object, Object> delegate(Object key, boolean initialise) {
|
||||
return key instanceof DataKey ? (Map) internal() : external(initialise);
|
||||
return key instanceof DataKey ? (Map) internalMap() : external(initialise);
|
||||
}
|
||||
|
||||
private class EntrySet extends AbstractSet<Entry<Object, Object>> {
|
||||
@Override
|
||||
public final Iterator<Entry<Object, Object>> iterator() {
|
||||
return new Iterator<Entry<Object, Object>>() {
|
||||
final Iterator<Entry<Object, Object>> internalIterator = internal().entrySet().iterator();
|
||||
final Iterator<Entry<Object, Object>> externalIterator = external(false).entrySet().iterator();
|
||||
final Iterator<BooleanDataKey> internalSetIterator = internalSet.iterator();
|
||||
final Iterator<Entry<Object, Object>> internalMapIterator = internalMap().entrySet().iterator();
|
||||
final Iterator<Entry<Object, Object>> externalMapIterator = external(false).entrySet().iterator();
|
||||
|
||||
@Override
|
||||
public final boolean hasNext() {
|
||||
return internalIterator.hasNext() || externalIterator.hasNext();
|
||||
return internalSetIterator.hasNext()
|
||||
|| internalMapIterator.hasNext()
|
||||
|| externalMapIterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Entry<Object, Object> next() {
|
||||
return internalIterator.hasNext() ? internalIterator.next() : externalIterator.next();
|
||||
return internalSetIterator.hasNext()
|
||||
? new SimpleImmutableEntry<Object, Object>(internalSetIterator.next(), true)
|
||||
: internalMapIterator.hasNext()
|
||||
? internalMapIterator.next()
|
||||
: externalMapIterator.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
import static org.jooq.conf.ParamType.INDEXED;
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
@ -46,7 +47,7 @@ import static org.jooq.impl.Identifiers.QUOTES;
|
||||
import static org.jooq.impl.Identifiers.QUOTE_END_DELIMITER;
|
||||
import static org.jooq.impl.Identifiers.QUOTE_END_DELIMITER_ESCAPED;
|
||||
import static org.jooq.impl.Identifiers.QUOTE_START_DELIMITER;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_COUNT_BIND_VALUES;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_COUNT_BIND_VALUES;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
@ -578,7 +579,7 @@ class DefaultRenderContext extends AbstractContext<RenderContext> implements Ren
|
||||
|
||||
private final void checkForceInline(int max) throws ForceInlineSignal {
|
||||
if (bindValues.size() > max)
|
||||
if (Boolean.TRUE.equals(data(DATA_COUNT_BIND_VALUES)))
|
||||
if (TRUE.equals(data(DATA_COUNT_BIND_VALUES)))
|
||||
throw new ForceInlineSignal();
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,8 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_DEFAULT_TRANSACTION_PROVIDER_AUTOCOMMIT;
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_DEFAULT_TRANSACTION_PROVIDER_AUTOCOMMIT;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_DEFAULT_TRANSACTION_PROVIDER_CONNECTION;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_DEFAULT_TRANSACTION_PROVIDER_SAVEPOINTS;
|
||||
|
||||
@ -121,7 +122,7 @@ public class DefaultTransactionProvider implements TransactionProvider {
|
||||
private final boolean autoCommit(Configuration configuration) {
|
||||
Boolean autoCommit = (Boolean) configuration.data(DATA_DEFAULT_TRANSACTION_PROVIDER_AUTOCOMMIT);
|
||||
|
||||
if (autoCommit == null) {
|
||||
if (!TRUE.equals(autoCommit)) {
|
||||
autoCommit = connection(configuration).getAutoCommit();
|
||||
configuration.data(DATA_DEFAULT_TRANSACTION_PROVIDER_AUTOCOMMIT, autoCommit);
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ import static org.jooq.impl.DSL.name;
|
||||
import static org.jooq.impl.DSL.table;
|
||||
import static org.jooq.impl.Keywords.K_DEFAULT_VALUES;
|
||||
import static org.jooq.impl.Keywords.K_VALUES;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_EMULATE_BULK_INSERT_RETURNING;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_EMULATE_BULK_INSERT_RETURNING;
|
||||
|
||||
import java.util.AbstractList;
|
||||
import java.util.AbstractMap;
|
||||
|
||||
@ -85,7 +85,7 @@ import static org.jooq.impl.Term.MEDIAN;
|
||||
import static org.jooq.impl.Term.MODE;
|
||||
import static org.jooq.impl.Term.PRODUCT;
|
||||
import static org.jooq.impl.Term.ROW_NUMBER;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_RANKING_FUNCTION;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_RANKING_FUNCTION;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_WINDOW_DEFINITIONS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -452,7 +452,7 @@ class Function<T> extends AbstractField<T> implements
|
||||
|
||||
ctx.visit(window);
|
||||
|
||||
if (previous != null)
|
||||
if (TRUE.equals(previous))
|
||||
ctx.data(DATA_RANKING_FUNCTION, previous);
|
||||
else
|
||||
ctx.data().remove(DATA_RANKING_FUNCTION);
|
||||
|
||||
@ -77,8 +77,8 @@ import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.aliasedFields;
|
||||
import static org.jooq.impl.Tools.fieldNameStrings;
|
||||
import static org.jooq.impl.Tools.fieldNames;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_CONSTRAINT_REFERENCE;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_INSERT_SELECT_WITHOUT_INSERT_COLUMN_LIST;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_CONSTRAINT_REFERENCE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_INSERT_SELECT_WITHOUT_INSERT_COLUMN_LIST;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -40,8 +40,8 @@ package org.jooq.impl;
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static org.jooq.impl.DSL.field;
|
||||
import static org.jooq.impl.DSL.name;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_UNALIAS_ALIASES_IN_ORDER_BY;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_OVERRIDE_ALIASES_IN_ORDER_BY;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_UNALIAS_ALIASES_IN_ORDER_BY;
|
||||
|
||||
import org.jooq.Field;
|
||||
import org.jooq.QueryPart;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.jooq.Clause.TABLE;
|
||||
import static org.jooq.Clause.TABLE_JOIN;
|
||||
@ -95,8 +96,8 @@ import static org.jooq.impl.Keywords.K_LEFT_OUTER_JOIN_LATERAL;
|
||||
import static org.jooq.impl.Keywords.K_ON;
|
||||
import static org.jooq.impl.Keywords.K_PARTITION_BY;
|
||||
import static org.jooq.impl.Keywords.K_USING;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_COLLECT_SEMI_ANTI_JOIN;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_COLLECTED_SEMI_ANTI_JOIN;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_COLLECT_SEMI_ANTI_JOIN;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -233,7 +234,7 @@ implements
|
||||
switch (translatedType) {
|
||||
case LEFT_SEMI_JOIN:
|
||||
case LEFT_ANTI_JOIN:
|
||||
if (ctx.data(DATA_COLLECT_SEMI_ANTI_JOIN) != null) {
|
||||
if (TRUE.equals(ctx.data(DATA_COLLECT_SEMI_ANTI_JOIN))) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Condition> semiAntiJoinPredicates = (List<Condition>) ctx.data(DATA_COLLECTED_SEMI_ANTI_JOIN);
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static org.jooq.RenderContext.CastMode.NEVER;
|
||||
// ...
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
@ -58,7 +59,6 @@ import static org.jooq.impl.Keywords.K_TO;
|
||||
import static org.jooq.impl.Keywords.K_TOP;
|
||||
import static org.jooq.impl.Keywords.K_WITH_TIES;
|
||||
import static org.jooq.impl.SQLDataType.BIGINT;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_PREFER_TOP_OVER_FETCH;
|
||||
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Field;
|
||||
@ -66,6 +66,7 @@ import org.jooq.Param;
|
||||
import org.jooq.RenderContext.CastMode;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
import org.jooq.impl.Tools.BooleanDataKey;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
|
||||
@ -75,7 +75,7 @@ import static org.jooq.impl.Keywords.K_WHEN;
|
||||
import static org.jooq.impl.Keywords.K_WHERE;
|
||||
import static org.jooq.impl.Keywords.K_WITH_PRIMARY_KEY;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -1439,7 +1439,7 @@ implements
|
||||
.formatNewLine();
|
||||
ctx.data(DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES, true);
|
||||
ctx.visit(using);
|
||||
ctx.data(DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES, null);
|
||||
ctx.data().remove(DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES);
|
||||
ctx.formatIndentEnd()
|
||||
.declareTables(false);
|
||||
|
||||
|
||||
@ -37,11 +37,12 @@
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
// ...
|
||||
import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.DSL.table;
|
||||
import static org.jooq.impl.DSL.val;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY;
|
||||
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Context;
|
||||
@ -81,13 +82,12 @@ final class QuantifiedSelectImpl<R extends Record> extends AbstractQueryPart imp
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
Object data = ctx.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY);
|
||||
boolean extraParentheses = data != null && (false
|
||||
boolean extraParentheses = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
)
|
||||
;
|
||||
|
||||
ctx.visit(quantifier.toKeyword())
|
||||
.sql(extraParentheses ? " ((" : " (")
|
||||
|
||||
@ -38,8 +38,9 @@
|
||||
|
||||
package org.jooq.impl;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_LIST_ALREADY_INDENTED;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_LIST_ALREADY_INDENTED;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -104,7 +105,7 @@ class QueryPartList<T extends QueryPart> extends AbstractQueryPart implements Li
|
||||
|
||||
else {
|
||||
String separator = "";
|
||||
boolean indent = (size() > 1) && ctx.data(DATA_LIST_ALREADY_INDENTED) == null;
|
||||
boolean indent = (size() > 1) && !TRUE.equals(ctx.data(DATA_LIST_ALREADY_INDENTED));
|
||||
|
||||
if (indent)
|
||||
ctx.formatIndentStart();
|
||||
|
||||
@ -39,7 +39,7 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DefaultBinding.binding;
|
||||
import static org.jooq.impl.DefaultBinding.DefaultRecordBinding.pgNewRecord;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_LIST_ALREADY_INDENTED;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_LIST_ALREADY_INDENTED;
|
||||
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Converter;
|
||||
|
||||
@ -59,7 +59,7 @@ import static org.jooq.impl.DSL.name;
|
||||
import static org.jooq.impl.DSL.notExists;
|
||||
import static org.jooq.impl.DSL.row;
|
||||
import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
@ -234,7 +234,7 @@ final class RowSubqueryCondition extends AbstractCondition {
|
||||
.formatIndentEnd()
|
||||
.formatNewLine()
|
||||
.subquery(false);
|
||||
ctx.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY, null);
|
||||
ctx.data().remove(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY);
|
||||
ctx.sql(extraParentheses ? "))" : ")");
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ final class RowSubqueryCondition extends AbstractCondition {
|
||||
ctx.subquery(true)
|
||||
.visit(rightQuantified)
|
||||
.subquery(false);
|
||||
ctx.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY, null);
|
||||
ctx.data().remove(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -127,19 +127,18 @@ import static org.jooq.impl.Keywords.K_WITH_READ_ONLY;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.fieldArray;
|
||||
import static org.jooq.impl.Tools.hasAmbiguousNames;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_COLLECT_SEMI_ANTI_JOIN;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_INSERT_SELECT_WITHOUT_INSERT_COLUMN_LIST;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_NESTED_SET_OPERATIONS;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_OMIT_INTO_CLAUSE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_UNALIAS_ALIASES_IN_ORDER_BY;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_COLLECTED_SEMI_ANTI_JOIN;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_COLLECT_SEMI_ANTI_JOIN;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_INSERT_SELECT_WITHOUT_INSERT_COLUMN_LIST;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_NESTED_SET_OPERATIONS;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_OMIT_INTO_CLAUSE;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_OVERRIDE_ALIASES_IN_ORDER_BY;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_PREFER_TOP_OVER_FETCH;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_SELECT_INTO_TABLE;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_UNALIAS_ALIASES_IN_ORDER_BY;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_WINDOW_DEFINITIONS;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES;
|
||||
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.util.ArrayList;
|
||||
@ -182,6 +181,7 @@ import org.jooq.TableOptionalOnStep;
|
||||
import org.jooq.TablePartitionByStep;
|
||||
import org.jooq.WindowDefinition;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
import org.jooq.impl.Tools.BooleanDataKey;
|
||||
import org.jooq.impl.Tools.DataKey;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
@ -490,7 +490,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
Object renderTrailingLimit = context.data(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE);
|
||||
Object localWindowDefinitions = context.data(DATA_WINDOW_DEFINITIONS);
|
||||
try {
|
||||
if (renderTrailingLimit != null)
|
||||
if (TRUE.equals(renderTrailingLimit))
|
||||
context.data().remove(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE);
|
||||
|
||||
// [#5127] Lazy initialise this map
|
||||
@ -498,7 +498,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
context.data(DATA_WINDOW_DEFINITIONS, null);
|
||||
|
||||
if (into != null
|
||||
&& context.data(DATA_OMIT_INTO_CLAUSE) == null
|
||||
&& !TRUE.equals(context.data(DATA_OMIT_INTO_CLAUSE))
|
||||
&& EMULATE_SELECT_INTO_AS_CTAS.contains(family)) {
|
||||
|
||||
context.data(DATA_OMIT_INTO_CLAUSE, true);
|
||||
@ -518,7 +518,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
context.sql('(')
|
||||
.formatIndentStart()
|
||||
.formatNewLine()
|
||||
.data(DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES, null);
|
||||
.data().remove(DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES);
|
||||
}
|
||||
|
||||
switch (dialect) {
|
||||
@ -1217,11 +1217,11 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
// [#1905] H2 only knows arrays, no row value expressions. Subqueries
|
||||
// in the context of a row value expression predicate have to render
|
||||
// arrays explicitly, as the subquery doesn't form an implicit RVE
|
||||
else if (context.subquery() && dialect == H2 && context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY) != null) {
|
||||
else if (context.subquery() && dialect == H2 && TRUE.equals(context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY))) {
|
||||
Object data = context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY);
|
||||
|
||||
try {
|
||||
context.data(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY, null);
|
||||
context.data().remove(DATA_ROW_VALUE_EXPRESSION_PREDICATE_SUBQUERY);
|
||||
context.sql('(')
|
||||
.visit(getSelect1())
|
||||
.sql(')');
|
||||
@ -1264,7 +1264,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
actualInto = into;
|
||||
|
||||
if (actualInto != null
|
||||
&& context.data(DATA_OMIT_INTO_CLAUSE) == null
|
||||
&& !TRUE.equals(context.data(DATA_OMIT_INTO_CLAUSE))
|
||||
&& (SUPPORT_SELECT_INTO_TABLE.contains(family) || !(actualInto instanceof Table))) {
|
||||
|
||||
context.formatSeparator()
|
||||
@ -1326,7 +1326,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
context.start(SELECT_WHERE);
|
||||
ConditionProviderImpl where = getWhere();
|
||||
|
||||
if (TRUE.equals(context.data().get(DataKey.DATA_SELECT_NO_DATA)))
|
||||
if (TRUE.equals(context.data().get(BooleanDataKey.DATA_SELECT_NO_DATA)))
|
||||
context.formatSeparator()
|
||||
.visit(K_WHERE)
|
||||
.sql(' ')
|
||||
@ -1598,7 +1598,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
.formatNewLine()
|
||||
.sql(") x");
|
||||
|
||||
if (ctx.data().containsKey(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE) && actualLimit.isApplicable())
|
||||
if (TRUE.equals(ctx.data().get(DATA_RENDER_TRAILING_LIMIT_IF_APPLICABLE)) && actualLimit.isApplicable())
|
||||
ctx.visit(actualLimit);
|
||||
}
|
||||
|
||||
@ -1720,7 +1720,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
// [#2995] Ambiguity may need to be resolved when parentheses could mean both:
|
||||
// Set op subqueries or insert column lists
|
||||
|| ctx.data(DATA_INSERT_SELECT_WITHOUT_INSERT_COLUMN_LIST) != null
|
||||
|| TRUE.equals(ctx.data(DATA_INSERT_SELECT_WITHOUT_INSERT_COLUMN_LIST))
|
||||
|
||||
// [#7222] [#7711] Workaround for https://issues.apache.org/jira/browse/DERBY-6984
|
||||
|| (ctx.subquery() && UNION_PARENTHESIS_IN_DERIVED_TABLES.contains(ctx.family()))
|
||||
|
||||
@ -40,7 +40,7 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Clause.FIELD;
|
||||
import static org.jooq.Clause.FIELD_REFERENCE;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_OMIT_CLAUSE_EVENT_EMISSION;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_OMIT_CLAUSE_EVENT_EMISSION;
|
||||
|
||||
import org.jooq.Binding;
|
||||
import org.jooq.Clause;
|
||||
@ -95,7 +95,7 @@ final class TableFieldImpl<R extends Record, T> extends AbstractField<T> impleme
|
||||
}
|
||||
|
||||
ctx.visit(getUnqualifiedName());
|
||||
ctx.data(DATA_OMIT_CLAUSE_EVENT_EMISSION, null);
|
||||
ctx.data().remove(DATA_OMIT_CLAUSE_EVENT_EMISSION);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@ -52,7 +52,7 @@ import static org.jooq.impl.RecordDelegate.RecordLifecycleType.INSERT;
|
||||
import static org.jooq.impl.Tools.EMPTY_FIELD;
|
||||
import static org.jooq.impl.Tools.indexOrFail;
|
||||
import static org.jooq.impl.Tools.settings;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_OMIT_RETURNING_CLAUSE;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_OMIT_RETURNING_CLAUSE;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@ -289,7 +289,7 @@ final class Tools {
|
||||
// Some constants for use with Context.data()
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
enum DataKey {
|
||||
enum BooleanDataKey {
|
||||
|
||||
/**
|
||||
* [#1537] This constant is used internally by jOOQ to omit the RETURNING
|
||||
@ -362,14 +362,10 @@ final class Tools {
|
||||
@SuppressWarnings("javadoc")
|
||||
DATA_WRAP_DERIVED_TABLES_IN_PARENTHESES,
|
||||
|
||||
/**
|
||||
* [#531] The local window definitions.
|
||||
* <p>
|
||||
* The window definitions declared in the <code>WINDOW</code> clause are
|
||||
* needed in the <code>SELECT</code> clause when emulating them by inlining
|
||||
* window specifications.
|
||||
*/
|
||||
DATA_WINDOW_DEFINITIONS,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -387,26 +383,6 @@ final class Tools {
|
||||
*/
|
||||
DATA_DEFAULT_TRANSACTION_PROVIDER_AUTOCOMMIT,
|
||||
|
||||
/**
|
||||
* [#1629] The {@link Connection#getAutoCommit()} flag value before starting
|
||||
* a new transaction.
|
||||
*/
|
||||
DATA_DEFAULT_TRANSACTION_PROVIDER_SAVEPOINTS,
|
||||
|
||||
/**
|
||||
* [#1629] The {@link DefaultConnectionProvider} instance to be used during
|
||||
* the transaction.
|
||||
*/
|
||||
DATA_DEFAULT_TRANSACTION_PROVIDER_CONNECTION,
|
||||
|
||||
/**
|
||||
* [#2080] When emulating OFFSET pagination in certain databases, synthetic
|
||||
* aliases are generated that must be referenced also in
|
||||
* <code>ORDER BY</code> clauses, in lieu of their corresponding original
|
||||
* aliases.
|
||||
*/
|
||||
DATA_OVERRIDE_ALIASES_IN_ORDER_BY,
|
||||
|
||||
/**
|
||||
* [#2080] When emulating OFFSET pagination in certain databases, synthetic
|
||||
* aliases are generated that must be referenced also in
|
||||
@ -415,20 +391,6 @@ final class Tools {
|
||||
*/
|
||||
DATA_UNALIAS_ALIASES_IN_ORDER_BY,
|
||||
|
||||
/**
|
||||
* [#3381] The table to be used for the {@link Clause#SELECT_INTO} clause.
|
||||
*/
|
||||
@SuppressWarnings("javadoc")
|
||||
DATA_SELECT_INTO_TABLE,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* [#7139] No data must be selected in the <code>SELECT</code> statement.
|
||||
*/
|
||||
@ -461,11 +423,6 @@ final class Tools {
|
||||
*/
|
||||
DATA_COLLECT_SEMI_ANTI_JOIN,
|
||||
|
||||
/**
|
||||
* [#1206] The collected Semi / Anti JOIN predicates.
|
||||
*/
|
||||
DATA_COLLECTED_SEMI_ANTI_JOIN,
|
||||
|
||||
/**
|
||||
* [#2995] An <code>INSERT INTO t SELECT</code> statement. Without any
|
||||
* explicit column list, the <code>SELECT</code> statement must not be
|
||||
@ -474,30 +431,6 @@ final class Tools {
|
||||
*/
|
||||
DATA_INSERT_SELECT_WITHOUT_INSERT_COLUMN_LIST,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The level of anonymous block nesting, in case we're generating a block.
|
||||
*/
|
||||
DATA_BLOCK_NESTING,
|
||||
|
||||
/**
|
||||
* [#3579] [#6431] [#7222] There are nested set operations in the current
|
||||
* {@link Select} scope.
|
||||
@ -509,15 +442,82 @@ final class Tools {
|
||||
*/
|
||||
DATA_EMULATE_BULK_INSERT_RETURNING,
|
||||
|
||||
/**
|
||||
* [#7467] In SQL Server, the TOP clause is sometimes preferred over the FETCH clause.
|
||||
*/
|
||||
DATA_PREFER_TOP_OVER_FETCH,
|
||||
|
||||
/**
|
||||
* [#1535] We're currently generating the window specification of a ranking function.
|
||||
*/
|
||||
DATA_RANKING_FUNCTION,
|
||||
|
||||
}
|
||||
|
||||
enum DataKey {
|
||||
|
||||
/**
|
||||
* The level of anonymous block nesting, in case we're generating a block.
|
||||
*/
|
||||
DATA_BLOCK_NESTING,
|
||||
|
||||
/**
|
||||
* [#531] The local window definitions.
|
||||
* <p>
|
||||
* The window definitions declared in the <code>WINDOW</code> clause are
|
||||
* needed in the <code>SELECT</code> clause when emulating them by inlining
|
||||
* window specifications.
|
||||
*/
|
||||
DATA_WINDOW_DEFINITIONS,
|
||||
|
||||
/**
|
||||
* [#1629] The {@link Connection#getAutoCommit()} flag value before starting
|
||||
* a new transaction.
|
||||
*/
|
||||
DATA_DEFAULT_TRANSACTION_PROVIDER_SAVEPOINTS,
|
||||
|
||||
/**
|
||||
* [#1629] The {@link DefaultConnectionProvider} instance to be used during
|
||||
* the transaction.
|
||||
*/
|
||||
DATA_DEFAULT_TRANSACTION_PROVIDER_CONNECTION,
|
||||
|
||||
/**
|
||||
* [#2080] When emulating OFFSET pagination in certain databases, synthetic
|
||||
* aliases are generated that must be referenced also in
|
||||
* <code>ORDER BY</code> clauses, in lieu of their corresponding original
|
||||
* aliases.
|
||||
*/
|
||||
DATA_OVERRIDE_ALIASES_IN_ORDER_BY,
|
||||
|
||||
/**
|
||||
* [#3381] The table to be used for the {@link Clause#SELECT_INTO} clause.
|
||||
*/
|
||||
@SuppressWarnings("javadoc")
|
||||
DATA_SELECT_INTO_TABLE,
|
||||
|
||||
/**
|
||||
* [#1206] The collected Semi / Anti JOIN predicates.
|
||||
*/
|
||||
DATA_COLLECTED_SEMI_ANTI_JOIN,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ import static org.jooq.impl.Keywords.K_PARTITION_BY;
|
||||
import static org.jooq.impl.Keywords.K_PRECEDING;
|
||||
import static org.jooq.impl.Keywords.K_UNBOUNDED_FOLLOWING;
|
||||
import static org.jooq.impl.Keywords.K_UNBOUNDED_PRECEDING;
|
||||
import static org.jooq.impl.Tools.DataKey.DATA_RANKING_FUNCTION;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_RANKING_FUNCTION;
|
||||
import static org.jooq.impl.WindowSpecificationImpl.Exclude.CURRENT_ROW;
|
||||
import static org.jooq.impl.WindowSpecificationImpl.Exclude.GROUP;
|
||||
import static org.jooq.impl.WindowSpecificationImpl.Exclude.NO_OTHERS;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user