Subject Re: [ib-support] Delphi events and IB triggers
Author Helen Borrie
At 12:01 PM 27-01-02 +0100, you wrote:
>how do Delphi events coexist with IB triggers and constraints ?
>
>say I define a BeforeDelete event for table A:
>
>- will Delphi translate it into an IB trigger ?

No. Delphi has no way to know what is going on at the server.

>- if a trigger before delete is defined, which will be called first ?
>- the following constraint
>
>add constraint <constraint_name> foreign key (ParentID)
>references parent (ParentID)
>ON DELETE CASCADE

This tells the database engine that, when the master record identified by ParentID (sounds strange?? ParentID in a master record??) gets deleted, then all the related records in this table should be deleted too.

So any action defined in a Before Delete trigger in the child record will take place before the child record is deleted. This is unrelated to the BeforeDelete method in Delphi, which you would use for any processing you want the client to perform before the Delete() method of the dataset gets called.

>will call my BeforeDelete code ?

Delphi doesn't know about server constraints (other than Primary Key) and the server doesn't know about Delphi methods.

cheers,
Helen

All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________