FW: Libpq and the SQL RETURNING clause

From: <Georges(dot)Brefort(at)sanofi-aventis(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: FW: Libpq and the SQL RETURNING clause
Date: 2008-08-27 14:28:29
Message-ID: AC1B5B770E3FD54A94DED61FA96B12C3C9F196@CLPW44.f2.enterprise
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

________________________________

From: Brefort, Georges R&D/FR
Sent: Tuesday, August 26, 2008 2:41 PM
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Libpq and the SQL RETURNING clause

Dear Postgres specialist,

1 Assume you have a table such as the following:

CREATE TABLE example( id SERIAL, someData VARCHAR(32) );

2 Now, you use a SQL statement to insert the data and get the the id
value back:

INSERT INTO example( someData ) VALUES( 'BlaBlaBla' ) RETURNING id;

I wonder if it is possible to retrieve the value of the id field in an
application using the C libpq library.

I pretty much understand how to bind data with the libpq, or how to
retrieve result sets from a SELECT SQL statement, but not how to
retrieve data from that RETURNING clause. (I have many years of practice
of the RETURNING clause in the ORACLE C library, but that is not the
point here).

Thank you very much for your help and your patience.
With my best regards.

Georges BREFORT

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Keary Suska 2008-08-27 23:31:57 Re: FW: Libpq and the SQL RETURNING clause
Previous Message Jeroen Vermeulen 2008-08-22 20:51:32 Re: Where can I get the LIBPQ++