Weird results using TOraDataSet

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jim.eckels
Posts: 6
Joined: Tue 28 Jan 2014 23:15

Weird results using TOraDataSet

Post by jim.eckels » Tue 28 Jan 2014 23:32

I am new to the forums, as we just purchased a license of this library. It is replacement of another library; and these are remarkably similar in their API.

In doing this replacement, everything has gone very smoothly. I have run into an issue with retrieving data using a query.

Environment is 9.5.2 library. 64 bit executable being built. I create one session per application thread.

Here is the session object.

Code: Select all

  FConnection := TOraSession.Create(Nil);
  FConnection.LoginPrompt := False;
  FConnection.ConnectPrompt := False;
  FConnection.ThreadSafety := True;
  FConnection.Options.StatementCache := False; // I do my own caching
  FConnection.HomeName := 'OraDb11g_home1';
  FConnection.AutoCommit := False;
Connecting has no issues.

I create one query. Each thread is linear. Thread A and B have no need to know anything about what they are doing from a database/query perspective.

Here is the query object (using TOraDataSet).

Code: Select all

  FQuery := TOraDataSet.Create(FSession);
  FQuery.ParamCheck := False;
  FQuery.DisableControls;
  FQuery.Session := FSession;
  FQuery.ReadOnly := True;
  FQuery.Unidirectional := True; // is this a problem?
  FQuery.FetchRows := 100;
  FQuery.FetchAll := False; // Does this fetch nothing, or fetch only the FetchRows count.  It could be the problem, but I cannot FetchALl if it really means all results from the query.
  FQuery.AutoCalcFields := False; 
If I use FQuery.Options.ScrollableCursor := true, Oracle throws an error (ORA-24338: statement handle not executed". If I do not use that .. I get no data returned at all.

What's really weird is that one query appears to work (its a select, with 1 row expected), and another subsequent query (with multiple rows expected) does not.

Is there any guidance to help me get over this problem?

Perhaps taking a different approach, is there a example of using the library 100% non-visually (everything being created dynamically via .Create)??

Thanks, in advance, for your help.

jim.eckels
Posts: 6
Joined: Tue 28 Jan 2014 23:15

Re: Weird results using TOraDataSet

Post by jim.eckels » Wed 29 Jan 2014 17:07

The issue with the retrieval has been resolved. It was definitely related to ..

Code: Select all

        FQuery.Options.ScrollableCursor := True;
        FQuery.OptionsDS.ScrollableCursor := True;
Turning these off, but leaving unidirectional := True allows it at least execute without issues.

This still leaves the question about the proper use of FetchAll := False and FetchRows, so that opening a query will not auto-retrieve everything, only the FetchRows number of rows.

I have it set to FetchAll := True, because it doesn't work otherwise.

jim.eckels
Posts: 6
Joined: Tue 28 Jan 2014 23:15

Re: Weird results using TOraDataSet

Post by jim.eckels » Fri 31 Jan 2014 01:47

You can close this.

There is still a separate issue, and I will create a thread for it .. asking for feedback/ideas on how to resolve.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Weird results using TOraDataSet

Post by AlexP » Wed 07 May 2014 12:50

Hello,

Please create a small sample demonstrating the problem and send it to alexp*devart*com.

Post Reply