Path: utzoo!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!uunet!mcsun!ukc!axion!vision!chris From: chris@vision.uucp (Chris Davies) Newsgroups: comp.databases Subject: Re: Informix messages in ESQL/C (summary) Message-ID: <1991Mar18.131847.29728@vision.uucp> Date: 18 Mar 91 13:18:47 GMT References: <1991Mar13.171305.16997@vision.uucp> Reply-To: chris@vision.UUCP (Chris Davies) Organization: VisionWare Ltd., Leeds, UK Lines: 37 In article <1991Mar13.171305.16997@vision.uucp> I wrote, >I have an application written with Informix's ESQL/C embedded SQL in C (not >the 4GL product). When an error occurs, the error number can be found from >the sqlca structure (in sqlca.sqlcode). What I would like to do is to be >able to obtain the error text associated with that error number. There is an undocumented (in v2.xx) Informix library call which will do exactly what I want: rgetmsg( code, buf, buffer_length ) long code; char *buffer; int buffer_length; which returns a format string in 'buf[0..buffer_length]' corresponding to the error number given by 'code'. Some format strings require a parameter (such as the table name) and this can be obtained from sqlca.sqlerrm. Thus char errtxt[256]; char emessage[256]; rgetmsg(sqlca.sqlcode, errtxt, sizeof(errtxt)); sprintf(emessage, errtxt, sqlca.sqlerrm); printf("Error %ld: %s\n", sqlca.sqlcode, emessage); Thanks to all who pointed this out. If only Informix had documented this in version 2... Chris -- VISIONWARE LTD | UK: chris@vision.uucp JANET: chris%vision.uucp@ukc 57 Cardigan Lane | US: chris@vware.mn.org BANGNET: ...!ukc!vision!chris LEEDS LS4 2LE, England | VOICE: +44 532 788858 FAX: +44 532 304676 -------------- "VisionWare: The home of DOS/UNIX/X integration" -------------