db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: Customisation of jdbc->sql type mapping
Date Mon, 07 Aug 2006 23:44:13 GMT
On 8/5/06, Thomas Fischer <tfischer@apache.org> wrote:

> Is there any support planned for customisation the mapping from jdbc types
> to sql types ? For example, users might want to use nvarchar2 instead of
> varchar for some reason.

yep, that is one of the core features planned for the 1.1 release.
Basically, there are planned to be three levels of customization:

- for the Ant task invocation, so that the mapping applies to all
schema files handled by this task run

- for a schema file

- for a specific column

the general idea is to have declarative (XML) and programmatic control
to e.g. map every occurrence of VARCHAR (JDBC type) to NVARCHAR2
(Oracle type) regardless of length, or also for specific lengths.

> In torque, users could do this using the db.props file for the different
> databases up to Torque 3.1.1. In Torque 3.2, the db.props file is gone and
> it is quite difficult for users to define their own mappings. This needs
> to be changed in Torque. However, it would make sense to do this in a
> manner that ddlutils might support in the future.
> My current plan for Torque is to use the "domain" attribute in the torque
> schema file. A domain (I'm not finding this name intuitive, maybe there's
> a better one) is a kind of "custom column type" the user can define. For
> example, the user can define a type "SHORTVARCHAR" which corresponds to a
> varchar column with size 20. The user then can use the type "shortvarchar"
> as column type in the schema, and does not need to specify the size of 20
> everywhere.

hmm, this is somewhat different to the above as it basically means
that a filter is applied between reading the schema from XML and
applying the model (e.g. writing it to the DB).
This can surely be done but might perhaps make more sense in a Torque
derived XML schema ? I'm not too sure yet, but since it would not be
difficult to implement, we can just as well have it in DdlUtils.
This would however be different from support DOMAINs in the database
as these apply to the native type instead.


View raw message