Re: number of rows returned by a query

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Konstantin Izmailov <pgfizm(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: number of rows returned by a query
Date: 2010-12-02 10:49:46
Message-ID: AANLkTim53H1s+Sf=O7wxuTE8FETgoj8xt=X_WJa5T5uN@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey Konstantin,

Use MOVE ALL, then PQcmdTuples to get number of rows,
then MOVE BACKWARD ALL to point cursor at initial position.

2010/12/2 Konstantin Izmailov <pgfizm(at)gmail(dot)com>

> Maybe this question was discussed previously, but I could not find an
> answer:
>
> An application used PQntuples function to obtain number of tuples after
> executing each query. Since number of rows increased we decided to use
> DECLARE CURSOR/FETCH commands to retrieve tuples. However, it seems that
> number of the tuples is not available after DECLARE CURSOR command. We want
> to minimize the changes in the app. *Is it possible to obtain number of
> rows that a cursor will return?*
>
> Thank you
> Konstantin
>
>
>

--
// Dmitriy.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Radosław Smogura 2010-12-02 11:22:20 Re: [GENERAL] How to recover a postgres installation from files
Previous Message franrtorres77 2010-12-02 09:48:48 mysql query to postgres Timediff