SetServerServiceClasses (obsolete)

Description

Tells the server component to trigger custom events defined in user objects for data validation. These user objects, referred to as service classes, must be defined in the PBL or PBD containing the DataWindow object for the server component.

Obsolete method

SetServerServiceClasses is obsolete and should not be used, because the Web DataWindow technology is obsolete.

Applies to

DataWindow type

Method applies to

Web

Server component


Syntax

Web DataWindow server component

short dwcomponent.SetServerServiceClasses ( string serviceclassnames )

Argument

Description

dwcomponent

A reference to a Web DataWindow server component.

serviceclassnames

A string whose value is a list of PowerBuilder custom class user objects. The user objects must be in the PBL or PBD containing the DataWindow for the server component. Separate user object names with a semicolon.


Return value

Returns 1 if it succeeds and -1 if a specified service class does not exist.

Usage

The main use of service classes is to provide data validation using server-side business logic.

Service classes implement one or more user-defined events with these names and signatures:

long dberror ( long sqldbcode,  string sqlerrtext,  string sqlsyntax,  dwbuffer buffer,  long row,  datastore ds )
long retrievestart ( datastore ds )
long retrieveend ( long rowcount,  datastore ds )
long sqlpreview ( sqlpreviewfunction request,  sqlpreviewtype sqltype,  string sqlsyntax,  dwbuffer buffer,  long row,  datastore ds )
long updatestart ( datastore ds )
long updateend ( long rowsinserted,  long rowsupdated,  long rowsdeleted,  datastore ds )
long htmlcontextapplied ( string action,  datastore ds )

The custom events can use the same return codes as the corresponding standard DataWindow events documented in DataWindow Events By setting a return code, a custom event can cause the event action to be canceled in the server component.

When the standard DataWindow event occurs in the server component, the component triggers the custom event in each of the listed service classes. One or more of the components can implement the event. A service class only needs to implement the events whose outcome it wants to influence. Any of the service classes can set an event return code that cancels the event action in the server component.

Runtime errors

Instantiated service objects run in the same objects space as the server component. If a runtime error occurs in the service object, it could cause HTML generation to fail.

Examples

This JavaScript example for a server-side script specifies a list of service classes that implement events:

dwMine.SetServerServiceClasses ( "uo_update;uo_retrieve;uo_dberror" );

See also

Events:

HTMLContextApplied

DBError

RetrieveStart

RetrieveEnd

SQLPreview

UpdateStart

UpdateEnd