Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-05

About TDataSet master/detail design in fpc

11 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luiz Américo

I noticed that in the current cvs of fpc it's implemented the master/detail relation between TDataset(s).
I saw that TDetailDataLink and TMasterDataLink was introduced but I couldn't figure how is supposed to work. I also noticed the abscense of NestedDatasets and DataSetField properties.

I'd be glad if someone could explain how the design works and what is expected from a TDataset descendant that support it. I'll try to implement it in TSqliteDataSet.

Thanks in advance.

Luiz

Reply by email

Michael Van Canneyt
to Luiz Américo
Luiz Américo wrote 5 lines
I noticed that in the current cvs of fpc it's implemented the master/detail relation between TDataset(s). I saw that TDetailDataLink and TMasterDataLink was introduced but I couldn't figure how is supposed to work. I also noticed the abscense of NestedDatasets and DataSetField properties.

They are not yet implemented. But NestedDataset and DatasetField are ONLY for TClientDataset, and we don't support TClientDataset (yet).

I'd be glad if someone could explain how the design works and what is expected from a TDataset descendant that support it.

Nothing is expected, i.e. TDataset does not implement anything concerning master/detail. How could it ?

I'll try to implement it in TSqliteDataSet.

What you must do is

1. Implement parameter support (TParams/TParam is present).

2. Introduce a Datasource property. Whenever the Datasource changes it's data, the detail dataset most close, fill in new parameters, and reopen.

2 is not a problem, this is max 50 lines of code. 1 is the problem.

Michael.

Reply by email

Uberto Barbini
to Michael Van Canneyt
They are not yet implemented. But NestedDataset and DatasetField are ONLY for TClientDataset, and we don't support TClientDataset (yet).

Not only, they were first implemented for Oracle object field and they're used by some other custom implementation, for example InstantObject exposers use them for accessing parts (subobjects).

I began to rewrite something similar for fpc some week ago, I hope to continue soon.

Show quoted text 5 lines
> I'd be glad if someone could explain how the design works and what is > expected from a TDataset descendant that support it. Nothing is expected, i.e. TDataset does not implement anything concerning master/detail. How could it ?

Not yet that is.
With NestedDataset in Delphi you could.

> I'll try to implement it in TSqliteDataSet.

We could collaborate. Maybe you could create a Sqllite broker for InstantObject (http://www.instantobjects.org/) too. Just now the core part of InstantObject (i.e. without presentation) works in fpc.

Bye Uberto

Reply by email

Luiz Américo
to Michael Van Canneyt: They are not yet implemented. But NestedDataset and DatasetField are ONLY for…
Michael Van Canneyt wrote 12 lines
On Fri, 6 May 2005, Luiz Américo wrote: > I noticed that in the current cvs of fpc it's implemented the > master/detail relation between TDataset(s). > I saw that TDetailDataLink and TMasterDataLink was introduced but I > couldn't figure how is supposed to work. I also noticed the abscense > of NestedDatasets and DataSetField properties. They are not yet implemented.

So none of the current TDataset descendants works with Master/Detail schema ?
If some works, can anybody send me a example?

But NestedDataset and DatasetField are ONLY for TClientDataset, and we don't support TClientDataset (yet).

At least TDataset class in Delphi 7 has both properties.

Show quoted text 11 lines
What you must do is 1. Implement parameter support (TParams/TParam is present). 2. Introduce a Datasource property. Whenever the Datasource changes it's data, the detail dataset most close, fill in new parameters, and reopen. 2 is not a problem, this is max 50 lines of code. 1 is the problem.

I'll take a look.
Thanks.

Luiz.

Reply by email

Alexandrov Alexandru
to Luiz Américo: So none of the current TDataset descendants works with Master/Detail schema ? If some…
Luiz Américo wrote 17 lines
Michael Van Canneyt wrote: > > > On Fri, 6 May 2005, Luiz Américo wrote: > >> I noticed that in the current cvs of fpc it's implemented the >> master/detail relation between TDataset(s). >> I saw that TDetailDataLink and TMasterDataLink was introduced but I >> couldn't figure how is supposed to work. I also noticed the abscense >> of NestedDatasets and DataSetField properties. > > > They are not yet implemented. So none of the current TDataset descendants works with Master/Detail schema ? If some works, can anybody send me a example?

MasterDetail works, and you don't need NestedDatasets or DataSetFields for that.

1. Put a Master dataset and a Datasource on a form, connect them and fill the properties.
2. Put a Detail dataset and a Datasource and connect them.
3. In Detail dataset set 3 properties: Index, Master dataset, and Master fields.
That's all

Alex

Reply by email

Michael Van Canneyt
to Uberto Barbini: Not only, they were first implemented for Oracle object field and they're used by some…
Uberto Barbini wrote 6 lines
> They are not yet implemented. But NestedDataset and DatasetField are > ONLY for TClientDataset, and we don't support TClientDataset (yet). Not only, they were first implemented for Oracle object field and they're used by some other custom implementation, for example InstantObject exposers use them for accessing parts (subobjects).

Then how does TDataset know how to load itself from a TDatasetField ? There is no code in DB.Pas to do this.

In TClientDataset, it's just a blob with a complete data package in it, but the definition of this packages only makes sense to another TClientDataset.

TDatasetProvider has a mechanism to pack a 'traditional' Master/Detail dataset (e.g. using TQuery) into a TClientDataset packet for the Master with a TDatasetField containing the data from the detail dataset...

A horrible mechanism, but it works more or less.

Show quoted text 11 lines
I began to rewrite something similar for fpc some week ago, I hope to continue soon. > > I'd be glad if someone could explain how the design works and what is > > expected from a TDataset descendant that support it. > > Nothing is expected, i.e. TDataset does not implement anything > concerning master/detail. How could it ? Not yet that is. With NestedDataset in Delphi you could.

Yes, but TNestedDataset is a BDE implementation.
It uses a proprietary format.

The bottom line is that at the TDataset level, there exists only TDatasetField. You need to create a descendent of TDataset to access the data in a TDatasetField, and TClientDataset or TNestedDataset are standard Delphi TDatasets which do this.

Michael.

Reply by email

Luiz Américo
to Alexandrov Alexandru: MasterDetail works, and you don't need NestedDatasets or DataSetFields for that. 1. Put a…
Alexandrov Alexandru wrote 15 lines
> > So none of the current TDataset descendants works with Master/Detail >schema ? >If some works, can anybody send me a example? MasterDetail works, and you don't need NestedDatasets or DataSetFields for that. 1. Put a Master dataset and a Datasource on a form, connect them and fill the properties. 2. Put a Detail dataset and a Datasource and connect them. 3. In Detail dataset set 3 properties: Index, Master dataset, and Master fields. That's all

Thank you. It seems that you refering to TDbf which is the only that has these properties.

Luiz

Reply by email

Heinz Hombergs
to Luiz Américo
Luiz Américo wrote
Thank you. It seems that you refering to TDbf which is the only that has these properties.

Not really.
The Zeos components have this properties too. ;)

Microsoft Zen - Become one with the blue screen. -- From a Slashdot.org post

Reply by email