Thread: 8.1.1.0, VB6, RDO, rdoResultset.RowCount

8.1.1.0, VB6, RDO, rdoResultset.RowCount

From
Hélder M. Vieira
Date:
Hi.


I noticed a difference in behaviour in 8.1.1.0, related with the RowCount
property in RDO resultsets in VB6.
In version 7xxx, for some specific purposes, I used to open a resultset and
immediatly check RowCount.
For non-empty resultsets, at this point in time RowCount would be innacurate
but NOT EQUAL to 0, and based on this first evaluation I would proceed to
the next step, either assuming an empty set or forcing a move to the last
row to obtain a precise RowCount.
In version 8.1.1.0, RowCount always seems to be EQUAL to 0, unless I force a
move to the last row.
At this point, my problem is that I don't know which is the right
behaviour... Should I assume that in this and later versions of the driver
RowCount will always be EQUAL to 0 before visiting the last row ?


Thanks in advance.


Helder M. Vieira











Re: 8.1.1.0, VB6, RDO, rdoResultset.RowCount

From
Date:
hi there

this was discussed earlier today i think...

the recordset has an EOF (end of file) flag. if rs.EOF equals False, then
there are rows in the resultset.

cheers,
thomas

----- Original Message -----
From: "Hélder M. Vieira" <hmv@mail.telepac.pt>
To: <pgsql-odbc@postgresql.org>
Sent: Thursday, November 10, 2005 2:06 AM
Subject: [ODBC] 8.1.1.0, VB6, RDO, rdoResultset.RowCount


> Hi.
>
>
> I noticed a difference in behaviour in 8.1.1.0, related with the RowCount
> property in RDO resultsets in VB6.
> In version 7xxx, for some specific purposes, I used to open a resultset
> and immediatly check RowCount.
> For non-empty resultsets, at this point in time RowCount would be
> innacurate but NOT EQUAL to 0, and based on this first evaluation I would
> proceed to the next step, either assuming an empty set or forcing a move
> to the last row to obtain a precise RowCount.
> In version 8.1.1.0, RowCount always seems to be EQUAL to 0, unless I force
> a move to the last row.
> At this point, my problem is that I don't know which is the right
> behaviour... Should I assume that in this and later versions of the driver
> RowCount will always be EQUAL to 0 before visiting the last row ?
>
>
> Thanks in advance.
>
>
> Helder M. Vieira
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>



Re: 8.1.1.0, VB6, RDO, rdoResultset.RowCount

From
Hélder M. Vieira
Date:
> this was discussed earlier today i think...
>
> the recordset has an EOF (end of file) flag. if rs.EOF equals False, then
> there are rows in the resultset.


Thanks and yes, EOF is indeed a much cleaner way for early testing of a
potentially empty resultset.
But now I have another disturbing situation, that came up during EOF
tests...
If I have a non-empty resultset, traveling all the way (using MoveNext)
until EOF is found doesn't produce a valid RowCount.
Only a MoveLast seems to do the job.

I created a five rows / two columns table, opened a 'select *' resultset and
performed the following sequence:

   With ordoRs
      .MoveFirst
      While Not .EOF
         Debug.Print .rdoColumns("f1"), .rdoColumns("f2"), .RowCount ' <----
RowCount is always equal to 0
         .MoveNext
      Wend
      .MoveLast
      Debug.Print , , .RowCount ' <---- RowCount is correct
   End With

This seems somewhat dangerous to me, although I must say I never made a
similar test with any ODBC driver (as far as I can remember, I always used
MoveLast to get an accurate RowCount).


Helder M. Vieira



Re: 8.1.1.0, VB6, RDO, rdoResultset.RowCount

From
Date:
easy workaround:

   Dim lCount as Integer
   lCount = 0
   With ordoRs
      .MoveFirst
      While Not .EOF

          lCount = lCount + 1
         Debug.Print .rdoColumns("f1"), .rdoColumns("f2"), lCount
         .MoveNext
      Wend
   End With

i never used rowcount, not even when accessing other db-systems: rowcount is
not available for other resultset-modes like forwardonly..

cheers,
thomas

----- Original Message -----
From: "Hélder M. Vieira" <hmv@mail.telepac.pt>
To: <pgsql-odbc@postgresql.org>
Sent: Thursday, November 10, 2005 3:16 AM
Subject: Re: [ODBC] 8.1.1.0, VB6, RDO, rdoResultset.RowCount


>> this was discussed earlier today i think...
>>
>> the recordset has an EOF (end of file) flag. if rs.EOF equals False, then
>> there are rows in the resultset.
>
>
> Thanks and yes, EOF is indeed a much cleaner way for early testing of a
> potentially empty resultset.
> But now I have another disturbing situation, that came up during EOF
> tests...
> If I have a non-empty resultset, traveling all the way (using MoveNext)
> until EOF is found doesn't produce a valid RowCount.
> Only a MoveLast seems to do the job.
>
> I created a five rows / two columns table, opened a 'select *' resultset
> and
> performed the following sequence:
>
>   With ordoRs
>      .MoveFirst
>      While Not .EOF
>         Debug.Print .rdoColumns("f1"), .rdoColumns("f2"), .RowCount '
> <----  RowCount is always equal to 0
>         .MoveNext
>      Wend
>      .MoveLast
>      Debug.Print , , .RowCount ' <---- RowCount is correct
>   End With
>
> This seems somewhat dangerous to me, although I must say I never made a
> similar test with any ODBC driver (as far as I can remember, I always used
> MoveLast to get an accurate RowCount).
>
>
> Helder M. Vieira
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>