You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current behavior of ResultSet.getXxx(String) eg ResultSet.getString(String) and ResultSet.findColumn(String) are not JDBC 4.0 compliant.
Example query:
SELECT CUST_NO, CUSTOMER AS CST_NAME FROM CUSTOMER
Expected:
getXxx("CUST_NO") returns the value (of col 1)
getXxx("CST_NAME") return the value (of col 2)
getXxx("CUSTOMER") throws a SQLException
findColumn("CUST_NO") returns 1
findColumn("CST_NAME") returns 2
findColumn("CUSTOMER") throws a SQLException
Current behavior:
getXxx("CUST_NO") returns the value (of col 1)
getXxx("CST_NAME") return the value (of col 2)
getXxx("CUSTOMER") returns the value (of col 2)
findColumn("CUST_NO") returns 1
findColumn("CST_NAME") returns 2
findColumn("CUSTOMER") returns 2
The JDBC 4.0 spec says (15.2.3):
{quote}
Two getter methods exist for each JDBC type: one that takes the column index as its first parameter and one that takes the column label.
{quote}
and
{quote}
Column labels supplied to getter methods are case insensitive. If a select list contains the same column more than once, the first instance of the column will be returned.
The index of the first instance of a column label can be retrieved using the method findColumn. If the specified column is not found, the method findColumn throws an SQLException.
{quote}
The JDBC 4.0 API doc states for ResultSet.findColumn:
{quote}
Maps the given ResultSet column label to its ResultSet column index.
Parameters:
columnLabel \- the label for the column specified with the SQL AS clause\. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
the column index of the given column name
Throws:
SQLException \- if the ResultSet object does not contain a column labeled columnLabel, a database access error occurs or this method is called on a closed result set
{quote}
and for ResultSet.getString(String):
{quote}
Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
Parameters:
columnLabel \- the label for the column specified with the SQL AS clause\. If the SQL AS clause was not specified, then the label is the name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException \- if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result set
{quote}
The text was updated successfully, but these errors were encountered:
Test (package firebird.reproduction) that tests basic cases. Two of them fail right now:
* testFindColumnUseNameWithAlias
* testGetStringUseNameWithAlias
Submitted by: @mrotteveel
Assigned to: Roman Rokytskyy (rrokytskyy)
Attachments:
ColumnLabelGetTest.java
The current behavior of ResultSet.getXxx(String) eg ResultSet.getString(String) and ResultSet.findColumn(String) are not JDBC 4.0 compliant.
Example query:
SELECT CUST_NO, CUSTOMER AS CST_NAME FROM CUSTOMER
Expected:
getXxx("CUST_NO") returns the value (of col 1)
getXxx("CST_NAME") return the value (of col 2)
getXxx("CUSTOMER") throws a SQLException
findColumn("CUST_NO") returns 1
findColumn("CST_NAME") returns 2
findColumn("CUSTOMER") throws a SQLException
Current behavior:
getXxx("CUST_NO") returns the value (of col 1)
getXxx("CST_NAME") return the value (of col 2)
getXxx("CUSTOMER") returns the value (of col 2)
findColumn("CUST_NO") returns 1
findColumn("CST_NAME") returns 2
findColumn("CUSTOMER") returns 2
The JDBC 4.0 spec says (15.2.3):
{quote}
Two getter methods exist for each JDBC type: one that takes the column index as its first parameter and one that takes the column label.
{quote}
and
{quote}
Column labels supplied to getter methods are case insensitive. If a select list contains the same column more than once, the first instance of the column will be returned.
The index of the first instance of a column label can be retrieved using the method findColumn. If the specified column is not found, the method findColumn throws an SQLException.
{quote}
The JDBC 4.0 API doc states for ResultSet.findColumn:
{quote}
Maps the given ResultSet column label to its ResultSet column index.
{quote}
and for ResultSet.getString(String):
{quote}
Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
{quote}
The text was updated successfully, but these errors were encountered: