db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Benoist (JIRA)" <j...@apache.org>
Subject [jira] Created: (TORQUE-105) Column specification assumes NULL as implicit choice
Date Thu, 18 Oct 2007 14:19:50 GMT
Column specification assumes NULL as implicit choice

                 Key: TORQUE-105
                 URL: https://issues.apache.org/jira/browse/TORQUE-105
             Project: Torque
          Issue Type: Bug
          Components: Generator
    Affects Versions: 3.3-RC2
         Environment: Maven2 plugin, Torque 3.3-RC2 ; tested with Sybase 15.0.2 DEV Edition
Windows - should affect all Sybase
            Reporter: Sylvain Benoist

When defining a column in a table with the Torque XML model, the assumption is that if the
'required' attribute is not present, or false, then the column is produced with no explicit
NULL/ NOT NULL text. This leaves the door open to database specific behaviors.

For example, Sybase... see http://manuals.sybase.com/onlinebooks/group-as/asg1250e/svrtsg/@Generic__BookTextView/15380.
It says that by default, Sybase assumes that a column without an explicit NULL or NOT NULL
will be translated into a  NOT NULL. 

This means that from the following XML snippet :

<table name="country" description="Country data">
   <column name="country_id" domain="dm_CountryId" required="true" primaryKey="true" />
   <column name="country_name" domain="dm_GenericName30" required="true" />
   <column name="iso_source" domain="dm_Boolean" required="true" />
   <column name="iso_threechar_code" type="CHAR" size="3" required="false" />
   <column name="iso_numeric_code" type="INTEGER" required="false"/>
   <column name="active" domain="dm_Boolean" required="true" />

I end up with the following DDL :

                country_id CHAR (2) NOT NULL,
                country_name VARCHAR (30) NOT NULL,
                iso_source CHAR (1) default 'Y' NOT NULL,
                iso_threechar_code CHAR (3),
                iso_numeric_code INT,
                active CHAR (1) default 'Y' NOT NULL,
    CONSTRAINT country_PK PRIMARY KEY(country_id)

And Sybase default this to have all columns as NOT NULL, which is not what I specified in
my XML.

To avoid being dependent on a database configuration option, it would be better to make things
completely explicit, so that
when the 'required' XML attribute is either absent or false, the generated DDL specifies 'NULL'
instead of an empty string.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message