Re:Using TField, TFieldDefs, TDataSet for developing special data access components (Trees, Nets, Many-to-Mant)
In article <4f49mt$...@news.smart.net>,
royt...@smart.net (Alex Roytman) wrote:
Quote
>Hello
>I am developing special classes (I hope I will be able to make it as several
components) logically
Quote
>it should be some kind of DataSet but with special logic.
>For example if your table has field 'ID' and another field 'Parent'
references 'ID' than you have Tree and
Quote
>you can build some special data processing (GetParentRecord, GetChildRecords,
>MoveBranch, DeleteBranch , aggregate function to calculate something
associated with Tree nodes,
Quote
>data inheritance etc.)
> To do this I need to work with TFieldDefs, TFieldDef, TField, TDataSet
because I know nothing about real
Quote
>data which will be processed using my class, I know only what algorithms I
should implement (for example to
Quote
>do aggregate function sum(ParentID) I need recursive function to check all
child records).
>So my questions are :
> - Where I can get detailed description of these classes.
> - I use parameters in my Query and every time I need to change parameter I
have to Close query and open it again
Quote
> It looks like Delphi create TField every time you execute TDataSet.Open
and destroy them on TDataSet.Close
Quote
> so all references I get with DataSet.FieldByName become invalid after
TDataSet.Close and I have to execute
Quote
> DataSet.FieldByName again. (Also I use Field[Index] property and I set
number for Index just once when
Quote
> I open Query first time).
> ? Any better solution? Can I tell Delphi not to destroy TField on each
Close-Open ?
> - When you put data control on my form Delphi add TField into TForm and
when it open form at run time
Quote
> instead creating TFields dynamically it should initialize TFieldDefs with
Tfields from my form and also
Quote
> in this case Delphi should not destroy TFielsds on each Open-Close. How
does Delphi do it?
>I have a lots of questions so probably I just need good manual or advise.
>I will really appreciate any help and invite everybody who interested
>in writing such type of components to discuss this problem
>Alex Roytman
>royt...@smart.net
Sounds like you need to get the VCL source and have a good look through.
Andrew Cooke.
----------------------------------------------------------------------
Disclaimer: The above is a personal opinion and does not reflect the
official view of AgResearch Ltd.
----------------------------------------------------------------------