pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedECPG and EXEC SQL GET DIAGNOSTICS
6+ messages / 4 participants
[nested] [flat]
* ECPG and EXEC SQL GET DIAGNOSTICS
@ 2004-01-09 23:27 kjw <kenneth69@usa.net>
2004-01-12 13:28 ` Re: ECPG and EXEC SQL GET DIAGNOSTICS Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 6+ messages in thread
From: kjw @ 2004-01-09 23:27 UTC (permalink / raw)
To: pgsql-interfaces
Hi
I am currently thinking about porting
Embedded esql/c code from informix to
PostgreSQL. It there any plans on incorporating
the "EXEC SQL GET DIAGNOSTICS" functionality?
Thanks to all.
ken
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ECPG and EXEC SQL GET DIAGNOSTICS
2004-01-09 23:27 ECPG and EXEC SQL GET DIAGNOSTICS kjw <kenneth69@usa.net>
@ 2004-01-12 13:28 ` Dave Cramer <pg@fastcrypt.com>
0 siblings, 0 replies; 6+ messages in thread
From: Dave Cramer @ 2004-01-12 13:28 UTC (permalink / raw)
To: kjw <kenneth69@usa.net>; +Cc: pgsql-interfaces
Ken,
You should check out pginformix on gborg, it is a patch that makes
postgres "appear" more like an informix db.
http://gborg.postgresql.org/project/pginformix/projdisplay.php
It currently patches against 7.4.0 but I can upgrade it to 7.4.1
Dave
On Fri, 2004-01-09 at 18:27, kjw wrote:
> Hi
> I am currently thinking about porting
> Embedded esql/c code from informix to
> PostgreSQL. It there any plans on incorporating
> the "EXEC SQL GET DIAGNOSTICS" functionality?
> Thanks to all.
> ken
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
--
Dave Cramer
519 939 0336
ICQ # 1467551
^ permalink raw reply [nested|flat] 6+ messages in thread
* ECPG and EXEC SQL GET DIAGNOSTICS
@ 2004-01-10 00:31 kjw <kenneth69@usa.net>
2004-01-10 00:51 ` Re: ECPG and EXEC SQL GET DIAGNOSTICS Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 6+ messages in thread
From: kjw @ 2004-01-10 00:31 UTC (permalink / raw)
To: pgsql-interfaces
Hi
I am currently thinking about porting
Embedded esql/c code from informix to
PostgreSQL. It there any plans on incorporating
the "EXEC SQL GET DIAGNOSTICS" functionality?
Thanks to all.
ken
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ECPG and EXEC SQL GET DIAGNOSTICS
2004-01-10 00:31 ECPG and EXEC SQL GET DIAGNOSTICS kjw <kenneth69@usa.net>
@ 2004-01-10 00:51 ` Peter Eisentraut <peter_e@gmx.net>
2004-01-15 04:22 ` Re: ECPG and EXEC SQL GET DIAGNOSTICS kjw <kenneth69@usa.net>
0 siblings, 1 reply; 6+ messages in thread
From: Peter Eisentraut @ 2004-01-10 00:51 UTC (permalink / raw)
To: kjw <kenneth69@usa.net>; pgsql-interfaces
kjw wrote:
> I am currently thinking about porting
> Embedded esql/c code from informix to
> PostgreSQL. It there any plans on incorporating
> the "EXEC SQL GET DIAGNOSTICS" functionality?
It's already there. What is missing?
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ECPG and EXEC SQL GET DIAGNOSTICS
2004-01-10 00:31 ECPG and EXEC SQL GET DIAGNOSTICS kjw <kenneth69@usa.net>
2004-01-10 00:51 ` Re: ECPG and EXEC SQL GET DIAGNOSTICS Peter Eisentraut <peter_e@gmx.net>
@ 2004-01-15 04:22 ` kjw <kenneth69@usa.net>
2004-01-21 20:40 ` Re: ECPG and EXEC SQL GET DIAGNOSTICS Christof Petig <christof@petig-baender.de>
0 siblings, 1 reply; 6+ messages in thread
From: kjw @ 2004-01-15 04:22 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-interfaces; pg@fastcrypt.com
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 have attached test.pgc
Thanks to all,
ken
Peter Eisentraut wrote:
>kjw wrote:
>
>
>>I am currently thinking about porting
>>Embedded esql/c code from informix to
>>PostgreSQL. It there any plans on incorporating
>>the "EXEC SQL GET DIAGNOSTICS" functionality?
>>
>>
>
>It's already there. What is missing?
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>.
>
>
>
/*
* compiles using informix esql 9.2.1 compiler but does not compile
* using ecpg 3.1.0(PostgreSQL 7.4.1)
*/
int main (int argc, char **argv)
{
/* Declare host variables */
EXEC SQL BEGIN DECLARE SECTION;
char _ix_database_name[30];
int exception_count;
char _message[100];
EXEC SQL END DECLARE SECTION;
/* Connect to the database. */
EXEC SQL CONNECT TO 'test_db';
EXEC SQL get diagnostics :exception_count = NUMBER ;
/*
* The GET DIAGNOSTICS statement also returns information about the
* exceptions that the most-recently executed SQL statement has generated.
*/
EXEC SQL get diagnostics exception 1
:_message = MESSAGE_TEXT;
return (0);
}
Attachments:
[text/plain] test.pgc (691B, ../../4006159F.5000505@usa.net/2-test.pgc)
download | inline:
/*
* compiles using informix esql 9.2.1 compiler but does not compile
* using ecpg 3.1.0(PostgreSQL 7.4.1)
*/
int main (int argc, char **argv)
{
/* Declare host variables */
EXEC SQL BEGIN DECLARE SECTION;
char _ix_database_name[30];
int exception_count;
char _message[100];
EXEC SQL END DECLARE SECTION;
/* Connect to the database. */
EXEC SQL CONNECT TO 'test_db';
EXEC SQL get diagnostics :exception_count = NUMBER ;
/*
* The GET DIAGNOSTICS statement also returns information about the
* exceptions that the most-recently executed SQL statement has generated.
*/
EXEC SQL get diagnostics exception 1
:_message = MESSAGE_TEXT;
return (0);
}
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ECPG and EXEC SQL GET DIAGNOSTICS
2004-01-10 00:31 ECPG and EXEC SQL GET DIAGNOSTICS kjw <kenneth69@usa.net>
2004-01-10 00:51 ` Re: ECPG and EXEC SQL GET DIAGNOSTICS Peter Eisentraut <peter_e@gmx.net>
2004-01-15 04:22 ` Re: ECPG and EXEC SQL GET DIAGNOSTICS kjw <kenneth69@usa.net>
@ 2004-01-21 20:40 ` Christof Petig <christof@petig-baender.de>
0 siblings, 0 replies; 6+ messages in thread
From: Christof Petig @ 2004-01-21 20:40 UTC (permalink / raw)
To: kjw <kenneth69@usa.net>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-interfaces; pg@fastcrypt.com
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
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2004-01-21 20:40 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-01-09 23:27 ECPG and EXEC SQL GET DIAGNOSTICS kjw <kenneth69@usa.net>
2004-01-12 13:28 ` Dave Cramer <pg@fastcrypt.com>
2004-01-10 00:31 ECPG and EXEC SQL GET DIAGNOSTICS kjw <kenneth69@usa.net>
2004-01-10 00:51 ` Peter Eisentraut <peter_e@gmx.net>
2004-01-15 04:22 ` kjw <kenneth69@usa.net>
2004-01-21 20:40 ` Christof Petig <christof@petig-baender.de>
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