Bulk-Library gateway programming

The server-side Bulk-Library routines are designed to be used in gateways in conjunction with the client-side routines. Note that Open Server applications must have available a valid CS_CONNECTION structure (set up with Client-Library calls) to call Bulk-Library routines.

Open Server provides bulk-copy functionality that allows gateway Open Server applications to filter bulk-copy data. A gateway Open Server can examine each row of a bulk-copy operation and implement any of the following filters:

Figure 3-1: Gateway routing bulk-copy requests

Client sends bulk-copy requests in rows for table T in which the gateway Open server routes row data to table T on server 1, server 2, or server 3 depending on the contents.

A gateway’s client can issue two types of bulk requests, a TDS text/image insert request or a TDS bulk-copy request. In the case of a TDS text/image insert, the client simply wishes to send a text or image stream. In the case of a TDS bulk-copy request, the client is actually initiating a bulk-copy request. In both cases, the request handling involves processing both language (SRV_LANGUAGE) events and bulk (SRV_BULK) events.

An Open Server application processes both requests using two event handlers: SRV_LANGUAGE and SRV_BULK. Inside the SRV_LANGUAGE event handler, the application determines which kind of bulk request has been issued by the client and records this information internally. In addition, if the request is for bulk copy, the application allocates and initializes a bulk-descriptor structure. Inside the SRV_BULK handler, the application retrieves the request type and then processes the data accordingly.

The discussion in this section assumes that the gateway application is intended to accept both bulk-copy insert requests and text/image insert requests. For a description of how to handle text/image insert commands only, see the “Text and Image” topics page in the Open Server Server-Library/C Reference Manual.

NoteBulk-Library reports errors resulting from calls to server-side routines as Server-Library errors. Applications that call server-side Bulk-Library routines should install a Server-Library error handler to receive notification of these errors.