Use of "Fields Editor", Detaildatas per join or "Fields ed."

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
norwegen60
Posts: 19
Joined: Wed 15 Dec 2010 13:12

Use of "Fields Editor", Detaildatas per join or "Fields ed."

Post by norwegen60 » Mon 21 Feb 2011 09:32

Hello together,

I changed from ADO to UniDac and have now some general questions.

Is there a performance advantage/disadvantage by using the "Fields Editor". I can

Code: Select all

select * from table
and select some columns with the Fields Editor and have acces to the datas with

Code: Select all

TableNo.Value = 'test';
or

Code: Select all

select ID, No, Name from table
and get acces with

Code: Select all

Table.fieldByname('No').Value='test'
without using the "fields editor". What is more efficient

Which is the faster way to show Detaildatas

Code: Select all

select D.ID, D.No, S.Adress
from Table1 D 
left outer join Table2 S on S.ID=D.SupplierID
or to define a fkLookUp-field in "Fields Editor" under use of a second UniQuery as LookupDataset.

At the time I use only MsSQL but for the future it is also planed to use MySQL and Firebird

best regrads
Gerd

AndreyZ

Post by AndreyZ » Mon 21 Feb 2011 13:11

Hello,

You can use persistent fields in both cases, but more efficient way is to use this code

Code: Select all

select ID, No, Name from table
because in this case only needed data is fetched from the server. In this case you can get more performance if you use the following code to access data:

Code: Select all

Table.Fields[1].AsString := 'test';
The faster way to show master/detail data is to use the code, because in this case the query is executed once. When you establish master/detail relationship with two Query components, detail dataset performs query each time a record is selected in the master dataset.

norwegen60
Posts: 19
Joined: Wed 15 Dec 2010 13:12

Post by norwegen60 » Mon 21 Feb 2011 13:42

Many thanks for the fast feedback.

I forgot to ask espacialy for the third way

Code: Select all

select ID, No, Name from table
and "Fields Editor" with later acces over

Code: Select all

TableNo.AsString := 'test';
With master/detail I thought this, but I wasn't shure if there isn't a special handling in the component

Thanks Gerd

AndreyZ

Post by AndreyZ » Mon 21 Feb 2011 15:38

You can use two approaches:
1) without persistent fields and using the following code: Table.Fields[1].AsString := 'test';
2) with persistent fields and using the following code: TableNo.AsString := 'test';
The performance will be the same in both cases.

Post Reply