Re: C/C++ interface

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Volker Paul <vpaul(at)dohle(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: C/C++ interface
Date: 2001-02-13 14:56:27
Message-ID: 200102131456.JAA24367@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-sql

Cursors and standard queries are pretty much the same, except the cursor
can control the rows returned.

> 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
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2001-02-13 15:02:02 Re: C/C++ interface
Previous Message Peter T Mount 2001-02-13 13:57:32 Re: Problem in downloading

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-02-13 15:02:02 Re: C/C++ interface
Previous Message Somashekharayya V H 2001-02-13 12:40:53 Inserting BLOB