You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Thomas Vandahl <tv...@apache.org> on 2010/12/02 22:27:11 UTC

Re: svn commit: r1038355 - /db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java

On 28.11.10 21:42, Thomas Fox wrote:
>> Could you please re-run your test project against Oracle with this
>> version and tell me the findings?
> 
> Looks good. The test project runs ok against oracle using the current
> village 3.3.1 trunk.
> I did not run the test project for other databases.

Ok. I tested against MySQL and PostgreSQL and the test project worked
fine. Both consistently fail on SummaryHelperTest, however.

By looking at the code of SummaryHelper I guess this is based on the
fact that the results are put into a case-sensitive OrderedMap using the
column names returned from the database as a key. In the case of
Postgresql for example, the database returns the column names in lower
case, so that the test cannot find them. See example output of
dumpResults():

---8<---
"group_by1", "count_recs", "avg_int1", "min_int1", "max_int1",
"sum_int1", "avg_float1", "min_float1", "max_float1", "sum_float1", "upper"
"A1", 4, 2.5000000000000000, 1, 4, 10, 5.0, 2.0, 8.0, 20.0, "A1"
"B1", 4, 3.5000000000000000, 2, 5, 14, 7.0, 4.0, 10.0, 28.0, "B1"
"C1", 4, 4.5000000000000000, 3, 6, 18, 9.0, 6.0, 12.0, 36.0, "C1"
"D1", 4, 5.5000000000000000, 4, 7, 22, 11.0, 8.0, 14.0, 44.0, "D1"
---8<---

So I believe either the test or the implementation is wrong.

Other than this, shall we try another RC for Village 3.3.1?

Bye, Thomas

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


RE: svn commit: r1038355 - /db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java

Posted by Greg Monroe <Gr...@dukece.com>.
The SummaryHelper class has been refactored to use a new ListOrderedMapCI 
class that converts all String keys to lowercase.  Also, some changes where
made to the SummaryHelperTest class to better allow for DB's that might add
an UPPER column (Oracle) to the record.  The fix that was in place broke with
MS SQL.  The new code now checks if there's an extra column and adjusts 
accordingly.

Note that if anyone is using this in their code (with a runtime jar built 
from CVS), they may have to make sure that their code uses the new class to
ensure column names are case insensitive.  Alternatively, you can still use
the OrderMap interface if you make sure your keys are lowercased.

I have tested this against MySQL and MS SQL. Testing with Oracle and 
Postgres would be nice if someone has access/time.

TIA

> -----Original Message-----
> From: Greg Monroe
> Sent: Thursday, December 02, 2010 5:34 PM
> To: 'Apache Torque Developers List'
> Subject: RE: svn commit: r1038355 -
> /db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java
> 
> OK, catching up after a week and a bit off...
> 
> FYI - SummaryHelper did not make it into the last Torque release, so it's
> only in the repository.  The Village release probably should not be held
> up by this.
> 
> As pointed out, the underlying problem is that column names in the
> metadata
> may have different cases depending on the DB server. This means that
> results
> can be stored under a different name that was defined.
> 
> FWIW - I used ListOrderedMap for the results since it was close to what
> you
> get in a normal JDBC ResultSet.  E.g, access info by index or name.
> 
> Unfortunately, there doesn't seem to be a case insensitive version of
> this
> in commons.
> 
> I think the quick fix would be to create a subclass of ListOrderedMap
> that
> added a case insensitive methods like get( String key ),
> put( String key, Object value ), indexOf(String key), remove( String
> key),
> and containsKey ( String key ). Then use this instead of ListOrderedMap
> in
> the SummaryHelper code.
> 
> Greg
> 
> > -----Original Message-----
> > From: Thomas Vandahl [mailto:tv@apache.org]
> > Sent: Thursday, December 02, 2010 4:27 PM
> > To: Apache Torque Developers List
> > Subject: Re: svn commit: r1038355 -
> > /db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java
> >
> > On 28.11.10 21:42, Thomas Fox wrote:
> > >> Could you please re-run your test project against Oracle with this
> > >> version and tell me the findings?
> > >
> > > Looks good. The test project runs ok against oracle using the current
> > > village 3.3.1 trunk.
> > > I did not run the test project for other databases.
> >
> > Ok. I tested against MySQL and PostgreSQL and the test project worked
> > fine. Both consistently fail on SummaryHelperTest, however.
> >
> > By looking at the code of SummaryHelper I guess this is based on the
> > fact that the results are put into a case-sensitive OrderedMap using
> the
> > column names returned from the database as a key. In the case of
> > Postgresql for example, the database returns the column names in lower
> > case, so that the test cannot find them. See example output of
> > dumpResults():
> >
> > ---8<---
> > "group_by1", "count_recs", "avg_int1", "min_int1", "max_int1",
> > "sum_int1", "avg_float1", "min_float1", "max_float1", "sum_float1",
> > "upper"
> > "A1", 4, 2.5000000000000000, 1, 4, 10, 5.0, 2.0, 8.0, 20.0, "A1"
> > "B1", 4, 3.5000000000000000, 2, 5, 14, 7.0, 4.0, 10.0, 28.0, "B1"
> > "C1", 4, 4.5000000000000000, 3, 6, 18, 9.0, 6.0, 12.0, 36.0, "C1"
> > "D1", 4, 5.5000000000000000, 4, 7, 22, 11.0, 8.0, 14.0, 44.0, "D1"
> > ---8<---
> >
> > So I believe either the test or the implementation is wrong.
> >
> > Other than this, shall we try another RC for Village 3.3.1?
> >
> > Bye, Thomas
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-dev-help@db.apache.org
> 
> DukeCE 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-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org


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


RE: svn commit: r1038355 - /db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java

Posted by Greg Monroe <Gr...@dukece.com>.
OK, catching up after a week and a bit off... 

FYI - SummaryHelper did not make it into the last Torque release, so it's 
only in the repository.  The Village release probably should not be held 
up by this.

As pointed out, the underlying problem is that column names in the metadata
may have different cases depending on the DB server. This means that results
can be stored under a different name that was defined.

FWIW - I used ListOrderedMap for the results since it was close to what you
get in a normal JDBC ResultSet.  E.g, access info by index or name.  

Unfortunately, there doesn't seem to be a case insensitive version of this 
in commons.

I think the quick fix would be to create a subclass of ListOrderedMap that
added a case insensitive methods like get( String key ), 
put( String key, Object value ), indexOf(String key), remove( String key), 
and containsKey ( String key ). Then use this instead of ListOrderedMap in 
the SummaryHelper code.

Greg

> -----Original Message-----
> From: Thomas Vandahl [mailto:tv@apache.org]
> Sent: Thursday, December 02, 2010 4:27 PM
> To: Apache Torque Developers List
> Subject: Re: svn commit: r1038355 -
> /db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java
> 
> On 28.11.10 21:42, Thomas Fox wrote:
> >> Could you please re-run your test project against Oracle with this
> >> version and tell me the findings?
> >
> > Looks good. The test project runs ok against oracle using the current
> > village 3.3.1 trunk.
> > I did not run the test project for other databases.
> 
> Ok. I tested against MySQL and PostgreSQL and the test project worked
> fine. Both consistently fail on SummaryHelperTest, however.
> 
> By looking at the code of SummaryHelper I guess this is based on the
> fact that the results are put into a case-sensitive OrderedMap using the
> column names returned from the database as a key. In the case of
> Postgresql for example, the database returns the column names in lower
> case, so that the test cannot find them. See example output of
> dumpResults():
> 
> ---8<---
> "group_by1", "count_recs", "avg_int1", "min_int1", "max_int1",
> "sum_int1", "avg_float1", "min_float1", "max_float1", "sum_float1",
> "upper"
> "A1", 4, 2.5000000000000000, 1, 4, 10, 5.0, 2.0, 8.0, 20.0, "A1"
> "B1", 4, 3.5000000000000000, 2, 5, 14, 7.0, 4.0, 10.0, 28.0, "B1"
> "C1", 4, 4.5000000000000000, 3, 6, 18, 9.0, 6.0, 12.0, 36.0, "C1"
> "D1", 4, 5.5000000000000000, 4, 7, 22, 11.0, 8.0, 14.0, 44.0, "D1"
> ---8<---
> 
> So I believe either the test or the implementation is wrong.
> 
> Other than this, shall we try another RC for Village 3.3.1?
> 
> Bye, Thomas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org

DukeCE 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-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Re: svn commit: r1038355 - /db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java

Posted by Thomas Fox <Th...@seitenbau.net>.
> So I believe either the test or the implementation is wrong.

The test is wrong. I believe Greg has already fixed it.

> Other than this, shall we try another RC for Village 3.3.1?

Go ahead.

   Thomas


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