ResultSetMetaData and Function Return Values
ActiveSpaces determines the data types of the return values of functions used in queries at runtime. When the ResultSet for a query contains the return value of a function, VARCHAR is always reported as the data type for the value in the ResultSetMetaData.
If you need to retrieve a function return value from the ResultSet as its actual data type, you will need to wait until the query is executed. After the query has been executed, the custom method ResultSetImplDG.getColumnType() can be called which will return the actual result value type.
For example, suppose you have the following query:
SELECT COUNT(key) FROM mytable
The
ResultSetMetaData will report that the data type for column 1 is VARCHAR. To retrieve the actual data type for column 1 of the query result do the following:
-
Unwrap the ResultSet object retrieved when the query is executed. For example,
ResultSetImplDG rsImpl = resultSet.unwrap(com.tibco.datagrid.jdbc.ResultSetImplDG.class);
-
Retrieve the data type of column 1 in the ResultSet. For example,
int columnType = rsimpl.getColumnType(1);
Where columnType will be set to an int from java.sql.Types.
Copyright © Cloud Software Group, Inc. All rights reserved.