You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Mikaël Cluseau <mc...@gmail.com> on 2007/12/11 22:34:00 UTC

[2.0-STABLE] 2 patches : db relationship pks, caseless datarows

Hello,

I was using to-one relationships as primary keys and found that it
wasn't working. I made it working, the right way, I hope ;-).

This patch modifies DataDomainInsertBucket.

The second is to fix a problem I had with DB2/AS400 using custom
templates to fetch DataObjects : the column names returned by the server
were in upper case, and Cayenne was expecting them in lower-case. My fix
is to normalize the keys in the DataRow, overriding get/put methods. I
think SQL is case insensitive for schema/table/column names, so it
shouldn't be a problem with any DBMS (again, I hope).

This patch modifies DataRow.

Cheers,

-- 
  .~.
  /V\      Mikaël Cluseau <mc...@isi.nc>
 // \\
/(   )\    ISI.NC             +687 26.93.18
 ^`~'^

Re: [2.0-STABLE] 2 patches : db relationship pks, caseless datarows

Posted by Mikaël Cluseau <mc...@gmail.com>.
Normalisation doesn't happen in the query but in the DataRow. More
precisely, using get("MyField") will still work (and will return the
same value as get("myfield")). My question was : should we allow
dbattributes which are "equalsIgnoreCase" ? (currently it works)

Of course, I don't mind maintaining this small patch by myself, I'm just
discussing the issue.

The DBAdaptor was my first guess but looked to complicated for the few
minutes I had... I think querying the DBAdaptor in the DataRow won't be
possible, so it will have to be handled somewhere else (DataContext?).

Le mardi 11 décembre 2007 à 17:19 -0500, Mike Kienenberger a écrit :
> It should probably query the DBAdaptor to determine if case matters.
> In fact, you should probably query the DBAdaptor to determine if you
> need to change the column name case at all.

-- 
  .~.
  /V\      Mikaël Cluseau <mc...@isi.nc>
 // \\
/(   )\    ISI.NC             +687 26.93.18
 ^`~'^


Re: [2.0-STABLE] 2 patches : db relationship pks, caseless datarows

Posted by Mike Kienenberger <mk...@gmail.com>.
It should probably query the DBAdaptor to determine if case matters.
In fact, you should probably query the DBAdaptor to determine if you
need to change the column name case at all.

On Dec 11, 2007 5:15 PM, Mikaël Cluseau <mc...@gmail.com> wrote:
> So the question become, should we support this in Cayenne, but I can't
> anwser ;-)
>
> Le mardi 11 décembre 2007 à 16:11 -0600, Robert Zeigler a écrit :
> > The case-sensitivity of at least some DBMS depends on the host OS.
> > MYSQL, for instance, with MyISAM tables is case sensitive on case-
> > sensitive operating systems, and case insensitive otherwise.
> >
> > Robert
>
>
> --
>   .~.
>   /V\      Mikaël Cluseau <mc...@isi.nc>
>  // \\
> /(   )\    ISI.NC             +687 26.93.18
>  ^`~'^
>
>

Re: [2.0-STABLE] 2 patches : db relationship pks, caseless datarows

Posted by Mikaël Cluseau <mc...@gmail.com>.
So the question become, should we support this in Cayenne, but I can't
anwser ;-)

Le mardi 11 décembre 2007 à 16:11 -0600, Robert Zeigler a écrit :
> The case-sensitivity of at least some DBMS depends on the host OS.
> MYSQL, for instance, with MyISAM tables is case sensitive on case- 
> sensitive operating systems, and case insensitive otherwise.
> 
> Robert

-- 
  .~.
  /V\      Mikaël Cluseau <mc...@isi.nc>
 // \\
/(   )\    ISI.NC             +687 26.93.18
 ^`~'^


Re: [2.0-STABLE] 2 patches : db relationship pks, caseless datarows

Posted by Robert Zeigler <ro...@puregumption.com>.
The case-sensitivity of at least some DBMS depends on the host OS.
MYSQL, for instance, with MyISAM tables is case sensitive on case- 
sensitive operating systems, and case insensitive otherwise.

Robert

On Dec 11, 2007, at 12/113:34 PM , Mikaël Cluseau wrote:

> Hello,
>
> I was using to-one relationships as primary keys and found that it
> wasn't working. I made it working, the right way, I hope ;-).
>
> This patch modifies DataDomainInsertBucket.
>
> The second is to fix a problem I had with DB2/AS400 using custom
> templates to fetch DataObjects : the column names returned by the  
> server
> were in upper case, and Cayenne was expecting them in lower-case. My  
> fix
> is to normalize the keys in the DataRow, overriding get/put methods. I
> think SQL is case insensitive for schema/table/column names, so it
> shouldn't be a problem with any DBMS (again, I hope).
>
> This patch modifies DataRow.
>
> Cheers,
>
> -- 
>  .~.
>  /V\      Mikaël Cluseau <mc...@isi.nc>
> // \\
> /(   )\    ISI.NC             +687 26.93.18
> ^`~'^
> <caseless_datarow.patch><db_relationship_pk.patch>


Column case sensitivity [Was: [2.0-STABLE] 2 patches : db relationship pks, caseless datarows]

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi

(let's keep separate discussions in separate threads... so this  
message is about a second patch on case sensitivity).

In general I like the idea to address the issue of column name case  
sensitivity once and for all. Also as far as I can tell your  
implementation does not have any effect on Cayenne correctness even on  
case-sensitive databases (e.g Sybase), as DataRow internal keys are  
not used in column list generation (IIRC we consistently use  
DbAttribute names). r

My concern is that it will add some serious overhead as DataRow get/ 
put operations is probably the most common one throughout the Cayenne  
stack and is invoked like millions of times in a typical active app.

Anyways... the good news is that we solved this same problem in 3.0  
already specifically for the SQLTemplate. There is a new method called  
'setColumnNamesCapitalization' that can uppercase or lowercase result  
columns for you.

Andrus


On Dec 11, 2007, at 11:34 PM, Mikaël Cluseau wrote:
> ...
> This patch modifies DataDomainInsertBucket.
>
> The second is to fix a problem I had with DB2/AS400 using custom
> templates to fetch DataObjects : the column names returned by the  
> server
> were in upper case, and Cayenne was expecting them in lower-case. My  
> fix
> is to normalize the keys in the DataRow, overriding get/put methods. I
> think SQL is case insensitive for schema/table/column names, so it
> shouldn't be a problem with any DBMS (again, I hope).