ESQL/C GET DIAGNOSTICS not working??? -
01-08-2004
, 11:35 PM
I have the following test program, basically copied verbatim from the
ESQL/C manual:
#include <stdio.h>
EXEC SQL INCLUDE sqlca;
int
main()
{
EXEC SQL BEGIN DECLARE SECTION;
int mcount = -9999;
int msgno = 1;
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT "bogus" using "none";
EXEC SQL GET DIAGNOSTICS :mcount = number;
fprintf(stderr, "%d messages...\n", mcount);
while (msgno <= mcount)
{
EXEC SQL GET DIAGNOSTICS EXCEPTION :msgno
:sqlca = SQLCA_INFO;
fprintf(stderr, "msg %d: %s\n", msgno, sqlca.sqlerrm.sqlerrmc);
}
return 1;
}
When I run this, I get:
typhoon$ ./t_error
-9999 messages...
typhoon$
If I change what mcount is initialized to, I get the same number back
out. Which is basically telling me that the "GET DIAGNOSTICS :mcount
= number" statement is not touching mcount at all.....
What's up? |