Syntax 2 For generating a result set using an EAServer Method As Stored Procedure – PB Docs 150

Syntax 2 For generating a result set using an EAServer Method As Stored Procedure

Description

Generates an EAServer result
set that can be returned from a PowerBuilder user object running
as a component on EAServer.
The result set is retrieved using a DataWindow control or DataStore
object whose data source is an EAServer component
method.

Controls

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataStore object

Syntax

[PowerBuilder]

Argument

Description

dwcontrol

The DataWindow control or DataStore object
that contains the data to be returned in the result set.

dwbuffer (optional)

A value of the dwBuffer enumerated datatype
specifying the DataWindow buffer from which you want to copy rows. Valid
values are:

  • Primary! – (Default) The
    data in the primary buffer (data that has not been deleted or filtered
    out).

  • Delete! – The data in the delete buffer
    (data deleted from the DataWindow object).

  • Filter! – The data in the filter buffer
    (data that was filtered out).

Return Values

Returns 1 if it succeeds or one of the following negative
values if an error occurs:

  • -4

    Value of dwbuffer or internal parameter
    incorrect

  • -10

    Calling object not running on EAServer or EAServer API library could not
    be loaded

  • -11

    Entry points in EAServer API
    library not found

  • -12

    Internal error

Usage

The GenerateResultSet method allows you
to return a result set from a PowerBuilder custom class user object
that has been packaged as a component on EAServer using
the EAServer Method As Stored
Procedure (MASP) technique. For more information about MASP, see
the EAServer documentation.

GenerateResultSet does not return
a result set if the custom class user object is not running on EAServer.

To use GenerateResultSet, create a user
object function for the custom class user object that will be installed
on EAServer. The user object function
must not return a value. It connects to a database and retrieves data
into a DataStore object using the PowerBuilder Transaction object. The
call to GenerateResultSet uses column data in
the DataStore object to generate an EAServer result
set.

In the installed EAServer component,
the user object function runs as a method on EAServer. EAServer can return the generated
result set to any client that can interpret a Tabular Data Stream
(TDS) result set. To retrieve the result set from a PowerBuilder
client, create a DataWindow object whose data source is Stored Procedure
and select the method on EAServer as
the data source.

DataWindow datatypes map to CS-Library type constants in the
result set as follows:

Table 9-3: Correspondence between DataWindow datatypes and CS–Library
constants

DataWindow datatype

Datatype in result set

Date

CS_CHAR_TYPE

DateTime

CS_DATETIME_TYPE

Decimal

CS_DECIMAL_TYPE

Long, Ulong

CS_INT_TYPE

Number

CS_FLOAT_TYPE

Real

CS_REAL_TYPE

String (length <= 244)

CS_CHAR_TYPE

String (length > 244)

CS_LONGCHAR_TYPE

Time

CS_CHAR_TYPE

The precision of all decimal datatypes in the result set will
be 16.

The sort order of the result set remains the same whether
or not the method running on EAServer performs
a sort operation on the DataStore object. If the result set is returned
to a PowerBuilder client, you can use the Sort and SetSort PowerScript
methods to sort the returned data.

If GenerateResultSet is called multiple
times within a single script, EAServer passes
multiple duplicate result sets back to the client.

Examples

The following is a user object function that runs
as a method on EAServer. The
function creates an instance of a DataStore object, connects to
a database, and retrieves data into the DataStore object. The call
to GenerateResultSet creates an EAServer result set that is returned
to the client from the data in the DataStore object.

To use the method above with a PowerBuilder client, start
PowerBuilder and connect with ODBC or with the SYC database interface
to EAServer where the user
object is installed. Create a new DataWindow object with Stored
Procedure as its data source and then select the component method from
the list of stored procedures. Define the result set to correspond
to the result set returned by the method on the server.

In the client application, use the Retrieve method
to retrieve data from the server:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x