db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: [jira] Commented: (DERBY-229) Column names on ResultSet.updateXXX and getXXX methods are handled incorrectly
Date Fri, 29 Apr 2005 02:26:26 GMT
Shreyas Kaushik wrote:

> Find the patch attached.
> ~ Shreyas

Looks good, a few issues/thoughts:

1) The test is good, it might be good one day to expand it into more
testing of the JDBC ResultSet methods that take column names, thus maybe
the name of the test could be more generic.

2) Comments in tests are useful as well, expecially when the test fails
five years from now and the developer can't figure out what exactly you
were trying to test, so they can't determine if the change in output is
ok or not.

3) For loops with a method call or expression in the condition, it's
good to think if the call or expression can be moved out of the loop.
The compiler cannot spot if the method call or expresssion is constant
so it has to be evaluated each time through the loop. That's why the
loop was written the way it was, to evaulate getColumnCount only once.
Of course the order was wrong in that implementation, so I messed up
there. :-(


for(int i = 1 ; i<=rd.getColumnCount();i++)


int columnCount = rd.getColumnCount();
for(int i = 1 ; i<=columnCount;i++)

View raw message