diff --git a/jOOQ-tools/src/org/jooq/xtend/BetweenAndSteps.xtend b/jOOQ-tools/src/org/jooq/xtend/BetweenAndSteps.xtend index c8b630adc9..909027c3bb 100644 --- a/jOOQ-tools/src/org/jooq/xtend/BetweenAndSteps.xtend +++ b/jOOQ-tools/src/org/jooq/xtend/BetweenAndSteps.xtend @@ -56,8 +56,6 @@ class BetweenAndSteps extends Generators { «classHeader» package org.jooq; - import org.jooq.Support; - import javax.annotation.Generated; /** @@ -108,7 +106,6 @@ class BetweenAndSteps extends Generators { package org.jooq.impl; import static java.util.Arrays.asList; - import static org.jooq.impl.DSL.row; import static org.jooq.SQLDialect.ASE; import static org.jooq.SQLDialect.CUBRID; import static org.jooq.SQLDialect.DB2; @@ -120,6 +117,7 @@ class BetweenAndSteps extends Generators { import static org.jooq.SQLDialect.SQLITE; import static org.jooq.SQLDialect.SQLSERVER; import static org.jooq.SQLDialect.SYBASE; + import static org.jooq.impl.DSL.row; import javax.annotation.Generated; @@ -249,7 +247,7 @@ class BetweenAndSteps extends Generators { RowN max = (RowN) maxValue; // These dialects don't support the SYMMETRIC keyword at all - if (symmetric && asList(ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, MYSQL, ORACLE, SQLITE, SQLSERVER, SYBASE).contains(configuration.getDialect())) { + if (symmetric && asList(ASE, CUBRID, DB2, DERBY, FIREBIRD, H2, MYSQL, ORACLE, SQLITE, SQLSERVER, SYBASE).contains(configuration.dialect())) { if (not) { return (QueryPartInternal) r.notBetween(min, max).and(r.notBetween(max, min)); } @@ -260,7 +258,7 @@ class BetweenAndSteps extends Generators { // These dialects either don't support row value expressions, or they // Can't handle row value expressions with the BETWEEN predicate - else if (row.size() > 1 && asList(CUBRID, DERBY, FIREBIRD, MYSQL, ORACLE, SQLITE, SQLSERVER, SYBASE).contains(configuration.getDialect())) { + else if (row.size() > 1 && asList(CUBRID, DERBY, FIREBIRD, MYSQL, ORACLE, SQLITE, SQLSERVER, SYBASE).contains(configuration.dialect())) { Condition result = r.ge(min).and(r.le(max)); if (not) { diff --git a/jOOQ-tools/src/org/jooq/xtend/DSLContext.xtend b/jOOQ-tools/src/org/jooq/xtend/DSLContext.xtend index 93b0982c14..477b6c8516 100644 --- a/jOOQ-tools/src/org/jooq/xtend/DSLContext.xtend +++ b/jOOQ-tools/src/org/jooq/xtend/DSLContext.xtend @@ -76,7 +76,7 @@ class DSLContext extends Generators { * statement from this {@link DSLContext}. If you don't need to render or * execute this SELECT statement (e.g. because you want to * create a subselect), consider using the static - * {@link Factory#select(«FOR d : (1..degree) SEPARATOR ', '»Field«ENDFOR»)} instead. + * {@link DSL#select(«FOR d : (1..degree) SEPARATOR ', '»Field«ENDFOR»)} instead. *

* Example:

                  * using(configuration)
@@ -87,7 +87,7 @@ class DSLContext extends Generators {
                  *       .orderBy(field2);
                  * 
* - * @see Factory#selectDistinct(Field...) + * @see DSL#selectDistinct(Field...) * @see #selectDistinct(Field...) */ «generatedMethod» @@ -134,7 +134,7 @@ class DSLContext extends Generators { * statement from this {@link DSLContext}. If you don't need to render or * execute this SELECT statement (e.g. because you want to * create a subselect), consider using the static - * {@link Factory#selectDistinct(«FOR d : (1..degree) SEPARATOR ', '»Field«ENDFOR»)} instead. + * {@link DSL#selectDistinct(«FOR d : (1..degree) SEPARATOR ', '»Field«ENDFOR»)} instead. *

* Example:

                  * using(configuration)
@@ -145,7 +145,7 @@ class DSLContext extends Generators {
                  *       .orderBy(field2);
                  * 
* - * @see Factory#selectDistinct(Field...) + * @see DSL#selectDistinct(Field...) * @see #selectDistinct(Field...) */ «generatedMethod» diff --git a/jOOQ-tools/src/org/jooq/xtend/Factory.xtend b/jOOQ-tools/src/org/jooq/xtend/Factory.xtend deleted file mode 100644 index 8b7f625fb7..0000000000 --- a/jOOQ-tools/src/org/jooq/xtend/Factory.xtend +++ /dev/null @@ -1,251 +0,0 @@ -/** - * Copyright (c) 2009-2013, Lukas Eder, lukas.eder@gmail.com - * All rights reserved. - * - * This software is licensed to you under the Apache License, Version 2.0 - * (the "License"); You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * . Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * . Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * . Neither the name "jOOQ" nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -package org.jooq.xtend - -import org.jooq.Constants - -class Factory extends Generators { - - def static void main(String[] args) { - val factory = new Factory(); - factory.generateSelect(); - factory.generateSelectDistinct(); - factory.generateRowValue(); - factory.generateRowField(); - factory.generateValues(); - } - - def generateSelect() { - val out = new StringBuilder(); - - for (degree : (1..Constants::MAX_ROW_DEGREE)) { - var fieldOrRow = "Row" + degree; - - if (degree == 1) { - fieldOrRow = "Field"; - } - - out.append(''' - - /** - * Create a new DSL subselect statement. - *

- * This is the same as {@link #select(Field...)}, except that it declares - * additional record-level typesafety, which is needed by - * {@link «fieldOrRow»#in(Select)}, {@link «fieldOrRow»#equal(Select)} and other predicate - * building methods taking subselect arguments. - *

- * Unlike {@link Select} factory methods in the {@link DSLContext} API, this - * creates an unattached, and thus not directly renderable or executable - * SELECT statement. You can use this statement in two ways: - *

- *

- * Example:

-                 * import static org.jooq.impl.DSL.*;
-                 *
-                 * // [...]
-                 *
-                 * select(«field1_field2_fieldn(degree)»)
-                 *  .from(table1)
-                 *  .join(table2).on(field1.equal(field2))
-                 *  .where(field1.greaterThan(100))
-                 *  .orderBy(field2);
-                 * 
- * - * @see DSLContext#select(Field...) - * @see #select(Field...) - */ - «generatedMethod» - @Support - public static <«TN(degree)»> SelectSelectStep> select(«Field_TN_fieldn(degree)») { - return (SelectSelectStep) select(new Field[] { «fieldn(degree)» }); - } - '''); - } - - insert("org.jooq.impl.Factory", out, "select"); - } - - def generateSelectDistinct() { - val out = new StringBuilder(); - - for (degree : (1..Constants::MAX_ROW_DEGREE)) { - var fieldOrRow = "Row" + degree; - - if (degree == 1) { - fieldOrRow = "Field"; - } - - out.append(''' - - /** - * Create a new DSL subselect statement. - *

- * This is the same as {@link #selectDistinct(Field...)}, except that it - * declares additional record-level typesafety, which is needed by - * {@link «fieldOrRow»#in(Select)}, {@link «fieldOrRow»#equal(Select)} and other predicate - * building methods taking subselect arguments. - *

- * Unlike {@link Select} factory methods in the {@link DSLContext} API, this - * creates an unattached, and thus not directly renderable or executable - * SELECT statement. You can use this statement in two ways: - *

- *

- * Example:

-                 * import static org.jooq.impl.DSL.*;
-                 *
-                 * // [...]
-                 *
-                 * selectDistinct(«field1_field2_fieldn(degree)»)
-                 *  .from(table1)
-                 *  .join(table2).on(field1.equal(field2))
-                 *  .where(field1.greaterThan(100))
-                 *  .orderBy(field2);
-                 * 
- * - * @see DSLContext#selectDistinct(Field...) - * @see #selectDistinct(Field...) - */ - «generatedMethod» - @Support - public static <«TN(degree)»> SelectSelectStep> selectDistinct(«Field_TN_fieldn(degree)») { - return (SelectSelectStep) selectDistinct(new Field[] { «fieldn(degree)» }); - } - '''); - } - - insert("org.jooq.impl.Factory", out, "selectDistinct"); - } - - def generateRowValue() { - val out = new StringBuilder(); - - for (degree : (1..Constants::MAX_ROW_DEGREE)) { - out.append(''' - - /** - * Create a row value expression of degree «degree». - *

- * 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. - */ - «generatedMethod» - @Support - public static <«TN(degree)»> Row«degree»<«TN(degree)»> row(«TN_tn(degree)») { - return row(«Utils_field_tn(degree)»); - } - '''); - } - - insert("org.jooq.impl.Factory", out, "row-value"); - } - - def generateRowField() { - val out = new StringBuilder(); - - for (degree : (1..Constants::MAX_ROW_DEGREE)) { - out.append(''' - - /** - * Create a row value expression of degree «degree». - *

- * 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. - */ - «generatedMethod» - @Support - public static <«TN(degree)»> Row«degree»<«TN(degree)»> row(«Field_TN_tn(degree)») { - return new RowImpl(«tn(degree)»); - } - '''); - } - - insert("org.jooq.impl.Factory", out, "row-field"); - } - - def generateValues() { - val out = new StringBuilder(); - - for (degree : (1..Constants::MAX_ROW_DEGREE)) { - out.append(''' - - /** - * Create a VALUES() expression of degree «degree». - *

- * The VALUES() constructor is a tool supported by some - * databases to allow for constructing tables from constant values. - *

- * If a database doesn't support the VALUES() constructor, it - * can be simulated using SELECT .. UNION ALL ... The following - * expressions are equivalent: - *

- *


-                 * -- Using VALUES() constructor
-                 * VALUES(«FOR d : (1..degree) SEPARATOR ', '»val1_«d»«ENDFOR»),
-                 *       («FOR d : (1..degree) SEPARATOR ', '»val2_«d»«ENDFOR»),
-                 *       («FOR d : (1..degree) SEPARATOR ', '»val3_«d»«ENDFOR»)
-                 * AS "v"(«FOR d : (1..degree) SEPARATOR ', '»"c«d»"  «ENDFOR»)
-                 *
-                 * -- Using UNION ALL
-                 * SELECT «FOR d : (1..degree) SEPARATOR ', '»val1_«d» AS "c«d»"«ENDFOR») UNION ALL
-                 * SELECT «FOR d : (1..degree) SEPARATOR ', '»val1_«d» AS "c«d»"«ENDFOR») UNION ALL
-                 * SELECT «FOR d : (1..degree) SEPARATOR ', '»val1_«d» AS "c«d»"«ENDFOR»)
-                 * 
- *

- * Use {@link Table#as(String, String...)} to rename the resulting table and - * its columns. - */ - «generatedMethod» - @Support - public static <«TN(degree)»> Table> values(Row«degree»<«TN(degree)»>... rows) { - return new Values>(rows).as("v", «FOR d : (1..degree) SEPARATOR ', '»"c«d»"«ENDFOR»); - } - '''); - } - - insert("org.jooq.impl.Factory", out, "values"); - } -} \ No newline at end of file diff --git a/jOOQ-tools/src/org/jooq/xtend/GenerateAll.xtend b/jOOQ-tools/src/org/jooq/xtend/GenerateAll.xtend index d7df1869bc..841d6942f5 100644 --- a/jOOQ-tools/src/org/jooq/xtend/GenerateAll.xtend +++ b/jOOQ-tools/src/org/jooq/xtend/GenerateAll.xtend @@ -5,7 +5,6 @@ class GenerateAll { BetweenAndSteps::main(args); Conversions::main(args); DSLContext::main(args); - Factory::main(args); InsertDSL::main(args); MergeDSL::main(args); Records::main(args); diff --git a/jOOQ/src/main/java/org/jooq/impl/RowBetweenCondition.java b/jOOQ/src/main/java/org/jooq/impl/RowBetweenCondition.java index 2250a9bc17..68f528b2f2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/RowBetweenCondition.java +++ b/jOOQ/src/main/java/org/jooq/impl/RowBetweenCondition.java @@ -52,6 +52,14 @@ import static org.jooq.impl.DSL.row; import javax.annotation.Generated; import org.jooq.BetweenAndStep1; +import org.jooq.BetweenAndStep2; +import org.jooq.BetweenAndStep3; +import org.jooq.BetweenAndStep4; +import org.jooq.BetweenAndStep5; +import org.jooq.BetweenAndStep6; +import org.jooq.BetweenAndStep7; +import org.jooq.BetweenAndStep8; +import org.jooq.BetweenAndStep9; import org.jooq.BetweenAndStep10; import org.jooq.BetweenAndStep11; import org.jooq.BetweenAndStep12; @@ -62,17 +70,9 @@ import org.jooq.BetweenAndStep16; import org.jooq.BetweenAndStep17; import org.jooq.BetweenAndStep18; import org.jooq.BetweenAndStep19; -import org.jooq.BetweenAndStep2; import org.jooq.BetweenAndStep20; import org.jooq.BetweenAndStep21; import org.jooq.BetweenAndStep22; -import org.jooq.BetweenAndStep3; -import org.jooq.BetweenAndStep4; -import org.jooq.BetweenAndStep5; -import org.jooq.BetweenAndStep6; -import org.jooq.BetweenAndStep7; -import org.jooq.BetweenAndStep8; -import org.jooq.BetweenAndStep9; import org.jooq.BetweenAndStepN; import org.jooq.BindContext; import org.jooq.Condition; @@ -81,6 +81,14 @@ import org.jooq.Field; import org.jooq.QueryPartInternal; import org.jooq.Record; import org.jooq.Record1; +import org.jooq.Record2; +import org.jooq.Record3; +import org.jooq.Record4; +import org.jooq.Record5; +import org.jooq.Record6; +import org.jooq.Record7; +import org.jooq.Record8; +import org.jooq.Record9; import org.jooq.Record10; import org.jooq.Record11; import org.jooq.Record12; @@ -91,20 +99,20 @@ import org.jooq.Record16; import org.jooq.Record17; import org.jooq.Record18; import org.jooq.Record19; -import org.jooq.Record2; import org.jooq.Record20; import org.jooq.Record21; import org.jooq.Record22; -import org.jooq.Record3; -import org.jooq.Record4; -import org.jooq.Record5; -import org.jooq.Record6; -import org.jooq.Record7; -import org.jooq.Record8; -import org.jooq.Record9; import org.jooq.RenderContext; import org.jooq.Row; import org.jooq.Row1; +import org.jooq.Row2; +import org.jooq.Row3; +import org.jooq.Row4; +import org.jooq.Row5; +import org.jooq.Row6; +import org.jooq.Row7; +import org.jooq.Row8; +import org.jooq.Row9; import org.jooq.Row10; import org.jooq.Row11; import org.jooq.Row12; @@ -115,17 +123,9 @@ import org.jooq.Row16; import org.jooq.Row17; import org.jooq.Row18; import org.jooq.Row19; -import org.jooq.Row2; import org.jooq.Row20; import org.jooq.Row21; import org.jooq.Row22; -import org.jooq.Row3; -import org.jooq.Row4; -import org.jooq.Row5; -import org.jooq.Row6; -import org.jooq.Row7; -import org.jooq.Row8; -import org.jooq.Row9; import org.jooq.RowN; /**