Page 1 of 1

Unidirection=true makes First not at first

Posted: Tue 15 May 2012 14:12
by applespring
Hello

ODAC v8.1.6+Delphi2006+WinXP

I found for TOraQuery, if Unidirection is set to true, then a call to First will not return to the real First record.

To reproduce this:

1. Make a TOraQuery to open, say 2100 records.
2. Close this TOraQuery
3. Set Unidirection=True; FetchAll:=False; FetchRows:=1000;
4. Open this TOraQuery
5. Call a while-loop to the end of this TOraQuery
6. Checking that TOraQuery.RecNo, it is the last record
7. Call TOraQuery.First
8. Checking thaat TOraQuery.RecNo, you can see that it is only 1000 record backwards, not at the real beginning of the dataset.

Please kindly check it.

Re: Unidirection=true makes First not at first

Posted: Tue 15 May 2012 16:06
by AlexP
Hello,

This is a correct behaviour, since the Unidirection mode means using of a unidirectional DataSet, i.e. there are only those records stored in DataSet that were retrieved in the last fetch operation (the records number equals the FetchRows value), and you can move cursor up only in limits of the current records. All records read earlier are replaced by the new ones, and there is no access to them

Re: Unidirection=true makes First not at first

Posted: Wed 16 May 2012 01:23
by applespring
Hello

I think I have different opinions on this behavior.

As your document describes in Unidirectional property:

"Traditionally SQL cursors are unidirectional. They can travel only forward through a dataset. TCustomDADataset, however, permits bidirectional travelling by caching records. If an application does not need bidirectional access to the records in the result set, set UniDirectional to True. "

This implies that when we set Unidirectional to true, we can only travel forward by a call to Next without need to caching records which have already been read.

As derived from TDataSet, the same behavior such as First, Next, EOF should be kept as the same as before, otherwise, this will cause very headache problem.

In the real case, we are extending one of our data-mining application interface to support Oracle by using ODAC, and this interface all the database objects will be passed as a TDataSet, and inside it, it will be First, Next, EOF called.

And this different behavior of First have trapped us greatly because we never expect so.

Re: Unidirection=true makes First not at first

Posted: Wed 16 May 2012 13:17
by AlexP
Hello,

In BDE the UniDirection option works only in case of using native Oracle driver. If you are using ODBC driver, the cursor will be bidirectional independently on this option value. When attempting to use the First, Prior, etc. methods (backward move), while the UniDirection option is enabled, and the native driver is used, you will get an error message. We have fixed this behaviour - when attempting to use these methods in our DataSets, you can move through the current DataSet with no errors.

Re: Unidirection=true makes First not at first

Posted: Thu 17 May 2012 07:54
by applespring
Hello

I am using ODBC with Direct mode.

So it means a call to First to TOraQuery in case Uniditional=true will not move to the real beginning of the database but only the beginning of the "fetched" result?

Am I right?

Re: Unidirection=true makes First not at first

Posted: Thu 17 May 2012 11:07
by AlexP
Hello,

Yes, you are right. Our components behave exactly in such way in the Unidirectional mode - moving upward is possible only in the limits of the current fetched data.