X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6CA69D1C9E5 for ; Thu, 22 Jan 2004 07:37:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 88709-08 for ; Thu, 22 Jan 2004 03:37:07 -0400 (AST) Received: from b.frontend.um.mediaways.net (b.frontend.um.mediaways.net [62.53.231.7]) by svr1.postgresql.org (Postfix) with SMTP id 61D14D1B52F for ; Thu, 22 Jan 2004 03:36:49 -0400 (AST) Received: (qmail 15062 invoked by uid 4225); 22 Jan 2004 07:36:33 -0000 Received: from unknown (195.71.51.141) by smtp.um.mediaways.net (10.232.15.250) with ESMTP; 22 Jan 2004 07:36:33 -0000 Received: from puck.petig-baender.de ([192.168.234.11] helo=petig-baender.de ident=christof) by gateway.petig-baender.de with esmtp (Exim 3.35 #1 (Debian)) id 1AjZOA-0003LD-00; Thu, 22 Jan 2004 08:36:31 +0100 Message-ID: <400EE3C1.2080308@petig-baender.de> Date: Wed, 21 Jan 2004 21:40:33 +0100 From: Christof Petig Organization: Adolf Petig GmbH & Co. KG User-Agent: Mozilla/5.0 (X11; U; Linux ppc; de-AT; rv:1.5) Gecko/20031110 Debian/1.5-3 X-Accept-Language: de-DE, de, en MIME-Version: 1.0 To: kjw Cc: Peter Eisentraut , pgsql-interfaces@postgresql.org, pg@fastcrypt.com Subject: Re: ECPG and EXEC SQL GET DIAGNOSTICS References: <3FFF47D7.90100@usa.net> <200401100151.12626.peter_e@gmx.net> <4006159F.5000505@usa.net> In-Reply-To: <4006159F.5000505@usa.net> X-Enigmail-Version: 0.76.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/13 X-Sequence-Number: 4682 kjw schrieb: > To all, > Thanks for responding to my question and sorry for the delay > in answering your reply. > > Informix ESQLC (9.2.1 ) has functionality that allows you to get the > status of > a previously excecuted sql statement. > > /* there can be more than 1 exception, the "1" in the following example > refers to the 1st exception" */ > EXEC SQL get diagnostics exception 1 > :_srvrname = SERVER_NAME, :_sqlstate_code = RETURNED_SQLSTATE, > :_message = MESSAGE_TEXT, :_messlen = MESSAGE_LENGTH; > > This would place the DB Server name, Error message text (if any) and the > length > of the error message into the respective host variables. > This statement would compile and run under informix but fail > when compiled with ecpg (3.1.0/PostgreSQL 7.4.1) with the following > error code. > "test.pgc:19: ERROR: syntax error at or near "diagnostics" " > > Compilation command: "ecpg -c -C INFORMIX test.pgc" I really like this syntax! It's a nice way to get at information which historically had been accessed by SQLCA. Just like GET DESCRIPTOR encapsulates access to the SQLDA structure. About two years ago, when I implemented get descriptor, get diagnostics was not there (and the error suggests it's still the case). Supporting this feature would be not that difficult to add: you can follow the get descriptor design. [add keywords to scanner, add syntax and generated code to yacc, add function to library] If you want to implement it and need more information just ask me (or Michael Meskes). But beware: You might soon run into the fact that SET DESCRIPTOR is not yet there at all (as are query parameters). Or perhaps you might need SQLDA (which never was implemented, too). But these are all shortcomings that I'm aware of. Sadly C embedded SQL is not as popular as JDBC or ODBC, so less people are enhancing it. Christof