pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christof Petig <christof@petig-baender.de>
To: kjw <kenneth69@usa.net>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-interfaces@postgresql.org
Cc: pg@fastcrypt.com
Subject: Re: ECPG and EXEC SQL GET DIAGNOSTICS
Date: Wed, 21 Jan 2004 21:40:33 +0100
Message-ID: <400EE3C1.2080308@petig-baender.de> (raw)
In-Reply-To: <4006159F.5000505@usa.net>
References: <3FFF47D7.90100@usa.net>
	<200401100151.12626.peter_e@gmx.net>
	<4006159F.5000505@usa.net>

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





view thread (6+ messages)

Message-ID: <400EE3C1.2080308@petig-baender.de>
Permalink:  ../400EE3C1.2080308@petig-baender.de/
Also on:    postgresql.org/message-id/400EE3C1.2080308@petig-baender.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: christof@petig-baender.de, kenneth69@usa.net, peter_e@gmx.net, pg@fastcrypt.com
  Subject: Re: ECPG and EXEC SQL GET DIAGNOSTICS
  In-Reply-To: <400EE3C1.2080308@petig-baender.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox