unidac expression field

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

unidac expression field

Post by albourgz » Wed 30 Nov 2016 12:34

Unidac 6.4.16, c++ builder xe10 seattle pro, vcl win32. Connected to oracle.
Qgetseq is a TUniQuery *.
QgetseqF is a TField *.

Code: Select all

Qgetseq->SQL->Text="SELECT theseq.nextval as seq from dual";
if (!Qgetseq->Prepared) {
        Qgetseq->Prepare();
        QgetseqF=Qgetseq->Fields->Fields[0];
}
I get an exception on QgetseqF=Qgetseq->Fields->Fields[0];
This is due to the fact it is a sequence: if sql->Text is

Code: Select all

SELECT  SUM(todo*Multiplicity) as tottodo, SUM(done*Multiplicity) as totdone
FROM BatchState
WHERE IDGroup=:1
then I can use QgetseqF=Qgetseq->Fields->Fields[0];

Any hint?

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

Re: unidac expression field

Post by AlexP » Fri 02 Dec 2016 10:39

Both queries lead to an error in UniDAC, as well as in other components

albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

Re: unidac expression field

Post by albourgz » Fri 02 Dec 2016 13:21

Sorry, but problem seems to be a regression between unidac 6.4.15 and unidac 6.4.16.
In 6.4.15, this worked:

Code: Select all

GetBatchGroupCounts->Prepare();
TField *f1=GetBatchGroupCounts->FieldByName("TOTTODO");
TField *f2=GetBatchGroupCounts->FieldByName("TOTDONE");
After Prepare() in 6.4.15, the fields array was filled in by Prepare() and FieldByName worked.
After Prepare() in 6.4.16, the fields array is empty (GetBatchGroupCounts->Fields->Count=0) and FieldByName raises an exception!!!! Fields Array is now filled in only after open.

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

Re: unidac expression field

Post by AlexP » Mon 05 Dec 2016 12:44

The behavior is similar in both versions, maybe you created the Persistent fields in Design time or Dataset was already opened. Please send a full sample to support*devart*com where after calling prepare no error occurs when accessing fields

Post Reply