Logo Search packages:      
Sourcecode: freetds version File versions

int tds_client_msg ( TDSCONTEXT *  tds_ctx,
TDSSOCKET *  tds,
int  msgnum,
int  level,
int  state,
int  line,
const char *  message 
)

tds_client_msg() sends a message to the client application from the CLI or TDS layer. A client message is one that is generated from with the library and not from the server. The message is sent to the CLI (the err_handler) so that it may forward it to the client application or discard it if no msg handler has been by the application. tds->parent contains a void pointer to the parent of the tds socket. This can be cast back into DBPROCESS or CS_CONNECTION by the CLI and used to determine the proper recipient function for this message.

Definition at line 1531 of file token.c.

References tds_client_msg().

Referenced by tds_client_msg(), tds_connect(), tds_read_packet(), tds_submit_execute(), tds_submit_prepare(), tds_submit_query(), tds_submit_rpc(), and tds_submit_unprepare().

{
      int ret;
      TDSMSGINFO msg_info;

      if (tds_ctx->err_handler) {
            memset(&msg_info, 0, sizeof(TDSMSGINFO));
            msg_info.msg_number = msgnum;
            msg_info.msg_level = level;   /* severity? */
            msg_info.msg_state = state;
            /* TODO is possible to avoid copy of strings ? */
            msg_info.server = strdup("OpenClient");
            msg_info.line_number = line;
            msg_info.message = strdup(message);
            ret = tds_ctx->err_handler(tds_ctx, tds, &msg_info);
            tds_free_msg(&msg_info);
            /* message handler returned FAIL/CS_FAIL
             * mark socket as dead */
            if (ret && tds) {
                  tds->state = TDS_DEAD;
            }
      }
      return 0;
}


Generated by  Doxygen 1.6.0   Back to index