JServerResultSet sequence of calls

Here are the calls to construct a result set and send it row-by-row:

  1. Create a JServerResultSetMetaData object by calling JContext.createServerResultSetMetaData().

  2. Call the JServerResultSetMetaData methods to define the format of the result rows, as follows:

    1. JServerResultSetMetaData.setColumnCount(int) to specify the number of columns in each row.

    2. For each column, call JServerResultSetMetaData.setColumnType(int, int) to specify the datatype.

    3. For columns that have a variable length datatype, call JServerResultSetMetaData.setColumnDisplaySize(int, int) to specify the maximum length for column values.

    4. Call other JServerResultSetMetaData methods to specify other column attributes as needed.

  3. Create a JServerResultSet object by calling JContext.createServerResultSet().

  4. Call JServerResultSet.next() to position the result set’s cursor at the first row.

  5. For each row to be sent:

    • For each column, call the appropriate JServerResultSet.set<Object>(int, <Object>) method to set the column value.

    • Call JServerResultSet.next() to send the row.

  6. If sending a single result set or if using JDBC types, call JServerResultSet.done() to indicate that all rows have been sent in the current result set.

  7. If your component uses IDL/Java datatypes, use the com.sybase.CORBA.IdlResultSet class to convert the result set to a TabularResults.ResultSet instance. See Chapter 1, “Java Classes and Interfaces,” in the EAServer API Reference for details.

You can repeat steps 4 to 6 to send or create another result set that has the same metadata using the same JServerResultSet object. Repeat steps 1 to 6 to send or create another result set that requires different metadata.

You cannot return multiple result sets unless the method’s IDL definition returns TabularResults::ResultSets.