Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46] (may be forged)) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1DEw2x85233 for ; Tue, 13 Feb 2001 09:58:02 -0500 (EST) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id JAA24367; Tue, 13 Feb 2001 09:56:27 -0500 (EST) From: Bruce Momjian Message-Id: <200102131456.JAA24367@candle.pha.pa.us> Subject: Re: C/C++ interface In-Reply-To: <3A892433.879F40A0@dohle.com> "from Volker Paul at Feb 13, 2001 01:10:27 pm" To: Volker Paul Date: Tue, 13 Feb 2001 09:56:27 -0500 (EST) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL77 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200102/248 X-Sequence-Number: 1439 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@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026