Issue Details (XML | Word | Printable)

Key: DERBY-229
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Shreyas Kaushik
Reporter: Daniel John Debrunner
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Column names on ResultSet.updateXXX and getXXX methods are handled incorrectly

Created: 19/Apr/05 12:04 PM   Updated: 03/Jun/05 02:57 PM
Return to search
Component/s: JDBC
Affects Version/s: 10.0.2.1, 10.1.1.0
Fix Version/s: 10.1.1.0

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File Licensed for inclusion in ASF works x.java 2005-04-19 12:06 PM Daniel John Debrunner 1 kB

Resolution Date: 03/Jun/05 02:56 PM


 Description  « Hide
Sections 14.2.3 and [14.2.3] of JDBC 3.0 spec say

Column names supplied to getter [updater] methods are case insensitive. If a select list
contains the same column more than once, the first instance of the column will be
returned [updated].

Derby returns or updates the last column in the select list, not the first. With the attached Java class I see

PRE-UPDATE
1,100
POST-UPDATE
1,500
POST-UPDATE getXXX(name)
AB:500,ab500

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Daniel John Debrunner added a comment - 19/Apr/05 12:10 PM
Also present in 10.0.2.1 for getXXX only (since updateXXX not supported)

Mamta A. Satoor added a comment - 19/Apr/05 01:39 PM
The getter [updater] methods with column names (in EmbedResultSet.java) use the protected method findColumnName(String columnName) to determine the column index for the passed column name. And the loop for the lookup starts from the end towards the beginning of the ResultDescription and that seems to be the problem behind the current behavior.
ResultDescription rd = resultDescription;

     // 1 or 0 based? assume 1 (probably wrong)
     for (int i=rd.getColumnCount(); i>=1; i--) {

     String name = rd.getColumnDescriptor(i).getName();
     if (StringUtil.SQLEqualsIgnoreCase(columnName, name)) {
     return i;
     }
     }

Satheesh Bandaram added a comment - 03/Jun/05 06:33 AM
I believe I checked in fix for Shreyas for this bug. Shreyas, can you resolve and close this bug?

Shreyas Kaushik added a comment - 03/Jun/05 02:56 PM
Patched has been submitted which was committed.

Shreyas Kaushik added a comment - 03/Jun/05 02:57 PM
Closing this issue as it was patched