Page 1 of 1

TOraDataSet bug?

Posted: Tue 17 Oct 2006 08:41
by Phobos
Greetings,

we need to use LOBs in our application but none of our providers work properly.
That is why we are discussing the purchase of ODAC.

BUT
there seem to be some problems.
Like with TOraDataSet and all derived classes (TOraQuery, TOraSmartQuery, ...) or maybe we haven't set it right.

1) DataSet.Fields.CurValue does not work (ADOdataset works), we would have to replace all occurences of .CurValue to .Value which may cause problems because we use connection to multiple databases (Oracle, MsSql, Interbase, ...) in our application.
- This property is implemented in ClientDataSet (ADO and DBEX DataSets both implement this property).

2) DataSet.RecordCount property does not work properly. Maybe because of some performance tuning?
- RecordCount only returns number of the first 25 records. When you access the 26th record (eg. by DataSet.Next function) then it returns another 25 records' count (=> 50). We would have to walk through all dataset records (till EOF) to actually get the correct RecordCount.
- edit: or by accessing the last field with DataSet.Last.
- Is it a bug or is it possible to bypass this somehow?

We cannot simply replace these functions/properties with different ones because we need the compatibility with other providers.
Our application is large (source code files' size is over 60MB).

Thank you in advance.

Code: Select all

ODAC 5.80.036 Trial
OCI: Version 9.2.0.1.0
DB: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production

RecordCount property.

Posted: Tue 17 Oct 2006 10:15
by herbert
Delphi TDataSet.RecordCount == -1 at any time.
ODAC TOraQuery.RecordCount == SELECT Count(*).

Re: RecordCount property.

Posted: Tue 17 Oct 2006 10:45
by Phobos
herbert wrote:Delphi TDataSet.RecordCount == -1 at any time.
Correct, this is also written in help. Derived classes implement this property themselves. If it were not true you would be getting -1 instead of 25.
herbert wrote:ODAC TOraQuery.RecordCount == SELECT Count(*).
If it were true, i would not have a problem.
If it is meant as value assignment then you should know that RecordCount is readonly property.
This equation is correct for TAdoDataset or TClientDataset but not for TOraDataSet.
I have a view: select count(*) from view returns 6052.
TOraDataSet.RecordCount returns 25;
When you go to rownum 25 and do OraDataSet.Next then TOraDataSet.RecordCount returns 50;
When you go to rownum 50 and do OraDataSet.Next then TOraDataSet.RecordCount returns 75;
...
And finally when you do OraDataSet.Last,
TOraDataSet.RecordCount returns 6052;

I guess TOraDataSet only returns blocks (block size being 25) of records for performance reasons.

Posted: Tue 17 Oct 2006 13:30
by Challenger
We have performed some tests and found out that TADODataSet behavior is not coordinated with the behavior described in Delphi help concerning TField.CurValue. Please specify why do you use CurValue property instead of OldValue.

By default RecordCount property shows the number of fetched records. If you set QueryRecCount property to True then additional query is performed to get record count for this SELECT. So, RecordCount property shows actual number of records.

TOraQuery RecordCount.

Posted: Tue 17 Oct 2006 13:32
by herbert
May be you forget set TOraQuery->FetchAll = true.

TOraDataset

Posted: Tue 17 Oct 2006 14:37
by Phobos
challenger wrote:We have performed some tests and found out that TADODataSet behavior is not coordinated with the behavior described in Delphi help concerning TField.CurValue. Please specify why do you use CurValue property instead of OldValue.
Our application is being developed since the year 2000. I have no idea why someone used the CurValue. I guess we can use .Value that both ADO and Ora datasets implement.
edit: i was talking about standard Delphi 7 ADO DataSet.
challenger wrote: By default RecordCount property shows the number of fetched records. If you set QueryRecCount property to True then additional query is performed to get record count for this SELECT. So, RecordCount property shows actual number of records.
Thank you very much! This is exactly what i was looking for.

Re: TOraQuery RecordCount.

Posted: Tue 17 Oct 2006 14:38
by Phobos
herbert wrote:May be you forget set TOraQuery->FetchAll = true.
That is another approach. Thank you.
I guess the QueryRecCount approach will perform faster in certain scenarios...