dbprocmsghandle

DB Library for C

DB Library for C

dbprocmsghandle

Supplies a user function to handle Microsoft® SQL Server™ 2000 messages for a specific DBPROCESS connection.

Syntax

DBMSGHANDLE_PROC dbprocmsghandle (
PDBHANDLE
pdbhandle,
DBMSGHANDLE_PROC
message_handler)

Arguments

pdbhandle

Either a DBPROCESS structure or a LOGINREC structure. If this is a DBPROCESS connection, the message_handler will be used for that connection. If this is a LOGINREC structure, the message_handler will automatically be used for all future DBPROCESS connections opened (with dbopen) using the LOGINREC.

message_handler

A pointer to the user function that is called whenever DB-Library receives an error or informational message from SQL Server for the existing or future connection specified in pdbhandle. Define the connection message-handler function in exactly the same way as the application message-handler function specified in dbmsghandle.

Returns

If pdbhandle is a DBPROCESS, a pointer to the previously installed connection message handler is returned. This can be NULL.

If pdbhandle is a LOGINREC, a pointer to the newly installed connection message handler is returned, or NULL if this function fails.

Remarks

This function is similar to the dbmsghandle function. While dbmsghandle installs a message handler global to the entire DB-Library application, dbprocmsghandle installs a message handler for a specific DBPROCESS connection.

When DB-Library receives a message from SQL Server using a connection that has a connection message handler (installed using dbprocmsghandle), only the connection message handler is called. The application message handler is not called. Because a connection message handler is associated with a connection and is not global to the entire DB-Library application, the connection message-handler code does not need to protect against reentrancy by DB-Library.

Note that this function is not supported for Microsoft MS-DOS®.

See Also

dbmsghandle