Open Data Services defines a set of events that serve as the interface between client or server requests made to the ODS Library and the event handlers that you supply in your application to process those requests.
This section identifies Open Data Services event types, defines the actions that can generate an event, and describes how to associate a particular event handler with a particular event. In addition, this section illustrates a sample connect event from initiation to completion to demonstrate how Open Data Services processes incoming requests.
The following illustration shows the Open Data Services event-handling mechanism. In this example, the Open Data Services server application serves as a gateway between a SQL Server database client workstation and an external data source. A SQL Server database server or another Open Data Services server application making a remote stored procedure request would communicate with Open Data Services in a similar way.
Whenever the ODS Library accepts a request, it generates the appropriate event type and calls the corresponding event handler in the Open Data Services server application, if one is provided.
The Open Data Services server application responds to each event, returning results to the caller. If the caller is a client, Open Data Services returns results sets (using srv_describe and srv_sendrow), return values (using srv_sendstatus), and stored procedure output parameters (using srv_paramset or srv_returnval) to the calling client. If the caller is SQL Server, Open Data Services returns all results to SQL Server. Results sets flow through SQL Server to the client that initiated the activity. Return values and stored procedure output parameters can be captured by Transact-SQL commands or be returned directly to the client.