srv_event
Activates a client event.
Important This Open Data Services function or macro is only supported in Microsoft® SQL Server™ version 7.0 for backward compatibility.
For more information about Open Data Services functions or macros supported for backward compatibility, see Open Data Services (Level 3).
Syntax
int srv_event (
SRV_PROC * srvproc,
int event,
void * data );
Arguments
- srvproc
- Is a pointer to the SRV_PROC structure that is the handle for a particular client connection. The structure contains all information the ODS Library uses to manage communications and data between the Open Data Services server application and the client.
- event
- Indicates the event to activate. This value can be SRV_DISCONNECT, SRV_EXIT, or SRV_STOP.
- data
- Is a pointer to data supplied by the Open Data Services developer. The data is available in the event handler for the specified event when srv_event is called. It is accessed with SRV_EVENTDATA. The pointer can be NULL.
Returns
The value of the requested event, or -1 if an error occurs.
Remarks
Events are usually activated automatically based on client and server requests. However, events can be activated from within an Open Data Services server application by using srv_event.
Only these events can be invoked by using srv_event:
- SRV_DISCONNECT, which disconnects the specified srvproc client connection, regardless of whether additional client events are pending.
- SRV_STOP, which disables new logins and then waits until all users have exited before shutting down the Open Data Services server. The necessary server information is obtained from srvproc.
- SRV_EXIT, which shuts down the Open Data Services server immediately, regardless of whether further client events are pending. The necessary server information is obtained from srvproc.
The srv_handle function specifies which event handler to call when an event occurs. If no handler is defined for a particular event, the Open Data Services server application’s default event handler is called.
Data can be passed to event handlers or to any event. The data is made available with the SRV_EVENTDATA macro.
To activate an Open Data Services event without a SRV_PROC client connection, call the srv_setevent function.
See Also
(c) 1988-98 Microsoft Corporation. All Rights Reserved.