BBjStoredProcedureData::setRecordSet

Description

In BBj 7.00 and higher, this method sets the BBjRecordSet to be used as the stored procedure's result set.

Only SQL and in-memory record sets are supported, which means that file record sets cannot be passed into the setRecordSet() call. See BBjAPI::createMemoryRecordSet for additional information about in-memory record sets.

Syntax

Return Value Method
void setRecordSet(BBjRecordSetrecordSet)

Parameters

Parameter Description
recordSet Instance of an SQL or in-memory BBjRecordSet object.

Return Value

None.

Remarks

Either this method, setResultSet, or setUpdateCount can be called once. Subsequent invocations result in an !ERROR=207 (BBJ_STATE).

Example

The following example only works as the source code for a stored procedure. Do not attempt to run it as a normal BBj program.

rem 'A sample Stored Procedure program

rem 'Get a Stored Procedure object from the BBj File System
sp! = BBjAPI().getFileSystem().getStoredProcedureData()
template$ = "ID:I(4),NAME:C(100* = 10)"

rem ' Create the in-memory RecordSet
rs! = BBJAPI().createMemoryRecordSet(template$)

rem 'Add a record to the record set
data! = rs!.getEmptyRecordData()
data!.setFieldValue("ID", "1")
data!.setFieldValue("NAME", "John Doe")
rs!.insert(data!)

rem 'Add another record to the record set
data! = rs!.getEmptyRecordData()
data!.setFieldValue("ID", "2")
data!.setFieldValue("NAME", "Jane Smith")
rs!.insert(data!)

rem 'Set the result set for the stored procedure to use the record set we just created.
sp!.setRecordSet(rs!)

See Also

BBjAPI

Object Variables

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.