Try OpenEdge Now
skip to main content
Java Open Clients
Passing Temp-tables as SQL ResultSet Parameters : Passing a TABLE or TABLE-HANDLE as an INPUT parameter : Providing metadata for INPUT TABLE-HANDLE parameters : ProResultSetMetaDataImpl class
 
ProResultSetMetaDataImpl class
If the meta data for the input ResultSet must be supplied by code implemented in the client application, the getMetaData() method must be implemented to return an instance of ResultSetMetaData. The recommended way to do this is to use the com.progress.open4gl.ProResultSetMetaDataImpl class provided in the Open Client Toolkit. This is an implementation of the ProResultSetMetaData interface, the same interface that is used by the client when getting output data.
There are only two methods of ProResultSetMetaDataImpl that the application must call:
1. The constructor:
Syntax
ProResultSetMetaDataImpl(int numFields)
2. The setFieldMetaData() method:
Syntax
setFieldMetaData(int fieldNumber, String Name, int extent, int type)
The setFieldMetaData() method requires the following:
*fieldNumber must be between 1 and the number of fields.
*Name cannot be null.
*The value of Name must be unique within the table.
*extent must be zero or greater (for BLOB and CLOB fields, it must be zero or one).
*type must be one of the class constant values defined in com.progress.open4gl.Parameter. For more information, see the information on specifying data type meta data for temp-tables in Passing Parameters.
Note: The Open Client Toolkit class documentation in OpenEdge-install-directory/java/doc/ also describes these methods used by the client application for the ProResultSetMetaDataImpl class.
To pass a self-implemented ResultSet for a TABLE–HANDLE parameter, the application must:
1. Create a new class that extends com.progress.open4gl.InputResultSet, to provide access to the data to be passed to the server. This object's implementation includes code for next() and getObject() (as for a static temp-table) and for getMetaData(), which should return the com.progress.open4gl.ProResultSetMetaDataImpl instance when called.
2. Create an instance of the class you created in Step 1.
3. Create an instance of com.progress.open4gl.ProResultSetMetaDataImpl.
4. Call ProResultSetMetaDataImpl.setFieldMetaData() for each field of the table.
5. Make the ProResultSetMetaDataImpl instance available to the InputResultSet object. You can do this in any way you like, for example, by adding a setMetaData() method to your InputResultSet implementation.
6. Make the proxy method call passing the com.progress.open4gl.InputResultSet instance as the parameter.
Note: Step 3 and Step 4 can be implemented in getMetaData() which eliminates the need for Step 5.