From c0cb49522e693fa3d46e741f2efbd972c72be379 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 21 Nov 2014 16:47:33 +0100 Subject: [PATCH] Release 3.5.0 --- .../pg_catalog/routines/PgCursor.java | 101 ----------- jOOQ-meta/src/main/resources/xjb/binding.xjb | 27 --- .../main/java/org/jooq/BindingContext.java | 49 ----- .../org/jooq/impl/AbstractBindingContext.java | 72 -------- .../java/org/jooq/impl/AbstractSelect.java | 168 ------------------ .../main/java/org/jooq/impl/DefaultArray.java | 115 ------------ .../org/jooq/impl/DefaultBindingContext.java | 53 ------ .../java/org/jooq/impl/ExistsOperator.java | 63 ------- .../impl/SelectQueryAsExistsCondition.java | 102 ----------- .../org/jooq/impl/SelectQueryAsField.java | 94 ---------- .../impl/SelectQueryAsSubQueryCondition.java | 107 ----------- .../org/jooq/impl/SelectQueryAsTable.java | 115 ------------ jOOQ/src/main/java/org/jooq/impl/Union.java | 155 ---------------- 13 files changed, 1221 deletions(-) delete mode 100644 jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/PgCursor.java delete mode 100644 jOOQ-meta/src/main/resources/xjb/binding.xjb delete mode 100644 jOOQ/src/main/java/org/jooq/BindingContext.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/AbstractBindingContext.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/AbstractSelect.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/DefaultArray.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/DefaultBindingContext.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/ExistsOperator.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/SelectQueryAsExistsCondition.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/SelectQueryAsField.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/SelectQueryAsSubQueryCondition.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/SelectQueryAsTable.java delete mode 100644 jOOQ/src/main/java/org/jooq/impl/Union.java diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/PgCursor.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/PgCursor.java deleted file mode 100644 index 2fe74441cc..0000000000 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/PgCursor.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * This class is generated by jOOQ - */ -package org.jooq.util.postgres.pg_catalog.routines; - -/** - * This class is generated by jOOQ. - */ -@javax.annotation.Generated(value = { "http://www.jooq.org", "3.4.0" }, - comments = "This class is generated by jOOQ") -@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class PgCursor extends org.jooq.impl.AbstractRoutine { - - private static final long serialVersionUID = 1657262595; - - /** - * The parameter pg_catalog.pg_cursor.name. - */ - public static final org.jooq.Parameter NAME = createParameter("name", org.jooq.impl.SQLDataType.CLOB); - - /** - * The parameter pg_catalog.pg_cursor.statement. - */ - public static final org.jooq.Parameter STATEMENT = createParameter("statement", org.jooq.impl.SQLDataType.CLOB); - - /** - * The parameter pg_catalog.pg_cursor.is_holdable. - */ - public static final org.jooq.Parameter IS_HOLDABLE = createParameter("is_holdable", org.jooq.impl.SQLDataType.BOOLEAN); - - /** - * The parameter pg_catalog.pg_cursor.is_binary. - */ - public static final org.jooq.Parameter IS_BINARY = createParameter("is_binary", org.jooq.impl.SQLDataType.BOOLEAN); - - /** - * The parameter pg_catalog.pg_cursor.is_scrollable. - */ - public static final org.jooq.Parameter IS_SCROLLABLE = createParameter("is_scrollable", org.jooq.impl.SQLDataType.BOOLEAN); - - /** - * The parameter pg_catalog.pg_cursor.creation_time. - */ - public static final org.jooq.Parameter CREATION_TIME = createParameter("creation_time", org.jooq.impl.SQLDataType.TIMESTAMP); - - /** - * Create a new routine call instance - */ - public PgCursor() { - super("pg_cursor", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG); - - addOutParameter(NAME); - addOutParameter(STATEMENT); - addOutParameter(IS_HOLDABLE); - addOutParameter(IS_BINARY); - addOutParameter(IS_SCROLLABLE); - addOutParameter(CREATION_TIME); - } - - /** - * Get the name parameter OUT value from the routine - */ - public java.lang.String getName_() { - return getValue(NAME); - } - - /** - * Get the statement parameter OUT value from the routine - */ - public java.lang.String getStatement() { - return getValue(STATEMENT); - } - - /** - * Get the is_holdable parameter OUT value from the routine - */ - public java.lang.Boolean getIsHoldable() { - return getValue(IS_HOLDABLE); - } - - /** - * Get the is_binary parameter OUT value from the routine - */ - public java.lang.Boolean getIsBinary() { - return getValue(IS_BINARY); - } - - /** - * Get the is_scrollable parameter OUT value from the routine - */ - public java.lang.Boolean getIsScrollable() { - return getValue(IS_SCROLLABLE); - } - - /** - * Get the creation_time parameter OUT value from the routine - */ - public java.sql.Timestamp getCreationTime() { - return getValue(CREATION_TIME); - } -} diff --git a/jOOQ-meta/src/main/resources/xjb/binding.xjb b/jOOQ-meta/src/main/resources/xjb/binding.xjb deleted file mode 100644 index 9517d40c4d..0000000000 --- a/jOOQ-meta/src/main/resources/xjb/binding.xjb +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jOOQ/src/main/java/org/jooq/BindingContext.java b/jOOQ/src/main/java/org/jooq/BindingContext.java deleted file mode 100644 index 80a2fc41a9..0000000000 --- a/jOOQ/src/main/java/org/jooq/BindingContext.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ -package org.jooq; - -public interface BindingContext { - Configuration configuration(); - - SQLDialect dialect(); - - SQLDialect family(); -} \ No newline at end of file diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractBindingContext.java b/jOOQ/src/main/java/org/jooq/impl/AbstractBindingContext.java deleted file mode 100644 index ee520b43e4..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractBindingContext.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ -package org.jooq.impl; - -import org.jooq.BindingContext; -import org.jooq.Configuration; -import org.jooq.SQLDialect; - -/** - * @author Lukas Eder - */ -abstract class AbstractBindingContext implements BindingContext { - - private final Configuration configuration; - - AbstractBindingContext(Configuration configuration) { - this.configuration = configuration; - } - - @Override - public final Configuration configuration() { - return configuration; - } - - @Override - public final SQLDialect dialect() { - return configuration.dialect(); - } - - @Override - public final SQLDialect family() { - return configuration.dialect().family(); - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractSelect.java b/jOOQ/src/main/java/org/jooq/impl/AbstractSelect.java deleted file mode 100644 index 4d7b853cf3..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractSelect.java +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ -package org.jooq.impl; - -import static org.jooq.impl.Utils.fieldArray; - -import java.sql.ResultSetMetaData; -import java.util.List; - -import org.jooq.Configuration; -import org.jooq.DataType; -import org.jooq.Field; -import org.jooq.Record; -import org.jooq.Row; -import org.jooq.Select; -import org.jooq.Table; -import org.jooq.exception.DataAccessException; - -/** - * A common base class for all SELECT statements. - * - * @author Lukas Eder - */ -abstract class AbstractSelect extends AbstractResultQuery implements Select { - - private static final long serialVersionUID = 5432006637149005588L; - - AbstractSelect(Configuration configuration) { - super(configuration); - } - - @Override - public final int fetchCount() throws DataAccessException { - return DSL.using(configuration()).fetchCount(this); - } - - @Override - public final Select union(Select select) { - return new Union(configuration(), this, select, CombineOperator.UNION); - } - - @Override - public final Select unionAll(Select select) { - return new Union(configuration(), this, select, CombineOperator.UNION_ALL); - } - - @Override - public final Select except(Select select) { - return new Union(configuration(), this, select, CombineOperator.EXCEPT); - } - - @Override - public final Select intersect(Select select) { - return new Union(configuration(), this, select, CombineOperator.INTERSECT); - } - - @SuppressWarnings("unchecked") - @Override - public final Field asField() { - if (getSelect().size() != 1) { - throw new IllegalStateException("Can only use single-column ResultProviderQuery as a field"); - } - - return new ScalarSubquery(this, (DataType) getSelect().get(0).getDataType()); - } - - @Override - public final Field asField(String alias) { - return this. asField().as(alias); - } - - @Override - public final Row fieldsRow() { - return asTable().fieldsRow(); - } - - @Override - public final Field field(Field field) { - return asTable().field(field); - } - - @Override - public final Field field(String string) { - return asTable().field(string); - } - - @Override - public final Field field(int index) { - return asTable().field(index); - } - - @Override - public final Field[] fields() { - return asTable().fields(); - } - - @Override - public final Table asTable() { - // Its usually better to alias nested selects that are used in - // the FROM clause of a query - return new DerivedTable(this).as("alias_" + Utils.hash(this)); - } - - @Override - public final Table asTable(String alias) { - return new DerivedTable(this).as(alias); - } - - @Override - public final Table asTable(String alias, String... fieldAliases) { - return new DerivedTable(this).as(alias, fieldAliases); - } - - @Override - protected final Field[] getFields(ResultSetMetaData meta) { - - // [#1808] TODO: Restrict this field list, in case a restricting fetch() - // method was called to get here - List> fields = getSelect(); - - // If no projection was specified explicitly, create fields from result - // set meta data instead. This is typically the case for SELECT * ... - if (fields.isEmpty()) { - Configuration configuration = configuration(); - return new MetaDataFieldProvider(configuration, meta).getFields(); - } - - return fieldArray(fields); - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultArray.java b/jOOQ/src/main/java/org/jooq/impl/DefaultArray.java deleted file mode 100644 index 57a57ab505..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultArray.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ -package org.jooq.impl; - -import java.sql.Array; -import java.sql.ResultSet; -import java.util.Map; - -import org.jooq.SQLDialect; -import org.jooq.exception.SQLDialectNotSupportedException; - -class DefaultArray implements Array { - - private final SQLDialect dialect; - private final Object[] array; - private final Class type; - - public DefaultArray(SQLDialect dialect, Object[] array, Class type) { - this.dialect = dialect; - this.array = array; - this.type = type; - } - - @Override - public String getBaseTypeName() { - return DefaultDataType.getDataType(dialect, type.getComponentType()).getTypeName(); - } - - @Override - public int getBaseType() { - throw new SQLDialectNotSupportedException("Array.getBaseType()"); - } - - @Override - public Object getArray() { - return array; - } - - @Override - public Object getArray(Map> map) { - return array; - } - - @Override - public Object getArray(long index, int count) { - throw new SQLDialectNotSupportedException("Array.getArray(long, int)"); - } - - @Override - public Object getArray(long index, int count, Map> map) { - throw new SQLDialectNotSupportedException("Array.getArray(long, int, Map)"); - } - - @Override - public ResultSet getResultSet() { - throw new SQLDialectNotSupportedException("Array.getResultSet()"); - } - - @Override - public ResultSet getResultSet(Map> map) { - throw new SQLDialectNotSupportedException("Array.getResultSet(Map)"); - } - - @Override - public ResultSet getResultSet(long index, int count) { - throw new SQLDialectNotSupportedException("Array.getResultSet(long, int)"); - } - - @Override - public ResultSet getResultSet(long index, int count, Map> map) { - throw new SQLDialectNotSupportedException("Array.getResultSet(long, int, Map)"); - } - - @Override - public void free() { - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBindingContext.java deleted file mode 100644 index 8bc00f0437..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBindingContext.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ -package org.jooq.impl; - -import org.jooq.Configuration; - -/** - * @author Lukas Eder - */ -@Deprecated -class DefaultBindingContext extends AbstractBindingContext { - DefaultBindingContext(Configuration configuration) { - super(configuration); - } -} \ No newline at end of file diff --git a/jOOQ/src/main/java/org/jooq/impl/ExistsOperator.java b/jOOQ/src/main/java/org/jooq/impl/ExistsOperator.java deleted file mode 100644 index 027098ed26..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/ExistsOperator.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ - -package org.jooq.impl; - -/** - * An operator for the {@link ExistsCondition} - * - * @author Lukas Eder - */ -enum ExistsOperator { - - EXISTS("exists"), - NOT_EXISTS("not exists"); - - private final String sql; - - private ExistsOperator(String sql) { - this.sql = sql; - } - - public String toSQL() { - return sql; - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsExistsCondition.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsExistsCondition.java deleted file mode 100644 index de27fc3259..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsExistsCondition.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ - -package org.jooq.impl; - -import static org.jooq.Clause.CONDITION; -import static org.jooq.Clause.CONDITION_EXISTS; -import static org.jooq.Clause.CONDITION_NOT_EXISTS; -import static org.jooq.impl.ExistsOperator.EXISTS; - -import org.jooq.Clause; -import org.jooq.Context; -import org.jooq.Select; - -/** - * @author Lukas Eder - */ -class SelectQueryAsExistsCondition extends AbstractCondition { - - private static final long serialVersionUID = 5678338161136603292L; - private static final Clause[] CLAUSES_EXISTS = { CONDITION, CONDITION_EXISTS }; - private static final Clause[] CLAUSES_EXISTS_NOT = { CONDITION, CONDITION_NOT_EXISTS }; - - private final Select query; - private final ExistsOperator operator; - - SelectQueryAsExistsCondition(Select query, ExistsOperator operator) { - this.query = query; - this.operator = operator; - } - - @Override - public final void accept(Context ctx) { - - // If this is already a subquery, proceed - if (ctx.subquery()) { - ctx.keyword(operator.toSQL()) - .sql(" (") - .formatIndentStart() - .formatNewLine() - .visit(query) - .formatIndentEnd() - .formatNewLine() - .sql(")"); - } - else { - ctx.keyword(operator.toSQL()) - .sql(" (") - .subquery(true) - .formatIndentStart() - .formatNewLine() - .visit(query) - .formatIndentEnd() - .formatNewLine() - .subquery(false) - .sql(")"); - } - } - - @Override - public final Clause[] clauses(Context ctx) { - return operator == EXISTS ? CLAUSES_EXISTS : CLAUSES_EXISTS_NOT; - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsField.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsField.java deleted file mode 100644 index 01b1633dfa..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsField.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ - -package org.jooq.impl; - -import org.jooq.Context; -import org.jooq.DataType; -import org.jooq.Field; -import org.jooq.Select; - -/** - * @author Lukas Eder - */ -class SelectQueryAsField extends AbstractField { - - private static final long serialVersionUID = 3463144434073231750L; - - private final Select query; - - SelectQueryAsField(Select query, DataType type) { - super("select", type); - - this.query = query; - } - - @Override - public final Field as(String alias) { - return new FieldAlias(this, alias); - } - - @Override - public final void accept(Context ctx) { - - // If this is already a subquery, proceed - if (ctx.subquery()) { - ctx.sql("(") - .formatIndentStart() - .formatNewLine() - .visit(query) - .formatIndentEnd() - .formatNewLine() - .sql(")"); - } - else { - ctx.sql("(") - .subquery(true) - .formatIndentStart() - .formatNewLine() - .visit(query) - .formatIndentEnd() - .formatNewLine() - .subquery(false) - .sql(")"); - } - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsSubQueryCondition.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsSubQueryCondition.java deleted file mode 100644 index d938b68e2f..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsSubQueryCondition.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ - -package org.jooq.impl; - -import static org.jooq.Clause.CONDITION; -import static org.jooq.Clause.CONDITION_COMPARISON; - -import org.jooq.Clause; -import org.jooq.Comparator; -import org.jooq.Context; -import org.jooq.Field; -import org.jooq.Select; - -/** - * @author Lukas Eder - */ -class SelectQueryAsSubQueryCondition extends AbstractCondition { - - private static final long serialVersionUID = -402776705884329740L; - private static final Clause[] CLAUSES = { CONDITION, CONDITION_COMPARISON }; - - private final Select query; - private final Field field; - private final Comparator comparator; - - SelectQueryAsSubQueryCondition(Select query, Field field, Comparator comparator) { - this.query = query; - this.field = field; - this.comparator = comparator; - } - - @Override - public final void accept(Context ctx) { - - // If this is already a subquery, proceed - if (ctx.subquery()) { - ctx.visit(field) - .sql(" ") - .keyword(comparator.toSQL()) - .sql(" (") - .formatIndentStart() - .formatNewLine() - .visit(query) - .formatIndentEnd() - .formatNewLine() - .sql(")"); - } - else { - ctx.visit(field) - .sql(" ") - .keyword(comparator.toSQL()) - .sql(" (") - .subquery(true) - .formatIndentStart() - .formatNewLine() - .visit(query) - .formatIndentEnd() - .formatNewLine() - .subquery(false) - .sql(")"); - } - } - - @Override - public final Clause[] clauses(Context ctx) { - return CLAUSES; - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsTable.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsTable.java deleted file mode 100644 index 54b4c13440..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryAsTable.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ - -package org.jooq.impl; - -import org.jooq.Clause; -import org.jooq.Context; -import org.jooq.Record; -import org.jooq.Select; -import org.jooq.Table; - -/** - * @author Lukas Eder - */ -class SelectQueryAsTable extends AbstractTable { - - private static final long serialVersionUID = 6272398035926615668L; - - private final Select query; - - SelectQueryAsTable(Select query) { - super("select"); - - this.query = query; - } - - final Select query() { - return query; - } - - @Override - public final Table as(String alias) { - return new TableAlias(this, alias, true); - } - - @Override - public final Table as(String alias, String... fieldAliases) { - return new TableAlias(this, alias, fieldAliases, true); - } - - @Override - final Fields fields0() { - return new Fields(query.getSelect()); - } - - @Override - public final Class getRecordType() { - return query.getRecordType(); - } - - @Override - public final void accept(Context ctx) { - - // If this is already a subquery, proceed - if (ctx.subquery()) { - ctx.formatIndentStart() - .formatNewLine() - .visit(query) - .formatIndentEnd() - .formatNewLine(); - } - else { - ctx.subquery(true) - .formatIndentStart() - .formatNewLine() - .visit(query) - .formatIndentEnd() - .formatNewLine() - .subquery(false); - } - } - - @Override - public final Clause[] clauses(Context ctx) { - return null; - } -} diff --git a/jOOQ/src/main/java/org/jooq/impl/Union.java b/jOOQ/src/main/java/org/jooq/impl/Union.java deleted file mode 100644 index a29e687b1f..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/Union.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com) - * All rights reserved. - * - * This work is dual-licensed - * - under the Apache Software License 2.0 (the "ASL") - * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") - * ============================================================================= - * You may choose which license applies to you: - * - * - If you're using this work with Open Source databases, you may choose - * either ASL or jOOQ License. - * - If you're using this work with at least one commercial database, you must - * choose jOOQ License - * - * For more information, please visit http://www.jooq.org/licenses - * - * Apache Software License 2.0: - * ----------------------------------------------------------------------------- - * 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. - * - * jOOQ License and Maintenance Agreement: - * ----------------------------------------------------------------------------- - * Data Geekery grants the Customer the non-exclusive, timely limited and - * non-transferable license to install and use the Software under the terms of - * the jOOQ License and Maintenance Agreement. - * - * This library is distributed with a LIMITED WARRANTY. See the jOOQ License - * and Maintenance Agreement for more details: http://www.jooq.org/licensing - */ -package org.jooq.impl; - -import static org.jooq.Clause.SELECT_EXCEPT; -import static org.jooq.Clause.SELECT_INTERSECT; -import static org.jooq.Clause.SELECT_UNION; -import static org.jooq.Clause.SELECT_UNION_ALL; - -import java.util.ArrayList; -import java.util.List; - -import org.jooq.Clause; -import org.jooq.Configuration; -import org.jooq.Context; -import org.jooq.Field; -import org.jooq.Record; -import org.jooq.Select; - -/** - * A union is a SELECT statement that combines several sub-selects - * with a UNION or a similar operator. - * - * @author Lukas Eder - */ -class Union extends AbstractSelect { - - private static final long serialVersionUID = 7491446471677986172L; - - private final List> queries; - private final CombineOperator operator; - private final Clause[] clauses; - - Union(Configuration configuration, Select query1, Select query2, CombineOperator operator) { - super(configuration); - - this.queries = new ArrayList>(); - this.queries.add(query1); - this.queries.add(query2); - this.operator = operator; - - switch (operator) { - case EXCEPT: this.clauses = new Clause[] { SELECT_EXCEPT } ; break; - case INTERSECT: this.clauses = new Clause[] { SELECT_INTERSECT } ; break; - case UNION: this.clauses = new Clause[] { SELECT_UNION } ; break; - case UNION_ALL: this.clauses = new Clause[] { SELECT_UNION_ALL } ; break; - default: throw new IllegalArgumentException("Operator not supported : " + operator); - } - } - - @Override - public final Class getRecordType() { - return queries.get(0).getRecordType(); - } - - @Override - public final List> getSelect() { - return queries.get(0).getSelect(); - } - - @Override - public final void accept(Context ctx) { - for (int i = 0; i < queries.size(); i++) { - if (i != 0) { - ctx.formatSeparator() - .keyword(operator.toSQL(ctx.configuration().dialect())) - .formatSeparator(); - } - - wrappingParenthesis(ctx, "("); - ctx.visit(queries.get(i)); - wrappingParenthesis(ctx, ")"); - } - } - - private final void wrappingParenthesis(Context ctx, String parenthesis) { - switch (ctx.configuration().dialect()) { - // Sybase ASE, Derby, Firebird and SQLite have some syntax issues with unions. - // Check out https://issues.apache.org/jira/browse/DERBY-2374 - /* [pro] xx - xxxx xxxxxxx - xxxx xxxx - xx [/pro] */ - case DERBY: - case FIREBIRD: - case SQLITE: - - // [#288] MySQL has a very special way of dealing with UNION's - // So include it as well - case MARIADB: - case MYSQL: - return; - } - - if (")".equals(parenthesis)) { - ctx.formatIndentEnd() - .formatNewLine(); - } - - ctx.sql(parenthesis); - - if ("(".equals(parenthesis)) { - ctx.formatIndentStart() - .formatNewLine(); - } - } - - @Override - public final Clause[] clauses(Context ctx) { - return clauses; - } - - @Override - final boolean isForUpdate() { - return false; - } -}