Subject Re: Do I need a master detail relationship in the server?
Author Marco Menardi
--- In IBObjects@yahoogroups.com, James Chua <james_027@t...> wrote:
> I have a master detail relationship in my application. I have been
> reading a lot ... and one of the feature I like and find it to be very
> nice is that the IBO automatically do a postretaining for your master
> dataset if you have inserted a detail dataset. Is this true even if the
> relationship is set only in IBO but not in FB?

Yes, IBO behaviour is a client-only, based upon the relation between
two IBO components (i.e. IB_Query) that are set in a master-detail
relation.

>
> What will I miss if I have set a master detail relationship in the IBO
> but not in the FB. Base on my experience I haven't encountered any
> problem at all. Since I dont delete master records where the cascading
> delete is a nice feature.

This is one of the best features of true client-server, or of a true
SQL server like FireBird (FB): referential integrity.
In my opinion, you should design the relations and the business logic
as much as you can in the server side, so you are sure that whatever
happens on the client side does not affect your data integrity.
You are telling that in that application, you are not deleting master
records, so you don't need cascade deleting. What about if someone
takes a FB manager, and manually deletes a master record? Your data
becomes inconsistent. What about if, in the future, you will use that
database and you will need to delete master records? Maybe your app.
deletes the master record and then crashes, or does not perform
correctly the detail cascading deltete...
The database should be an armour-plated box, where you know for sure
that whatever happends to your data from the client-side, does not
affect your data relation integrity, and does not break your business
rules. It's harder at the beginning (especially for people, like me,
that was used to "Paradox db" programming), but it's the best and
clever way. In the IBO site, you should find some tech sheets about
that, as far as I remember. Have a look at them.
regards
Marco Menardi