diff --git a/jOOQ-codegen-maven-example/pom.xml b/jOOQ-codegen-maven-example/pom.xml index e876428bbc..c39bef60c5 100644 --- a/jOOQ-codegen-maven-example/pom.xml +++ b/jOOQ-codegen-maven-example/pom.xml @@ -9,7 +9,7 @@ org.jooq jooq-codegen-maven-example - 2.3.0 + 2.4.0-SNAPSHOT jar jOOQ Codegen Maven @@ -51,7 +51,7 @@ org.jooq jooq - 2.3.0 + 2.4.0-SNAPSHOT jar compile @@ -106,7 +106,7 @@ org.jooq jooq-codegen-maven - 2.3.0 + 2.4.0-SNAPSHOT exec1 diff --git a/jOOQ-codegen-maven/pom.xml b/jOOQ-codegen-maven/pom.xml index 55b100a06a..293702dcfb 100644 --- a/jOOQ-codegen-maven/pom.xml +++ b/jOOQ-codegen-maven/pom.xml @@ -6,12 +6,12 @@ 7 4.0.0 - + org.jooq jooq-codegen-maven - 2.3.0 + 2.4.0-SNAPSHOT maven-plugin - + jOOQ Codegen Maven jOOQ effectively combines complex SQL, typesafety, source code generation, active records, stored procedures, advanced data types, and Java in a fluent, intuitive DSL. http://www.jooq.org @@ -35,7 +35,7 @@ Trac https://sourceforge.net/apps/trac/jooq/report/6 - + Lukas Eder @@ -46,7 +46,7 @@ sander.plas@gmail.com - + deploy ${project.artifactId}-${project.version} @@ -66,7 +66,7 @@ - + org.apache.maven.plugins maven-compiler-plugin @@ -133,7 +133,7 @@ UTF-8 - + org.apache.maven.plugins maven-eclipse-plugin @@ -160,7 +160,7 @@ org.jooq jooq-codegen - 2.3.0 + 2.4.0-SNAPSHOT jar diff --git a/jOOQ-codegen/pom.xml b/jOOQ-codegen/pom.xml index e37b793b8c..de33274439 100644 --- a/jOOQ-codegen/pom.xml +++ b/jOOQ-codegen/pom.xml @@ -10,7 +10,7 @@ org.jooq jooq-codegen - 2.3.0 + 2.4.0-SNAPSHOT jar jOOQ Codegen @@ -118,7 +118,7 @@ UTF-8 - + org.apache.maven.plugins maven-eclipse-plugin @@ -134,7 +134,7 @@ Trac https://sourceforge.net/apps/trac/jooq/report/6 - + Lukas Eder @@ -150,14 +150,14 @@ org.jooq jooq - 2.3.0 + 2.4.0-SNAPSHOT jar compile org.jooq jooq-meta - 2.3.0 + 2.4.0-SNAPSHOT jar compile diff --git a/jOOQ-codegen/src/main/java/org/jooq/util/DefaultGenerator.java b/jOOQ-codegen/src/main/java/org/jooq/util/DefaultGenerator.java index 39563d7230..d46fe83773 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/util/DefaultGenerator.java +++ b/jOOQ-codegen/src/main/java/org/jooq/util/DefaultGenerator.java @@ -2979,8 +2979,8 @@ public class DefaultGenerator implements Generator { String typeClass = "org.jooq.util." + db.getDialect().getName().toLowerCase() + - "."+ - db.getDialect().getName()+ + "." + + db.getDialect().getName() + "DataType"; sb.append(typeClass); @@ -3007,14 +3007,14 @@ public class DefaultGenerator implements Generator { // Mostly because of unsupported data types catch (SQLDialectNotSupportedException e) { sb.append("getDefaultDataType(\""); - sb.append(t); + sb.append(t.replace("\"", "\\\"")); sb.append("\")"); } // More unsupported data types catch (ReflectException e) { sb.append("getDefaultDataType(\""); - sb.append(t); + sb.append(t.replace("\"", "\\\"")); sb.append("\")"); } } diff --git a/jOOQ-codegen/src/main/java/org/jooq/util/GeneratorStrategyWrapper.java b/jOOQ-codegen/src/main/java/org/jooq/util/GeneratorStrategyWrapper.java index e325caa232..b54e4cb890 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/util/GeneratorStrategyWrapper.java +++ b/jOOQ-codegen/src/main/java/org/jooq/util/GeneratorStrategyWrapper.java @@ -46,6 +46,7 @@ import java.util.Map; import java.util.Set; import org.jooq.Record; +import org.jooq.impl.AbstractRoutine; import org.jooq.impl.TableRecordImpl; import org.jooq.impl.UDTRecordImpl; import org.jooq.impl.UpdatableRecordImpl; @@ -157,6 +158,11 @@ class GeneratorStrategyWrapper extends AbstractGeneratorStrategy { } } + // [#1406] Disambiguate also procedure parameters + else if (definition instanceof ParameterDefinition) { + reserved = reservedColumns(AbstractRoutine.class); + } + if (reserved != null) { if (reserved.contains(method)) { return method + "_"; diff --git a/jOOQ-console/pom.xml b/jOOQ-console/pom.xml index a5bc670e77..29eaf7490a 100644 --- a/jOOQ-console/pom.xml +++ b/jOOQ-console/pom.xml @@ -10,7 +10,7 @@ org.jooq jooq-console - 2.3.0 + 2.4.0-SNAPSHOT jar jOOQ @@ -201,7 +201,7 @@ org.jooq jooq - 2.3.0 + 2.4.0-SNAPSHOT jar compile diff --git a/jOOQ-meta/pom.xml b/jOOQ-meta/pom.xml index 348f64f3e3..0dd6556472 100644 --- a/jOOQ-meta/pom.xml +++ b/jOOQ-meta/pom.xml @@ -9,7 +9,7 @@ org.jooq jooq-meta - 2.3.0 + 2.4.0-SNAPSHOT jar jOOQ Meta @@ -198,7 +198,7 @@ org.jooq jooq - 2.3.0 + 2.4.0-SNAPSHOT jar compile diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/PgCatalog.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/PgCatalog.java index c25fa727be..45bb9ba81c 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/PgCatalog.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/PgCatalog.java @@ -6,11 +6,11 @@ package org.jooq.util.postgres.pg_catalog; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class PgCatalog extends org.jooq.impl.SchemaImpl { - private static final long serialVersionUID = -1216270135; + private static final long serialVersionUID = 1109544775; /** * The singleton instance of pg_catalog diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/PgCatalogFactory.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/PgCatalogFactory.java index 9eb63024bc..2c7876ce2b 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/PgCatalogFactory.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/PgCatalogFactory.java @@ -6,11 +6,11 @@ package org.jooq.util.postgres.pg_catalog; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class PgCatalogFactory extends org.jooq.util.postgres.PostgresFactory { - private static final long serialVersionUID = -2055956907; + private static final long serialVersionUID = 1813233842; /** * Create a factory with a connection @@ -19,6 +19,8 @@ public class PgCatalogFactory extends org.jooq.util.postgres.PostgresFactory { */ public PgCatalogFactory(java.sql.Connection connection) { super(connection); + + initDefaultSchema(); } /** @@ -29,5 +31,16 @@ public class PgCatalogFactory extends org.jooq.util.postgres.PostgresFactory { */ public PgCatalogFactory(java.sql.Connection connection, org.jooq.conf.Settings settings) { super(connection, settings); + + initDefaultSchema(); + } + + /** + * Initialise the render mapping's default schema. + *

+ * For convenience, this schema-specific factory should override any pre-existing setting + */ + private final void initDefaultSchema() { + org.jooq.conf.SettingsTools.getRenderMapping(getSettings()).setDefaultSchema(org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG.getName()); } } diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/Routines.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/Routines.java index a597f02a48..ea86211096 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/Routines.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/Routines.java @@ -8,10 +8,70 @@ package org.jooq.util.postgres.pg_catalog; * * Convenience access to all stored procedures and functions in pg_catalog */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public final class Routines { + /** + * Call pg_catalog.count + * + * @throws org.jooq.exception.DataAccessException if something went wrong executing the query + */ + public static java.lang.Long count2(org.jooq.Configuration configuration) { + org.jooq.util.postgres.pg_catalog.routines.Count2 f = new org.jooq.util.postgres.pg_catalog.routines.Count2(); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get pg_catalog.count as a field + * + */ + public static org.jooq.Field count2() { + org.jooq.util.postgres.pg_catalog.routines.Count2 f = new org.jooq.util.postgres.pg_catalog.routines.Count2(); + + return f.asField(); + } + + /** + * Call pg_catalog.count + * + * @param __1 + * @throws org.jooq.exception.DataAccessException if something went wrong executing the query + */ + public static java.lang.Long count1(org.jooq.Configuration configuration, java.lang.Object __1) { + org.jooq.util.postgres.pg_catalog.routines.Count1 f = new org.jooq.util.postgres.pg_catalog.routines.Count1(); + f.set__1(__1); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get pg_catalog.count as a field + * + * @param __1 + */ + public static org.jooq.Field count1(java.lang.Object __1) { + org.jooq.util.postgres.pg_catalog.routines.Count1 f = new org.jooq.util.postgres.pg_catalog.routines.Count1(); + f.set__1(__1); + + return f.asField(); + } + + /** + * Get pg_catalog.count as a field + * + * @param __1 + */ + public static org.jooq.Field count1(org.jooq.Field __1) { + org.jooq.util.postgres.pg_catalog.routines.Count1 f = new org.jooq.util.postgres.pg_catalog.routines.Count1(); + f.set__1(__1); + + return f.asField(); + } + /** * Call pg_catalog.format_type * @@ -56,6 +116,24 @@ public final class Routines { return f.asField(); } + /** + * Call pg_catalog.pg_cursor + * + * @param name OUT parameter + * @param statement OUT parameter + * @param isHoldable OUT parameter + * @param isBinary OUT parameter + * @param isScrollable OUT parameter + * @param creationTime OUT parameter + * @throws org.jooq.exception.DataAccessException if something went wrong executing the query + */ + public static org.jooq.util.postgres.pg_catalog.routines.PgCursor pgCursor(org.jooq.Configuration configuration) { + org.jooq.util.postgres.pg_catalog.routines.PgCursor p = new org.jooq.util.postgres.pg_catalog.routines.PgCursor(); + + p.execute(configuration); + return p; + } + /** * No instances */ diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/Tables.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/Tables.java index d25f0e2d49..e0ae576105 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/Tables.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/Tables.java @@ -8,7 +8,7 @@ package org.jooq.util.postgres.pg_catalog; * * Convenience access to all tables in pg_catalog */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public final class Tables { diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/Count1.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/Count1.java new file mode 100644 index 0000000000..f490a9fdd1 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/Count1.java @@ -0,0 +1,55 @@ +/** + * 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", "2.4.0"}, + comments = "This class is generated by jOOQ") +public class Count1 extends org.jooq.impl.AbstractRoutine { + + private static final long serialVersionUID = 1018949472; + + + /** + * An uncommented item + */ + public static final org.jooq.Parameter RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.BIGINT); + + /** + * An uncommented item + * + * The SQL type of this item ("any", any) could not be mapped.
+ * Deserialising this field might not work! + */ + public static final org.jooq.Parameter _1 = createParameter("_1", org.jooq.impl.SQLDataType.OTHER); + + /** + * Create a new routine call instance + */ + public Count1() { + super("count", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.impl.SQLDataType.BIGINT); + + setReturnParameter(RETURN_VALUE); + addInParameter(_1); + setOverloaded(true); + } + + /** + * Set the _1 parameter to the routine + */ + public void set__1(java.lang.Object value) { + setValue(_1, value); + } + + /** + * Set the _1 parameter to the function + *

+ * Use this method only, if the function is called as a {@link org.jooq.Field} in a {@link org.jooq.Select} statement! + */ + public void set__1(org.jooq.Field field) { + setField(_1, field); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/Count2.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/Count2.java new file mode 100644 index 0000000000..065f648dd3 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/Count2.java @@ -0,0 +1,30 @@ +/** + * 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", "2.4.0"}, + comments = "This class is generated by jOOQ") +public class Count2 extends org.jooq.impl.AbstractRoutine { + + private static final long serialVersionUID = -101223220; + + + /** + * An uncommented item + */ + public static final org.jooq.Parameter RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.BIGINT); + + /** + * Create a new routine call instance + */ + public Count2() { + super("count", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.impl.SQLDataType.BIGINT); + + setReturnParameter(RETURN_VALUE); + setOverloaded(true); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/FormatType.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/FormatType.java index 41c0bd46a9..0946dc3c74 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/FormatType.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/FormatType.java @@ -6,11 +6,11 @@ package org.jooq.util.postgres.pg_catalog.routines; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class FormatType extends org.jooq.impl.AbstractRoutine { - private static final long serialVersionUID = -1197259008; + private static final long serialVersionUID = 428047358; /** 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 new file mode 100644 index 0000000000..568f3059a6 --- /dev/null +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/routines/PgCursor.java @@ -0,0 +1,83 @@ +/** + * 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", "2.4.0"}, + comments = "This class is generated by jOOQ") +public class PgCursor extends org.jooq.impl.AbstractRoutine { + + private static final long serialVersionUID = 1046377097; + + + /** + * An uncommented item + */ + public static final org.jooq.Parameter NAME = createParameter("name", org.jooq.impl.SQLDataType.CLOB); + + /** + * An uncommented item + */ + public static final org.jooq.Parameter STATEMENT = createParameter("statement", org.jooq.impl.SQLDataType.CLOB); + + /** + * An uncommented item + */ + public static final org.jooq.Parameter IS_HOLDABLE = createParameter("is_holdable", org.jooq.impl.SQLDataType.BOOLEAN); + + /** + * An uncommented item + */ + public static final org.jooq.Parameter IS_BINARY = createParameter("is_binary", org.jooq.impl.SQLDataType.BOOLEAN); + + /** + * An uncommented item + */ + public static final org.jooq.Parameter IS_SCROLLABLE = createParameter("is_scrollable", org.jooq.impl.SQLDataType.BOOLEAN); + + /** + * An uncommented item + */ + 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); + } + + public java.lang.String getName_() { + return getValue(NAME); + } + + public java.lang.String getStatement() { + return getValue(STATEMENT); + } + + public java.lang.Boolean getIsHoldable() { + return getValue(IS_HOLDABLE); + } + + public java.lang.Boolean getIsBinary() { + return getValue(IS_BINARY); + } + + public java.lang.Boolean getIsScrollable() { + return getValue(IS_SCROLLABLE); + } + + public java.sql.Timestamp getCreationTime() { + return getValue(CREATION_TIME); + } +} diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgAttribute.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgAttribute.java index 9e7a5bbd10..80c18eb208 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgAttribute.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgAttribute.java @@ -6,28 +6,23 @@ package org.jooq.util.postgres.pg_catalog.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class PgAttribute extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = 2062334520; + private static final long serialVersionUID = 1961406872; /** * The singleton instance of pg_catalog.pg_attribute */ public static final org.jooq.util.postgres.pg_catalog.tables.PgAttribute PG_ATTRIBUTE = new org.jooq.util.postgres.pg_catalog.tables.PgAttribute(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** @@ -125,17 +120,11 @@ public class PgAttribute extends org.jooq.impl.TableImpl { */ public final org.jooq.TableField ATTOPTIONS = createField("attoptions", org.jooq.impl.SQLDataType.CLOB.getArrayDataType(), this); - /** - * No further instances allowed - */ - private PgAttribute() { + public PgAttribute() { super("pg_attribute", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG); } - /** - * No further instances allowed - */ - private PgAttribute(java.lang.String alias) { + public PgAttribute(java.lang.String alias) { super(alias, org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.util.postgres.pg_catalog.tables.PgAttribute.PG_ATTRIBUTE); } diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgClass.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgClass.java index c8167d9f2e..c3a9d66b62 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgClass.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgClass.java @@ -6,28 +6,23 @@ package org.jooq.util.postgres.pg_catalog.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class PgClass extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = 497846309; + private static final long serialVersionUID = -2038078835; /** * The singleton instance of pg_catalog.pg_class */ public static final org.jooq.util.postgres.pg_catalog.tables.PgClass PG_CLASS = new org.jooq.util.postgres.pg_catalog.tables.PgClass(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** @@ -165,17 +160,11 @@ public class PgClass extends org.jooq.impl.TableImpl { */ public final org.jooq.TableField RELOPTIONS = createField("reloptions", org.jooq.impl.SQLDataType.CLOB.getArrayDataType(), this); - /** - * No further instances allowed - */ - private PgClass() { + public PgClass() { super("pg_class", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG); } - /** - * No further instances allowed - */ - private PgClass(java.lang.String alias) { + public PgClass(java.lang.String alias) { super(alias, org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.util.postgres.pg_catalog.tables.PgClass.PG_CLASS); } diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgEnum.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgEnum.java index 4481799e0b..3ca36a196f 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgEnum.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgEnum.java @@ -6,28 +6,23 @@ package org.jooq.util.postgres.pg_catalog.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class PgEnum extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = 1198881091; + private static final long serialVersionUID = -741676635; /** * The singleton instance of pg_catalog.pg_enum */ public static final org.jooq.util.postgres.pg_catalog.tables.PgEnum PG_ENUM = new org.jooq.util.postgres.pg_catalog.tables.PgEnum(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** @@ -40,17 +35,11 @@ public class PgEnum extends org.jooq.impl.TableImpl { */ public final org.jooq.TableField ENUMLABEL = createField("enumlabel", org.jooq.impl.SQLDataType.VARCHAR, this); - /** - * No further instances allowed - */ - private PgEnum() { + public PgEnum() { super("pg_enum", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG); } - /** - * No further instances allowed - */ - private PgEnum(java.lang.String alias) { + public PgEnum(java.lang.String alias) { super(alias, org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.util.postgres.pg_catalog.tables.PgEnum.PG_ENUM); } diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgNamespace.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgNamespace.java index 62ea7dea18..e7f3be7b66 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgNamespace.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgNamespace.java @@ -6,28 +6,23 @@ package org.jooq.util.postgres.pg_catalog.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class PgNamespace extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = -1774545004; + private static final long serialVersionUID = 2129977430; /** * The singleton instance of pg_catalog.pg_namespace */ public static final org.jooq.util.postgres.pg_catalog.tables.PgNamespace PG_NAMESPACE = new org.jooq.util.postgres.pg_catalog.tables.PgNamespace(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** @@ -45,17 +40,11 @@ public class PgNamespace extends org.jooq.impl.TableImpl { */ public final org.jooq.TableField NSPACL = createField("nspacl", org.jooq.impl.SQLDataType.VARCHAR.getArrayDataType(), this); - /** - * No further instances allowed - */ - private PgNamespace() { + public PgNamespace() { super("pg_namespace", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG); } - /** - * No further instances allowed - */ - private PgNamespace(java.lang.String alias) { + public PgNamespace(java.lang.String alias) { super(alias, org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.util.postgres.pg_catalog.tables.PgNamespace.PG_NAMESPACE); } diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgProc.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgProc.java index b84a6728e5..1189871cf1 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgProc.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgProc.java @@ -6,28 +6,23 @@ package org.jooq.util.postgres.pg_catalog.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class PgProc extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = 1574331687; + private static final long serialVersionUID = 1760477283; /** * The singleton instance of pg_catalog.pg_proc */ public static final org.jooq.util.postgres.pg_catalog.tables.PgProc PG_PROC = new org.jooq.util.postgres.pg_catalog.tables.PgProc(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** @@ -155,17 +150,11 @@ public class PgProc extends org.jooq.impl.TableImpl { */ public final org.jooq.TableField PROACL = createField("proacl", org.jooq.impl.SQLDataType.VARCHAR.getArrayDataType(), this); - /** - * No further instances allowed - */ - private PgProc() { + public PgProc() { super("pg_proc", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG); } - /** - * No further instances allowed - */ - private PgProc(java.lang.String alias) { + public PgProc(java.lang.String alias) { super(alias, org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.util.postgres.pg_catalog.tables.PgProc.PG_PROC); } diff --git a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgType.java b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgType.java index e164cc2b67..eaef6873b1 100644 --- a/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgType.java +++ b/jOOQ-meta/src/main/java/org/jooq/util/postgres/pg_catalog/tables/PgType.java @@ -6,28 +6,23 @@ package org.jooq.util.postgres.pg_catalog.tables; /** * This class is generated by jOOQ. */ -@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.6"}, +@javax.annotation.Generated(value = {"http://www.jooq.org", "2.4.0"}, comments = "This class is generated by jOOQ") public class PgType extends org.jooq.impl.TableImpl { - private static final long serialVersionUID = 867629277; + private static final long serialVersionUID = -1252060599; /** * The singleton instance of pg_catalog.pg_type */ public static final org.jooq.util.postgres.pg_catalog.tables.PgType PG_TYPE = new org.jooq.util.postgres.pg_catalog.tables.PgType(); - /** - * The class holding records for this type - */ - private static final java.lang.Class __RECORD_TYPE = org.jooq.Record.class; - /** * The class holding records for this type */ @Override public java.lang.Class getRecordType() { - return __RECORD_TYPE; + return org.jooq.Record.class; } /** @@ -170,17 +165,11 @@ public class PgType extends org.jooq.impl.TableImpl { */ public final org.jooq.TableField TYPDEFAULT = createField("typdefault", org.jooq.impl.SQLDataType.CLOB, this); - /** - * No further instances allowed - */ - private PgType() { + public PgType() { super("pg_type", org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG); } - /** - * No further instances allowed - */ - private PgType(java.lang.String alias) { + public PgType(java.lang.String alias) { super(alias, org.jooq.util.postgres.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.util.postgres.pg_catalog.tables.PgType.PG_TYPE); } diff --git a/jOOQ-release/build.xml b/jOOQ-release/build.xml index da9b7409d9..2bc6d36cbd 100644 --- a/jOOQ-release/build.xml +++ b/jOOQ-release/build.xml @@ -3,7 +3,7 @@ - + diff --git a/jOOQ-release/release/template/RELEASENOTES.txt b/jOOQ-release/release/template/RELEASENOTES.txt index 94ae18ae0a..0ae18a0785 100644 --- a/jOOQ-release/release/template/RELEASENOTES.txt +++ b/jOOQ-release/release/template/RELEASENOTES.txt @@ -10,6 +10,26 @@ http://www.jooq.org/notes.php For a text version, see http://www.jooq.org/inc/RELEASENOTES.txt +Version 2.3.1 - May 11, 2012 +================================================================= +This is an important patch release fixing some regressions in the +code generator for the Postgres dialect. With 2.3.0, it was no +longer possible to generate schemata of which the database user +was not the owner. + +Bug fixes +--------- +#1334 - Fix inaccurate simulation of TRUNC(number, decimals) for + Derby +#1403 - Documentation bug: ctx.statement() can be replaced in + executeStart(). This is not documented +#1406 - Compilation errors in generated source code when Postgres + stored procedure parameter is called "NAME" +#1407 - Compilation errors in generated source code when Postgres + data-type is "any" (with quotes!) +#1409 - Postgres code generation broken when not connecting with + the owner of a schema + Version 2.3.0 - May 6, 2012 ================================================================= diff --git a/jOOQ-test/configuration/org/jooq/configuration/lukas/postgres/pg_catalog.properties b/jOOQ-test/configuration/org/jooq/configuration/lukas/postgres/pg_catalog.properties index fc2412ba05..09918fc39d 100644 --- a/jOOQ-test/configuration/org/jooq/configuration/lukas/postgres/pg_catalog.properties +++ b/jOOQ-test/configuration/org/jooq/configuration/lukas/postgres/pg_catalog.properties @@ -7,7 +7,7 @@ jdbc.Password=test generator=org.jooq.util.DefaultGenerator generator.database=org.jooq.util.postgres.PostgresDatabase -generator.database.includes=pg_namespace,pg_enum,pg_type,pg_class,pg_attribute,pg_proc,format_type +generator.database.includes=pg_namespace,pg_enum,pg_type,pg_class,pg_attribute,pg_proc,format_type,count,pg_cursor generator.database.excludes= generator.generate.deprecated=false generator.generate.instance-fields=true diff --git a/jOOQ-test/src/org/jooq/test/_/testcases/FunctionTests.java b/jOOQ-test/src/org/jooq/test/_/testcases/FunctionTests.java index f235f1eb37..1b6ddab0fe 100644 --- a/jOOQ-test/src/org/jooq/test/_/testcases/FunctionTests.java +++ b/jOOQ-test/src/org/jooq/test/_/testcases/FunctionTests.java @@ -603,6 +603,15 @@ extends BaseTest f3d = floor(-2.0); Field f4d = ceil(-2.0); + Field f1e = round(0.0f); + Field f2e = round(0.0f, 2); + Field f3e = floor(0.0f); + Field f4e = ceil(0.0f); + Field f1f = round(0.0f); + Field f2f = round(0.0f, 2); + Field f3f = floor(0.0f); + Field f4f = ceil(0.0f); + // Some arbitrary checks on having multiple select clauses Record record = create().select(f1a) @@ -611,7 +620,10 @@ extends BaseTest diff --git a/jOOQ-website/inc/RELEASENOTES-2.3.txt b/jOOQ-website/inc/RELEASENOTES-2.3.txt index 94ae18ae0a..0ae18a0785 100644 --- a/jOOQ-website/inc/RELEASENOTES-2.3.txt +++ b/jOOQ-website/inc/RELEASENOTES-2.3.txt @@ -10,6 +10,26 @@ http://www.jooq.org/notes.php For a text version, see http://www.jooq.org/inc/RELEASENOTES.txt +Version 2.3.1 - May 11, 2012 +================================================================= +This is an important patch release fixing some regressions in the +code generator for the Postgres dialect. With 2.3.0, it was no +longer possible to generate schemata of which the database user +was not the owner. + +Bug fixes +--------- +#1334 - Fix inaccurate simulation of TRUNC(number, decimals) for + Derby +#1403 - Documentation bug: ctx.statement() can be replaced in + executeStart(). This is not documented +#1406 - Compilation errors in generated source code when Postgres + stored procedure parameter is called "NAME" +#1407 - Compilation errors in generated source code when Postgres + data-type is "any" (with quotes!) +#1409 - Postgres code generation broken when not connecting with + the owner of a schema + Version 2.3.0 - May 6, 2012 ================================================================= diff --git a/jOOQ-website/inc/RELEASENOTES.txt b/jOOQ-website/inc/RELEASENOTES.txt index 94ae18ae0a..0ae18a0785 100644 --- a/jOOQ-website/inc/RELEASENOTES.txt +++ b/jOOQ-website/inc/RELEASENOTES.txt @@ -10,6 +10,26 @@ http://www.jooq.org/notes.php For a text version, see http://www.jooq.org/inc/RELEASENOTES.txt +Version 2.3.1 - May 11, 2012 +================================================================= +This is an important patch release fixing some regressions in the +code generator for the Postgres dialect. With 2.3.0, it was no +longer possible to generate schemata of which the database user +was not the owner. + +Bug fixes +--------- +#1334 - Fix inaccurate simulation of TRUNC(number, decimals) for + Derby +#1403 - Documentation bug: ctx.statement() can be replaced in + executeStart(). This is not documented +#1406 - Compilation errors in generated source code when Postgres + stored procedure parameter is called "NAME" +#1407 - Compilation errors in generated source code when Postgres + data-type is "any" (with quotes!) +#1409 - Postgres code generation broken when not connecting with + the owner of a schema + Version 2.3.0 - May 6, 2012 ================================================================= diff --git a/jOOQ/pom.xml b/jOOQ/pom.xml index f0120a22cd..f3b237c712 100644 --- a/jOOQ/pom.xml +++ b/jOOQ/pom.xml @@ -10,7 +10,7 @@ org.jooq jooq - 2.3.0 + 2.4.0-SNAPSHOT jar jOOQ diff --git a/jOOQ/src/main/java/org/jooq/Constants.java b/jOOQ/src/main/java/org/jooq/Constants.java index d254ecbd5c..c878740e77 100644 --- a/jOOQ/src/main/java/org/jooq/Constants.java +++ b/jOOQ/src/main/java/org/jooq/Constants.java @@ -45,7 +45,7 @@ public final class Constants { /** * The latest jOOQ version */ - public static final String VERSION = "2.3.0"; + public static final String VERSION = "2.4.0"; /** * No further instances diff --git a/jOOQ/src/main/java/org/jooq/ExecuteListener.java b/jOOQ/src/main/java/org/jooq/ExecuteListener.java index d4a0099482..ee0ad5a49d 100644 --- a/jOOQ/src/main/java/org/jooq/ExecuteListener.java +++ b/jOOQ/src/main/java/org/jooq/ExecuteListener.java @@ -460,6 +460,15 @@ public interface ExecuteListener { * * *

+ * Overridable attributes in ExecuteContext: + *

    + *
  • {@link ExecuteContext#statement(PreparedStatement)}: The + * Statement, PreparedStatement, or + * CallableStatement that is about to be executed. You can + * modify this statement freely, or wrap {@link ExecuteContext#statement()} + * with your enriched statement wrapper
  • + *
+ *

* Note that this method is not called when executing queries of type * {@link StatementType#STATIC_STATEMENT} */ @@ -497,6 +506,15 @@ public interface ExecuteListener { * * * + *

+ * Overridable attributes in ExecuteContext: + *

    + *
  • {@link ExecuteContext#statement(PreparedStatement)}: The + * Statement, PreparedStatement, or + * CallableStatement that is about to be executed. You can + * modify this statement freely, or wrap {@link ExecuteContext#statement()} + * with your enriched statement wrapper
  • + *
*/ void executeStart(ExecuteContext ctx); diff --git a/jOOQ/src/main/java/org/jooq/FactoryOperations.java b/jOOQ/src/main/java/org/jooq/FactoryOperations.java index 157647545c..60f5ddf47b 100644 --- a/jOOQ/src/main/java/org/jooq/FactoryOperations.java +++ b/jOOQ/src/main/java/org/jooq/FactoryOperations.java @@ -688,7 +688,7 @@ public interface FactoryOperations extends Configuration { * is omitted for future extensibility of this command. */ @Support - > Truncate truncate(Table table); + Truncate truncate(Table table); // ------------------------------------------------------------------------- // XXX Other queries for identities and sequences diff --git a/jOOQ/src/main/java/org/jooq/Truncate.java b/jOOQ/src/main/java/org/jooq/Truncate.java index ab8c7bc228..458e178786 100644 --- a/jOOQ/src/main/java/org/jooq/Truncate.java +++ b/jOOQ/src/main/java/org/jooq/Truncate.java @@ -40,6 +40,6 @@ package org.jooq; * * @author Lukas Eder */ -public interface Truncate> extends Query { +public interface Truncate extends Query { } diff --git a/jOOQ/src/main/java/org/jooq/impl/Factory.java b/jOOQ/src/main/java/org/jooq/impl/Factory.java index b5781b42e1..1d01d3168d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Factory.java +++ b/jOOQ/src/main/java/org/jooq/impl/Factory.java @@ -1489,7 +1489,7 @@ public class Factory implements FactoryOperations { * {@inheritDoc} */ @Override - public final > Truncate truncate(Table table) { + public final Truncate truncate(Table table) { return new TruncateImpl(this, table); } diff --git a/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java b/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java index 7e8ecb1a72..27947c024b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java +++ b/jOOQ/src/main/java/org/jooq/impl/FactoryProxy.java @@ -344,7 +344,7 @@ public final class FactoryProxy implements FactoryOperations { } @Override - public final > Truncate truncate(Table table) { + public final Truncate truncate(Table table) { return getDelegate().truncate(table); } diff --git a/jOOQ/src/main/java/org/jooq/impl/Trunc.java b/jOOQ/src/main/java/org/jooq/impl/Trunc.java index 297c79a4a3..3aa4e81b3f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Trunc.java +++ b/jOOQ/src/main/java/org/jooq/impl/Trunc.java @@ -35,12 +35,15 @@ */ package org.jooq.impl; +import static java.math.BigDecimal.TEN; import static org.jooq.impl.Factory.field; import static org.jooq.impl.Factory.inline; import static org.jooq.impl.Factory.one; import static org.jooq.impl.Factory.zero; +import static org.jooq.impl.Util.extractVal; import java.math.BigDecimal; +import java.math.MathContext; import org.jooq.Configuration; import org.jooq.Field; @@ -82,10 +85,18 @@ class Trunc extends AbstractFunction { private final Field getNumericFunction(Configuration configuration) { switch (configuration.getDialect()) { case ASE: - - // This calculation is inaccurate for Derby case DERBY: { - Field power = Factory.power(inline(new BigDecimal("10.0")), decimals); + Field power; + + // [#1334] if possible, calculate the power in Java to prevent + // inaccurate arithmetics in the Derby database + Integer decimalsVal = extractVal(decimals); + if (decimalsVal != null) { + power = inline(TEN.pow(decimalsVal, MathContext.DECIMAL128)); + } + else { + power = Factory.power(inline(TEN), decimals); + } return Factory.decode() .when(field.sign().greaterOrEqual(zero()), diff --git a/jOOQ/src/main/java/org/jooq/impl/TruncateImpl.java b/jOOQ/src/main/java/org/jooq/impl/TruncateImpl.java index a4c881247e..fd1c283653 100644 --- a/jOOQ/src/main/java/org/jooq/impl/TruncateImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/TruncateImpl.java @@ -40,16 +40,16 @@ import java.util.List; import org.jooq.Attachable; import org.jooq.BindContext; import org.jooq.Configuration; +import org.jooq.Record; import org.jooq.RenderContext; import org.jooq.SQLDialect; import org.jooq.Table; -import org.jooq.TableRecord; import org.jooq.Truncate; /** * @author Lukas Eder */ -class TruncateImpl> extends AbstractQuery implements Truncate { +class TruncateImpl extends AbstractQuery implements Truncate { /** * Generated UID diff --git a/jOOQ/src/main/java/org/jooq/impl/Util.java b/jOOQ/src/main/java/org/jooq/impl/Util.java index 745d2763d3..d8bec3cda1 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Util.java +++ b/jOOQ/src/main/java/org/jooq/impl/Util.java @@ -1028,4 +1028,23 @@ final class Util { return field.cast(String.class); } } + + /** + * Utility method to check whether a field is a {@link Param} + */ + static final boolean isVal(Field field) { + return field instanceof Param; + } + + /** + * Utility method to extract a value from a field + */ + static final T extractVal(Field field) { + if (isVal(field)) { + return ((Param) field).getValue(); + } + else { + return null; + } + } } \ No newline at end of file diff --git a/jOOQ/src/main/java/org/jooq/util/postgres/PostgresDataType.java b/jOOQ/src/main/java/org/jooq/util/postgres/PostgresDataType.java index c9b8bb5b4b..5cfbc1cc05 100644 --- a/jOOQ/src/main/java/org/jooq/util/postgres/PostgresDataType.java +++ b/jOOQ/src/main/java/org/jooq/util/postgres/PostgresDataType.java @@ -136,6 +136,7 @@ public class PostgresDataType extends AbstractDataType { public static final PostgresDataType TIMESTAMPWITHTIMEZONE = new PostgresDataType(SQLDataType.TIMESTAMP, "timestamp with time zone"); public static final PostgresDataType TIMESTAMPTZ = new PostgresDataType(SQLDataType.TIMESTAMP, "timestamptz"); public static final PostgresDataType> REFCURSOR = new PostgresDataType>(SQLDataType.RESULT, "refcursor"); + public static final PostgresDataType ANY = new PostgresDataType(SQLDataType.OTHER, "any"); // Meta-table types public static final PostgresDataType OID = new PostgresDataType(SQLDataType.BIGINT, "oid");