Unix Technical Forum

RE: triggers

This is a discussion on RE: triggers within the Informix forums, part of the Database Server Software category; --> after the unload in your procedure add: system "cat update-file >>update-file.append" Regards, Bill > -----Original Message----- > From: owner-informix-list@iiug.org ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 08:31 AM
Bill Dare
 
Posts: n/a
Default RE: triggers


after the unload in your procedure add:

system "cat update-file >>update-file.append"

Regards,
Bill


> -----Original Message-----
> From: owner-informix-list@iiug.org [SMTPwner-informix-list@iiug.org]
> On Behalf Of christrier
> Sent: Tuesday, June 07, 2005 7:41 AM
> To: informix-list@iiug.org
> Subject: triggers
>
> I want to create some triggers for my database, one on-update trigger,
> an on-insert trigger and an on-delete trigger.
> I've already read the manual about how to create triggers.
>
> My problem is: I want to write the rows that are effected into a file
> outside the database.
> pseudocode:
> on update unload TO 'update-file' select 'the updated row'
>
> I know that unload overrides the file, maybe it would be possible to
> append everything in one file?!
>
> but i hope my problem is described clear enough?!
>
> greetings
> chris
>


sending to informix-list
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 08:32 AM
christrier
 
Posts: n/a
Default Re: triggers

you mean it is possible to write it exactly like this:
CREATE TRIGGER before_trig
INSERT ON table1 REFERENCING NEW AS new
FOR EACH ROW
(
UNLOAD TO 'file' VALUES (new.col1, new.col2, new.col3, ...,
new.coln)
system "cat file >> file.append"
);
?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 08:33 AM
Jonathan Leffler
 
Posts: n/a
Default Re: triggers

christrier wrote:
> you mean it is possible to write it exactly like this:
> CREATE TRIGGER before_trig
> INSERT ON table1 REFERENCING NEW AS new
> FOR EACH ROW
> (
> UNLOAD TO 'file' VALUES (new.col1, new.col2, new.col3, ...,
> new.coln)
> system "cat file >> file.append"
> );
> ?


No - any trigger that tries to include UNLOAD is going to fail, as Art
already said!

If you want to do it, you'll probably need a C code UDR (not running on
a CPU VP - but on a user-defined VP class) to do it. You could consider
using a Java UDR instead - probably.


--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2005.01 -- http://dbi.perl.org/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:09 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com