[#1407] Compilation errors in generated source code when Postgres

data-type is "any" (with quotes!)
This commit is contained in:
Lukas Eder 2012-05-10 18:46:20 +02:00
parent aeb8765d1e
commit 74205afc53
15 changed files with 201 additions and 109 deletions

View File

@ -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("\")");
}
}

View File

@ -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.3.1-SNAPSHOT"},
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 = -371905234;
/**
* The singleton instance of pg_catalog

View File

@ -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.3.1-SNAPSHOT"},
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 = 1626557035;
/**
* 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.
* <p>
* 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());
}
}

View File

@ -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.3.1-SNAPSHOT"},
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<java.lang.Long> 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<java.lang.Long> 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<java.lang.Long> count1(org.jooq.Field<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();
}
/**
* Call pg_catalog.format_type
*

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public final class Tables {

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class Count1 extends org.jooq.impl.AbstractRoutine<java.lang.Long> {
private static final long serialVersionUID = -772102665;
/**
* An uncommented item
*/
public static final org.jooq.Parameter<java.lang.Long> 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.<br/>
* Deserialising this field might not work!
*/
public static final org.jooq.Parameter<java.lang.Object> _1 = createParameter("_1", org.jooq.util.postgres.PostgresDataType.getDefaultDataType("\"any\""));
/**
* 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 <code>_1</code> parameter to the routine
*/
public void set__1(java.lang.Object value) {
setValue(_1, value);
}
/**
* Set the <code>_1</code> parameter to the function
* <p>
* 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<java.lang.Object> field) {
setField(_1, field);
}
}

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class Count2 extends org.jooq.impl.AbstractRoutine<java.lang.Long> {
private static final long serialVersionUID = 1180633735;
/**
* An uncommented item
*/
public static final org.jooq.Parameter<java.lang.Long> 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);
}
}

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class FormatType extends org.jooq.impl.AbstractRoutine<java.lang.String> {
private static final long serialVersionUID = -1197259008;
private static final long serialVersionUID = -1785499997;
/**

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class PgAttribute extends org.jooq.impl.TableImpl<org.jooq.Record> {
private static final long serialVersionUID = 2062334520;
private static final long serialVersionUID = -519027695;
/**
* 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<org.jooq.Record> __RECORD_TYPE = org.jooq.Record.class;
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<org.jooq.Record> getRecordType() {
return __RECORD_TYPE;
return org.jooq.Record.class;
}
/**
@ -125,17 +120,11 @@ public class PgAttribute extends org.jooq.impl.TableImpl<org.jooq.Record> {
*/
public final org.jooq.TableField<org.jooq.Record, java.lang.String[]> 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);
}

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class PgClass extends org.jooq.impl.TableImpl<org.jooq.Record> {
private static final long serialVersionUID = 497846309;
private static final long serialVersionUID = -1753706892;
/**
* 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<org.jooq.Record> __RECORD_TYPE = org.jooq.Record.class;
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<org.jooq.Record> getRecordType() {
return __RECORD_TYPE;
return org.jooq.Record.class;
}
/**
@ -165,17 +160,11 @@ public class PgClass extends org.jooq.impl.TableImpl<org.jooq.Record> {
*/
public final org.jooq.TableField<org.jooq.Record, java.lang.String[]> 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);
}

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class PgEnum extends org.jooq.impl.TableImpl<org.jooq.Record> {
private static final long serialVersionUID = 1198881091;
private static final long serialVersionUID = 800254732;
/**
* 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<org.jooq.Record> __RECORD_TYPE = org.jooq.Record.class;
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<org.jooq.Record> getRecordType() {
return __RECORD_TYPE;
return org.jooq.Record.class;
}
/**
@ -40,17 +35,11 @@ public class PgEnum extends org.jooq.impl.TableImpl<org.jooq.Record> {
*/
public final org.jooq.TableField<org.jooq.Record, java.lang.String> 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);
}

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class PgNamespace extends org.jooq.impl.TableImpl<org.jooq.Record> {
private static final long serialVersionUID = -1774545004;
private static final long serialVersionUID = -1769943747;
/**
* 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<org.jooq.Record> __RECORD_TYPE = org.jooq.Record.class;
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<org.jooq.Record> getRecordType() {
return __RECORD_TYPE;
return org.jooq.Record.class;
}
/**
@ -45,17 +40,11 @@ public class PgNamespace extends org.jooq.impl.TableImpl<org.jooq.Record> {
*/
public final org.jooq.TableField<org.jooq.Record, java.lang.String[]> 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);
}

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class PgProc extends org.jooq.impl.TableImpl<org.jooq.Record> {
private static final long serialVersionUID = 1574331687;
private static final long serialVersionUID = 26734556;
/**
* 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<org.jooq.Record> __RECORD_TYPE = org.jooq.Record.class;
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<org.jooq.Record> getRecordType() {
return __RECORD_TYPE;
return org.jooq.Record.class;
}
/**
@ -155,17 +150,11 @@ public class PgProc extends org.jooq.impl.TableImpl<org.jooq.Record> {
*/
public final org.jooq.TableField<org.jooq.Record, java.lang.String[]> 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);
}

View File

@ -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.3.1-SNAPSHOT"},
comments = "This class is generated by jOOQ")
public class PgType extends org.jooq.impl.TableImpl<org.jooq.Record> {
private static final long serialVersionUID = 867629277;
private static final long serialVersionUID = 1130750896;
/**
* 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<org.jooq.Record> __RECORD_TYPE = org.jooq.Record.class;
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<org.jooq.Record> getRecordType() {
return __RECORD_TYPE;
return org.jooq.Record.class;
}
/**
@ -170,17 +165,11 @@ public class PgType extends org.jooq.impl.TableImpl<org.jooq.Record> {
*/
public final org.jooq.TableField<org.jooq.Record, java.lang.String> 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);
}

View File

@ -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
generator.database.excludes=
generator.generate.deprecated=false
generator.generate.instance-fields=true