diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 6ba173a2ff..e6af0876a5 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -6544,11 +6544,304 @@ public class DSL { // XXX Global Field and Function factory // ------------------------------------------------------------------------- + /** + * Wrap a {@link SelectField} in a general-purpose {@link Field} + */ @Support public static Field field(SelectField field) { return field instanceof Field ? (Field) field : field("{0}", field.getDataType(), field); } + // [jooq-tools] START [row-field] + + /** + * Turn a row value expression of degree 1 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row1 row) { + return new RowField, Record1>(row); + } + + /** + * Turn a row value expression of degree 2 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row2 row) { + return new RowField, Record2>(row); + } + + /** + * Turn a row value expression of degree 3 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row3 row) { + return new RowField, Record3>(row); + } + + /** + * Turn a row value expression of degree 4 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row4 row) { + return new RowField, Record4>(row); + } + + /** + * Turn a row value expression of degree 5 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row5 row) { + return new RowField, Record5>(row); + } + + /** + * Turn a row value expression of degree 6 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row6 row) { + return new RowField, Record6>(row); + } + + /** + * Turn a row value expression of degree 7 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row7 row) { + return new RowField, Record7>(row); + } + + /** + * Turn a row value expression of degree 8 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row8 row) { + return new RowField, Record8>(row); + } + + /** + * Turn a row value expression of degree 9 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row9 row) { + return new RowField, Record9>(row); + } + + /** + * Turn a row value expression of degree 10 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row10 row) { + return new RowField, Record10>(row); + } + + /** + * Turn a row value expression of degree 11 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row11 row) { + return new RowField, Record11>(row); + } + + /** + * Turn a row value expression of degree 12 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row12 row) { + return new RowField, Record12>(row); + } + + /** + * Turn a row value expression of degree 13 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row13 row) { + return new RowField, Record13>(row); + } + + /** + * Turn a row value expression of degree 14 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row14 row) { + return new RowField, Record14>(row); + } + + /** + * Turn a row value expression of degree 15 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row15 row) { + return new RowField, Record15>(row); + } + + /** + * Turn a row value expression of degree 16 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row16 row) { + return new RowField, Record16>(row); + } + + /** + * Turn a row value expression of degree 17 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row17 row) { + return new RowField, Record17>(row); + } + + /** + * Turn a row value expression of degree 18 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row18 row) { + return new RowField, Record18>(row); + } + + /** + * Turn a row value expression of degree 19 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row19 row) { + return new RowField, Record19>(row); + } + + /** + * Turn a row value expression of degree 20 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row20 row) { + return new RowField, Record20>(row); + } + + /** + * Turn a row value expression of degree 21 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row21 row) { + return new RowField, Record21>(row); + } + + /** + * Turn a row value expression of degree 22 into a {@code Field}. + *

+ * Note: Not all databases support row value expressions, but many row value + * expression operations can be simulated on all databases. See relevant row + * value expression method Javadocs for details. + */ + @Generated("This method was generated using jOOQ-tools") + @Support({ POSTGRES }) + public static Field> field(Row22 row) { + return new RowField, Record22>(row); + } + +// [jooq-tools] END [row-field] + /** * Transform a subquery into a correlated subquery. */ @@ -11511,7 +11804,7 @@ public class DSL { return row(Utils.fields(values).toArray(new Field[0])); } -// [jooq-tools] START [row-field] +// [jooq-tools] START [row-expression] /** * Create a row value expression of degree 1. @@ -11799,7 +12092,7 @@ public class DSL { return new RowImpl(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22); } -// [jooq-tools] END [row-field] +// [jooq-tools] END [row-expression] /** * Create a row value expression of degree N > 22. diff --git a/jOOQ/src/main/java/org/jooq/impl/RowField.java b/jOOQ/src/main/java/org/jooq/impl/RowField.java new file mode 100644 index 0000000000..386961aaaf --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/RowField.java @@ -0,0 +1,70 @@ +/** + * 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.Record; +import org.jooq.Row; + +/** + * @author Lukas Eder + */ +class RowField extends AbstractField { + + /** + * Generated UID + */ + private static final long serialVersionUID = -2065258332642911588L; + + private final R1 row; + + RowField(R1 row) { + super("row", (DataType) SQLDataType.RECORD); + + this.row = row; + } + + @Override + public final void accept(Context ctx) { + ctx.visit(row); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/SQLDataType.java b/jOOQ/src/main/java/org/jooq/impl/SQLDataType.java index f73c710a8c..52932caa40 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SQLDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/SQLDataType.java @@ -297,6 +297,11 @@ public final class SQLDataType { */ public static final DataType OTHER = new DefaultDataType(null, Object.class, "other"); + /** + * The {@link Types#STRUCT} type. + */ + public static final DataType RECORD = new DefaultDataType(null, Record.class, "record"); + /** * The {@link ResultSet} type. *