Hi > Sometimes the field in a table can be represented by different types. For > example, MySQL BINARY, CHAR and VARCHAR types can be represented by string > or by byte array. TINYINT field sometimes can represent boolean type > (TINYINT(1) usually). Can we have some control over such type mapping?
In the beginning of jOOQ, I had considered adding such type mappings. Especially with Oracle, or other RDBMS that do not have a boolean data type, this might be very useful. On the other hand, most RDBMS do have BOOLEAN types, so I don't see why any of TINYINT(1), INT(1), CHAR(1), etc should be used instead. For compatibility reasons with Oracle? An automatic type mapping should not be implemented, but I think I could add some configuration parameters where users can pass a type mapping adapted to their needs. Most intuitively, there should be a way to map an arbitrary comma-separated list of columns/procedure parameters/UDT attributes/ARRAY elements to data-types in SQLDataType/MySQLDataType. E.g. generator.mapping.types.BOOLEAN=^schemaName\.\w+\.visible$,^schemaName\.\w+\.\w+ed$ generator.mapping.types.BINARY=data The above will map "visible" columns from all tables to BOOLEAN, as well as columns ending in "ed", which is a typical suffix for boolean types (visited, locked, closed, deleted, etc). Also all columns (or procedure parameters) that contain "data" will be mapped to BINARY. That would provide quite some flexibility to the user. What do you think? Are there other use cases I might have missed? Note, that both org.jooq.Record and org.jooq.Result provide means for converting any data to BOOLEAN: http://jooq.sourceforge.net/javadoc/latest/org/jooq/Record.html#getValueAsBoolean%28org.jooq.Field%29 I filed this as https://sourceforge.net/apps/trac/jooq/ticket/677 Cheers Lukas
