db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: Sybase case insensitive column names
Date Mon, 17 Jul 2006 19:27:10 GMT

Just a couple of quick comments.  According to a quick read 
of the SQL 99 standard, column names are supposed to be case 
insensitive unless they are delimited.  Sybase is doing 
non-standard things here (or my interpretation could be 
wrong  8) ) 

Also, changing the way Torque has generated column names since
day one could possibly break (badly written) application code
if someone has hardcoded this expected behaviour into it.

Should this be an optional generation flag?

> -----Original Message-----
> From: Thoralf Rickert [mailto:thoralf.rickert@cadooz.de] 
> Sent: Monday, July 17, 2006 4:45 AM
> To: Apache Torque Users List
> Subject: AW: Sybase case insensitive column names
> 
> Okay, I'll submit a bug report.
> 
> > -----Urspr√ľngliche Nachricht-----
> > Von: Thomas Fischer [mailto:fischer@seitenbau.net]
> > Gesendet: Montag, 17. Juli 2006 10:04
> > An: Apache Torque Users List
> > Betreff: AW: Sybase case insensitive column names
> > 
> > 
> > The column names in the class files should be generated in the same 
> > case as they appear in the schema file. If this is not the 
> case, this 
> > is a bug. This is Torque 3.2 and you did not change 
> anything there, I 
> > assume ? If yes, would you mind to submit a bug report to Jira ?
> > 
> >    Thomas
> > 
> > "Thoralf Rickert" <thoralf.rickert@cadooz.de> schrieb am 17.07.2006
> > 09:19:17:
> > 
> > > That is correct. The JDBC task doesn't change the names. 
> But if you 
> > > create the classes (om) it creates the column names with 
> uppercase 
> > > letters and than there is the problem because you cannot make any 
> > > queries. Here is an example:
> > >
> > > Generated XML file (correct):
> > >
> > >     <table name="address">
> > >         <column name="class" javaName="aClass" primaryKey="true" 
> > > required="true" size="2" type="CHAR"/>
> > >         <column name="id" primaryKey="true" required="true" 
> > size="30" 
> > > type="VARCHAR"/>
> > >         <column name="position" primaryKey="true" required="true" 
> > > type="INTEGER"/>
> > >         <column name="name1" size="50" type="VARCHAR"/>
> > >         <column name="name2" size="50" type="VARCHAR"/>
> > >         <column name="name3" size="50" type="VARCHAR"/>
> > >         <column name="street" size="50" type="VARCHAR"/>
> > >         <column name="zipcode" size="25" type="VARCHAR"/>
> > >         <column name="city" size="60" type="VARCHAR"/>
> > >         <column name="phone" size="40" type="VARCHAR"/>
> > >         <column name="phone2" size="40" type="VARCHAR"/>
> > >         <column name="country" size="200" type="VARCHAR"/>
> > >         <column name="state" size="200" type="VARCHAR"/>
> > >         <column name="fax" size="40" type="VARCHAR"/>
> > >         <column name="email" size="150" type="VARCHAR"/>
> > >     </table>
> > >
> > > Generated constants in the BaseAddressPeer (incorrect):
> > >
> > >     static
> > >     {
> > >           CLASS = "address.CLASS";
> > >           ID = "address.ID";
> > >           POSITION = "address.POSITION";
> > >           NAME1 = "address.NAME1";
> > >           NAME2 = "address.NAME2";
> > >           NAME3 = "address.NAME3";
> > >           STREET = "address.STREET";
> > >           ZIPCODE = "address.ZIPCODE";
> > >           CITY = "address.CITY";
> > >           PHONE = "address.PHONE";
> > >           PHONE2 = "address.PHONE2";
> > >           COUNTRY = "address.COUNTRY";
> > >           STATE = "address.STATE";
> > >           FAX = "address.FAX";
> > >           EMAIL = "address.EMAIL";
> > >     ....
> > >
> > >
> > > I think the uppercase column names or uppercase because
> > it's better to
> > > read (?). There is no bug in the Sybase JDBC driver (5.5 
> and 6. 0). 
> > > I've tested a generated SQL statement on the sybase console
> > > (isql) and it fails if the case is not correct, for example:
> > >
> > > SELECT .... FROM address WHERE address.CITY="Hamburg"
> > >
> > > failes, but with address.city="..." everything is okay. I
> > think this
> > > case sensitive behaviour is a Sybase-"feature"... Maybe I
> > should ask
> > > someone on a Sybase JDBC mailinglist howto disable this behaviour.
> > >
> > > Bye
> > > Thoralf
> > >
> > >
> > > > -----Urspr√ľngliche Nachricht-----
> > > > Von: Thomas Fischer [mailto:tfischer@apache.org]
> > > > Gesendet: Samstag, 15. Juli 2006 09:10
> > > > An: Apache Torque Users List
> > > > Betreff: Re: Sybase case insensitive column names
> > > >
> > > >
> > > > Hi,
> > > >
> > > > This is strange; the jdbc task should preserve the case
> > of the table
> > > > and column names (I checked that using mysql; as I do 
> not have a 
> > > > sybase database). The jdbc task uses the 
> DatabaseMetaData from the 
> > > > jdbc driver to get the database; if the database is 
> case sensitive 
> > > > and the DatabaseMetaData does not preserve case it is a 
> bug of the 
> > > > jdbc driver.
> > > >
> > > >      Thomas
> > > >
> > > > On Thu, 13 Jul 2006, Thoralf Rickert wrote:
> > > >
> > > > > Hi!
> > > > >
> > > > > I've created a schema.xml for an existing Sybase 
> database and I 
> > > > > was able to generate the corresponding java classes. If
> > I try to
> > > > > make a query with them I run into a problem. The database uses
> > > > case sensitive
> > > > > column names but torque generates uppercase column names.
> > > > For example
> > > > > the following query throws an exception, because the column 
> > > > > "STATE" cannot be found (in the database it's called "state").
> > > > >
> > > > >  SELECT states.STATE FROM states ORDER BY states.STATE ASC
> > > > >
> > > > > Is there a way to handle this? Is there a sybase specific
> > > > connection
> > > > > setting or something like that?
> > > > >
> > > > > Thanks
> > > > > Thoralf
> > > > >
> > > > >
> > > > >
> > > > 
> > --------------------------------------------------------------------
> > > > -
> > > > > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > > > > For additional commands, e-mail: 
> torque-user-help@db.apache.org
> > > > >
> > > > >
> > > >
> > > > 
> > --------------------------------------------------------------------
> > > > -
> > > > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > > > For additional commands, e-mail: torque-user-help@db.apache.org
> > > >
> > > >
> > >
> > >
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > > For additional commands, e-mail: torque-user-help@db.apache.org
> > >
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



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


Mime
View raw message