dbTalk Databases Forums  

ESQL/C GET DIAGNOSTICS not working???

comp.databases.sybase comp.databases.sybase


Discuss ESQL/C GET DIAGNOSTICS not working??? in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gregory Bond
 
Posts: n/a

Default 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?


Reply With Quote
  #2  
Old   
Neal
 
Posts: n/a

Default Re: ESQL/C GET DIAGNOSTICS not working??? - 01-09-2004 , 03:06 PM






Hello,

I ran a few tests and the "GET DIAGNOSTICS" statement
seems a little buggy to me. It did not return an error
number on the "EXEC SQL CONNECT" failure just as you illustrated.

However, it partially works for a statement like "EXEC SQL USE pubs2X;".
It returned the correct message in "sqlca.sqlerrm.sqlerrmc" but the
error number returned in "sqlca.sqlcode" was wrong.

I would recommend installing error and warning handlers like they
illustrate in $SYBASE/$SYBASE_OCS/sample/esqlc/example1.cp & example2.cp.

If you aren't able to use those for some reason, contact
Sybase technical support and open a case to get the bug
resolved.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.