Progress
Open Client
Developer’s Guide


Accessing TEMP-TABLE Or TABLE-HANDLE Parameters As Output

For both output TEMP-TABLE and TABLE-HANDLE parameters and input-output TEMP-TABLE and TABLE-HANDLE parameters (on output), you must obtain the output ProResultSet object from the ResultSetHolder class and call its methods to get the data. As explained previously, com.progress.open4gl.ProResultSet extends the java.sql.ResultSet interface.

In addition to the standard flat model for viewing individual columns presented by ResultSet objects, ProResultSet allows you to view the object using the Progress array model, which presents a TEMP-TABLE as individual fields that can contain arrays. You can choose whichever model is most natural or convenient. For more information on the Progress field model, see Programming Concepts."

Standard Methods in the ProResultSet Interface

The standard methods include the methods of java.sql.ResultSet, which use the flat column model. The primary methods in this set include:

SYNTAX
boolean next() 

Advances the result set cursor to the next row.

SYNTAX
void close() 

Closes the result set. For output result sets, the close() method may be called to close the result set before all the rows have been fetched.

NOTE: No other AppServer method can be called until all the rows have been fetched or until close() has been called.

SYNTAX
Object getObject(int columnNum) 

Returns the value of the column identified by the 1-based columnNum. The data type of the returned object is the default data type of the column. For example, the default data type for a 4GL CHARACTER field is java.lang.String. For more information, see the "Default Data-type Mapping For TEMP-TABLE Fields" section.

SYNTAX
Object getObject(String fieldName) 

Returns the value of the column identified by the fieldName. The data type of the returned object is the default data type of the field. For example, the default data type for a 4GL CHARACTER field is java.lang.String. For more information, see the "Default Data-type Mapping For TEMP-TABLE Fields" section.

SYNTAX
DataType getDataType(int columnNum) 

Returns the value of the column identified by columnNum. DataType is the name of the data type, for example, String getString(), Integer getInteger(), and so on.

SYNTAX
DataType getDataType(String fieldName) 

Returns the value of the column identified by the fieldName. DataType is the name of the data type, for example, String getString(), Integer getInteger(), and so on.

If the specified return DataType is different from the default data type of the column, the Open Client takes one of the following actions:

For example, if the 4GL data type is INTEGER and its value is 10, getString(columnNum) automatically converts the value from Integer to the java.lang.String, "10". If the application calls getDate(columnNum), an Exception is thrown with the message that an Integer value cannot be converted to Date. For information on the supported conversions, see Table 5–4.

ProResultSet Interface Extensions to java.sql.ResultSet

ProResultSet adds the following methods not found in java.sql.ResultSet, where DataType is the name of the data type. These extensions allow your application to access the data in a result set based on the Progress array model (see the section on the array and flat models in "Programming Concepts").

SYNTAX
Object getObject(int fieldNum, int arrayIndex) 

Returns the value of the arrrayIndex element of the array field identified by fieldNum. The datatype of the object is the default datatype of the arrayfield. The arrayIndex and fieldNum are 1-based.

SYNTAX
Object getObject(String fieldName, int arrayIndex)  

Returns the value of the arrayIndex element of the arrayfield identified by fieldName. The datatype of the object is the default datatype of the arrayfield. The arrayIndex and fieldName are 1-based.

SYNTAX
DataType getDataType(int fieldNum, int arrayIndex) 

Name of datatype. For example, String getString(), Integer getInteger(), and so on. Returns the value of the arrayIndex element of the arrayfield identified by fieldNum. The arrayIndex and fieldNum are 1-based.

SYNTAX
DataType getDataType (String fieldName, int arrayIndex)  

Name of the datatype. For example, String getString(), Integer getInteger(), and so on. The datatype of the object is the default datatype of the arrayfield. The arrayIndex and fieldNum are 1-based.

For example, here is the syntax for methods that return a value for a String and an Integer array element of a TEMP-TABLE field:

String getString(int fieldNum, int arrayIndex)  

String getString(String fieldName, int arrayIndex) 

Integer getInteger(int fieldNum, int arrayIndex) 

Integer getInteger (String fieldName, int arrayIndex) 

For a complete listing of the methods implemented by the ProResultSet interface, see the documentation in Progress-Install-Directory/java/doc.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095