srv_handle

Installs a standard event handler for an Open Data Services application.


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

SRV_HANDLE_PROC srv_handle (
SRV_SERVER * server,
DBINT event,
SRV_HANDLE_PROC handler );

Arguments
server
Is a pointer to the SRV_SERVER structure. Use srv_init to get this pointer.
event
Specifies the event assigned to handler. All Open Data Services events are valid.
handler
Is a pointer to the function called when the event defined by event occurs. This function is global to the Open Data Services application and is called every time event occurs.

This function should be defined as returning an int and taking a single parameter. This parameter should be defined as SRV_SERVER * when event is one of the following:

The parameter should be defined as SRV_PROC * when event is one of the following:

This function must return one of the following values.

 

Return value Description
SRV_CONTINUE Continue normal processing.
SRV_DISCONNECT Fire a disconnect event to close the client connection.
SRV_EXIT Shuts down the server completely.

Returns

A pointer to the previously defined event-handling function.

Remarks

When an event occurs, Open Data Services calls the following functions in this order:

  1. The pre-event handler (installed by srv_pre_handle).
  2. The standard event handler (installed by srv_handle).
  3. The post-event handler (installed by srv_post_handle).

Each Open Data Services event has a default standard event handler that returns SRV_CONTINUE. Installing a standard event handler with srv_handle replaces the default handler with one supplied by the application.

You can install standard event handlers dynamically. The new standard event handler is called when the next event occurs. An Open Data Services application can have one standard event handler for each event. Open Data Services automatically removes the event handler when necessary; the application should not attempt to do this.

See Also
srv_event srv_pre_handle
srv_post_handle  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.