Re: VB6 and RowCount fix - Mailing list pgsql-odbc

From Hélder M. Vieira
Subject Re: VB6 and RowCount fix
Date
Msg-id 003201c60441$93d54210$580bfea9@hmv02
Whole thread Raw
In response to Re: VB6 and RowCount fix  ("Dave Page" <dpage@vale-housing.co.uk>)
List pgsql-odbc
> I think the question is how VB get RowCount value. It seems to me that
> VB counts it internaly from fetched rows.


From my past experience with VB and Access, I'd say that MS option was to
update RowCount in a passive way, depending on the program travel behaviour
and driver capabilities.
In the VB6 help information, MS isn't very clear:

- For RDO, it says 'RowCount doesn't indicate how many rows will be returned
by an rdoResultset query until all rows have been accessed. After all rows
have been accessed, the RowCount property reflects the total number of rows
in the rdoResultset. Referencing the RowCount property causes RDO to
fully-populate the result set - just as if you had executed a MoveLast
method.' ;

- For ADO, it says 'If the Recordset object supports approximate positioning
or bookmarks-that is, Supports (adApproxPosition) or Supports (adBookmark),
respectively, returns True-this value will be the exact number of records in
the Recordset regardless of whether it has been fully populated. If the
Recordset object does not support approximate positioning, this property may
be a significant drain on resources because all records will have to be
retrieved and counted to return an accurate RecordCount value.';

- For DAO, it says 'The RecordCount property doesn't indicate how many
records are contained in a dynaset-, snapshot-, or forward-only-type
Recordset object until all records have been accessed. Once the last record
has been accessed, the RecordCount property indicates the total number of
undeleted records in the Recordset or TableDef object. To force the last
record to be accessed, use the MoveLast method on the Recordset object. You
can also use an SQL Count function to determine the approximate number of
records your query will return'.

I never considered RowCount to be accurate before a MoveLast or a sequence
of MoveNext calls reaching EOF, because of the apparent DAO inconsistency.
(There was also another curious MS feature that I learned to live with and
later gave me some headaches when I began using PostgreSQL... After opening
some kind of non-empty recordset, RowCount would always be > 0, although not
necessarily accurate).

Considering the options, and in the absence of a formal rule, I'd be happy
with a documented behaviour like:

- After opening a recordset, EOF signals if the recordset is empty or not;
- RowCount always returns an accurate value, either because all rows have
been already accessed by MoveLast or a sequence of MoveNext calls reaching
EOF or because in the absence of that information RowCount actively fetches
ALL rows before returning.



Hélder M. Vieira






pgsql-odbc by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: psqlODBC 8.01.0105 Development snapshot
Next
From: "Eugene Fokin"
Date:
Subject: Re: [ psqlodbc-Bugs-1000476 ] DateStyle and Transaction