From: Christoph Haller <ch@rodos.fzk.de>
To: pgsql-sql@postgresql.org
To: k.p.lehre@tiscali.no
Subject: Re: length of recordset read through a cursor
Date: Fri, 01 Aug 2003 13:25:00 +0200
Message-ID: <3F2A4E0C.AB433D8@rodos.fzk.de> (raw)
>
> After declaring a cursor, one way of obtaining the length of the
resultset
> is to perform a "MOVE 0" and read the PQcmdStatus which returns a
"MOVE nn"
> where nn is the length of the resultset. (A negative MOVE can then be
used
> to allow starting to fetch records from the beginning of the
resultset.)
>
> Is there another, possibly faster way?
>
Looks like you're using libpq (because you mention PQcmdStatus),
then after declaring a cursor and FETCH ALL, try
1.3.4. Retrieving SELECT Result Information
PQntuples Returns the number of tuples (rows) in the query result.
int PQntuples(const PGresult *res);
I'm not exactly sure what you're trying to achieve or going to do,
so if I misunderstood you, ask again.
Regards, Christoph
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ch@rodos.fzk.de, k.p.lehre@tiscali.no
Subject: Re: length of recordset read through a cursor
In-Reply-To: <3F2A4E0C.AB433D8@rodos.fzk.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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