C/C++ interface - Mailing list pgsql-sql

From Volker Paul
Subject C/C++ interface
Date
Msg-id 3A892433.879F40A0@dohle.com
Whole thread Raw
Responses Re: C/C++ interface  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: C/C++ interface  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-sql
Hello,

in the C interface documentation there is an example using:
   res = PQexec(conn, "DECLARE mycursor CURSOR FOR select * from
pg_database");   if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)   {       fprintf(stderr, "DECLARE CURSOR command
failed\n");      PQclear(res);       exit_nicely(conn);   }   PQclear(res);   res = PQexec(conn, "FETCH ALL in
mycursor");

...etc. So the statements are:

DECLARE mycursor CURSOR FOR select * from pg_database;
FETCH ALL in mycursor;

What's the difference between this and simply doing:
select * from pg_database;

I tried this in psql, the result seemed the same.

What I'm really using, however, is the C++ interface.
Its documentation is not yet complete.
There, too, I tried a version with and without cursor.
The result seems to be the same, but returned int is always 0
for the version without cursor, so I get no information whether
the query succeeded. 

Is someone maintaining the C++ interface and its documentation?


Thanks,

Volker Paul


pgsql-sql by date:

Previous
From: "guard"
Date:
Subject: how to select * from database1 table,database2 table
Next
From: "Richard Huxton"
Date:
Subject: Re: how to select * from database1 table,database2 table