Triggers and Delphi 3.0
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Triggers, Constraints & Referential Integrity
Hi all, I'm using Informix On-line Dynamic 7.1 with Delphi 3.0 (ESQL/C 7.21) so almost everything is going smooth. But I can't find out how to use triggers and determine when the trigger is fired, so I can do some actions. That was all I was going to ask You. So if anyone know how to do this I'll be very happy to listen. Boris
Unlike stored procedures that you can manually execute, triggers are automatic. A trigger is fired before, after, for each row of an insert, delete, update of a table. It depends on the trigger that you've created. When no errors occur after the saving, deleting, or updating the rows, then you can be sure that the trigger is executed. You can do your actions in Delphi's AfterPost, AfterDelete, AfterUpdate event handlers. Hope this helps, Zandy In article <7au64m$8d9$1@news.xmission.com>, "bvolkan" <bvolkan@freemail.org.mk> wrote: > > Hi all, > > I'm using Informix On-line Dynamic 7.1 with Delphi 3.0 (ESQL/C 7.21) so almost everything > is going smooth. But I can't find out how to use triggers and determine when the trigger > is fired, so I can do some actions. That was all I was going to ask You. So if anyone know > how to do this I'll be very happy to listen. > > Boris > > -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Hi Boris,
here is an example for a trigger which i use:
create procedure ordnr_ins (vtyp char(3), vgruppe char(3), vls char(5))
update typtab set anzahl = anzahl + 1 where typ = vtyp;
update gruppetab set anzahl = anzahl + 1 where gruppe = vgruppe;
update lehrstuhltab set anzahl = anzahl + 1 where lehrstuhl = vls;end procedure;
create trigger ordnrins insert on ordnrtab referencing new as post for each row (executeprocedure ordnr_ins (post.typ, post.gruppe, post.lehrstuhl));
When a row is inserted into ordnrtab then i make an update on three other tables.
You could make an insert into a table when the trigger runs, and in your delphiprogram you can
look if there is an entry in the table. So you would know that the trigger has done its work.
Hans-Dieter Tewes
bvolkan schrieb:
> Hi all,
>
> I'm using Informix On-line Dynamic 7.1 with Delphi 3.0 (ESQL/C 7.21) so almost everything
> is going smooth. But I can't find out how to use triggers and determine when the trigger
> is fired, so I can do some actions. That was all I was going to ask You. So if anyone know
> how to do this I'll be very happy to listen.
>
> Boris