Pathmaker Programming Guide

Modifying a Server Skeleton or Service Skeleton
Advanced Pathmaker Programming Topics
9–50 067868 Tandem Computers Incorporated
Changing the Format of the Error Messages
You can reformat any of the existing error messages used for processing SQL errors in
C services if you do not change the size of the fields or any of the field names. The
following excerpt lists the portion of the sql_advisory function that sets the format of
the default message, slightly reformatted for reproduction in this manual. The portion
of the code that you would change appears in bold for contrast.
.
.
.
/* If we did not find a special SQL error in the SQLCA, or if
we found an error from a non-SQL subsystem first, format a
generic message. */
if ( msgp == message )
{
if (ss_info.suppress )
msgp += sprintf (msgp, "SQL error %hd", sql_info.errcode );
else
if ( ss_info.paramlen <= 0 )
msgp += sprintf (msgp, "SQL error %hd, subsystem %c error
%hd", sql_info.errcode, ss_info.idchar, ss_info.errcode );
else
{
ss_info.param [ ss_info.paramlen ] = '\0';
msgp += sprintf (msgp, "SQL error %hd, %c-%hd on %s",
sql_info.errcode, ss_info.idchar, ss_info.errcode
ss_info.param );
}
}
/* Add the source file line number to the message, so the
programmer can locate the source of the error, if
necessary. */
msgp += sprintf (msgp, ", at %hd.03hd",
(short) ( sql_info.srcline / 1000 ),
(short) ( sql_info.srcline % 1000 ) );
while ( *--msgp == '0' ); if ( msgp == "." ) --msgp;
*++msgp = '\0';