Re: Error message printing
Posted in 1995
void sqlerror(void) { char fmt[256]; char str[256]; int msglen; if (rgetlmsg(sqlca.sqlcode, fmt, sizeof(fmt), &msglen) != 0) /* Problems with getting message */ else sprintf(str, fmt, sqlca.sqlerrm); fprintf(stderr, "SQL: %s\\n", str); } This is safe unless you get one of the errors with a %d format, or one with more than one % conversion specifier. You can use msglen to find out if there was enough space. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> >Date: Tue, 19 Dec 95 07:50:58 CST >From: bonk@positron.med.ge.com (Frank Bonk) >X-Informix-List-Id: <list.8255> > >We currently use rgetmsg to print out error messages but could use a >little help. Some error messages are printed in the form - > >" Key value for constraint (%s) is still being referenced ". > >What do I need to do to also decode the value for the constraint name? > >Thanks in advance. >Frank