home *** CD-ROM | disk | FTP | other *** search
- #include <sybfront.h>
- #include <sybdb.h>
- #include <sybfrs.h>
-
- #if MSDOS
- # include "aforms.h"
- #endif /* MSDOS */
-
- /*
- ** MSG_HANDLER
- ** Catch SQL Server error or information messages.
- */
- int msg_handler(dbproc, msgno, msgstate, severity, msgtext,
- srvname, procname, line)
-
- DBPROCESS *dbproc;
- DBINT msgno;
- int msgstate;
- int severity;
- char *msgtext;
- char *srvname;
- char *procname;
- DBUSMALLINT line;
-
- {
- int i;
- char tmpbuf[256];
- char msgbuf[256];
-
- /* Null out mesage buffers to avoid spurious garbage */
- for (i = 0; i< 256; i++)
- {
- tmpbuf[i] ='\0';
- msgbuf[i] ='\0';
- }
- /* For informational messages, be brief. */
- if (severity == 0)
- {
- fsmessage(msgtext);
- return(0);
- }
-
- sprintf (tmpbuf, "Msg %ld, Level %d, State %d\n",
- msgno, severity, msgstate);
- strcat(msgbuf, tmpbuf);
-
- #if DBLIB40
- if (strlen(srvname) > 0)
- {
- sprintf (tmpbuf, "Server '%s', ", srvname);
- strcat(msgbuf, tmpbuf);
- }
- if (strlen(procname) > 0)
- {
- sprintf (tmpbuf, "Procedure '%s', ", procname);
- strcat(msgbuf, tmpbuf);
- }
- if (line > 0)
- {
- sprintf (tmpbuf, "Line %d", line);
- strcat(msgbuf, tmpbuf);
- }
- #endif /* DBLIB40 */
-
- sprintf(tmpbuf, "\n\t%s\n", msgtext);
- strcat(msgbuf, tmpbuf);
-
- fsmessage(msgbuf);
- return(0);
- }
-