Обсуждение: Info about number of tuples if not use FETCH ALL

Поиск
Список
Период
Сортировка

Info about number of tuples if not use FETCH ALL

От
"Yusron Hilmy"
Дата:
How to get number of tuples if after DECLARE CURSOR, I use FETCH NEXT (not
FETCH ALL) ?
PQntuples only work well if I use FETCH ALL.

Yusron



Re: Info about number of tuples if not use FETCH ALL

От
Martijn van Oosterhout
Дата:
On Mon, Aug 13, 2001 at 04:54:07PM +0700, Yusron Hilmy wrote:
> How to get number of tuples if after DECLARE CURSOR, I use FETCH NEXT (not
> FETCH ALL) ?
> PQntuples only work well if I use FETCH ALL.

You can't. The whole purpose of cursors is so that you don't have to wait
for the entire query to complete to get some results. Obviously, to get the
total number of tuples the whole query needs to be run, hence the FETCH ALL.

Do you really need to know the number of tuples beforehand, or is it ok to
wait till the end?

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> It would be nice if someone came up with a certification system that
> actually separated those who can barely regurgitate what they crammed over
> the last few weeks from those who command secret ninja networking powers.