Looks like this bug has all the information needed to reproduce and to generate a patch. Is there any interest to submit a patch for this relatively easy fix? A complete patch would include a fix, along the general idea provided here and a test case added to jdbcapi test suite. Good opportunity for anyone wanting to get started modifying Derby code. Any volunteers? :-)

I am willing to help, if needed.

Satheesh

Mamta A. Satoor (JIRA) wrote:
     [ http://issues.apache.org/jira/browse/DERBY-229?page=comments#action_63128 ]
     
Mamta A. Satoor commented on DERBY-229:
---------------------------------------

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;
    		}
    	}


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

         Key: DERBY-229
         URL: http://issues.apache.org/jira/browse/DERBY-229
     Project: Derby
        Type: Bug
  Components: JDBC
    Versions: 10.1.0.0, 10.0.2.1
    Reporter: Daniel John Debrunner
 Attachments: x.java

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
    

  

Reply via email to