I know one possibility is to fork and create new databases like MY_POSTGRES which is identical to POSTGRES except for the org.jooq.util.postgres.PostgresDataType class.
That's a bit annoying since we'll want to reuse the rest of the PostgreSQL-specific code. Could we just overwrite the entries in the DefaultDataType cache instead?
Again I know this is extremely advanced
--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/mVAv6TQfApg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
Yes, the forcedType should go a long way towards cleaning up our code. You should probably mention it in the javadoc for DataType, Binding, and Converter. :-)
What did you have in mind? The connection details and schema are provided by the user at runtime so our options are limited but we could set up an empty schema if necessary. Would that generate the standard classes with converters we specify or is it all hidden in schema-specific calls? Or were you thinking of setting a runtime flag?
DataType<MyType> type = SQLDataType.VARCHAR.asConvertedDataType(new MyTypeConverter());Field<MyType> field = field(name("my_table", "my_field"), type);
object class: java.sql.Date
--
private final Field<LocalDate> dateField = DSL.field(DSL.name("jooqtest", "dt"), dateType);
--
where the (mumble) involves the ResultSet -> Record tools, unless there's a more direct way to get this.
ctx.select(dt).from("(select dt from jooqtest) jooqtest").fetch();
I know I can't just use a map from sqltype to datatype since many databases define additional datatypes so we would have to check for null values and that's where we got into trouble before. Better to be a little verbose so it's clear that when we add support for new types we do it by adding a 'case' statement and a converter.
Now I'm wondering about the other side of this - I was thing that I could go through the Param list, do the same getSqlType() branch, etc., and that it would use the database metadata to determine the correct sqltype. Now I'm thinking that the information won't be available since we're using sql-based queries instead of queries built up like you did. I need to look more closely at how we're doing it now since I know we're able to throw data exceptions if someone is trying to convert a BigInteger into a SQL type that can't handle it.
ctx.fetch("select dt from jooqtest where dt = {0}", val(myType, dt.getDataType()));