vxp has asked for the wisdom of the Perl Monks concerning the following question:
the "deadweight" is just that: a deadweight shell script that adds 20 (!) seconds to the execution via sleep, then executes a perl script that queries that new row, the one that triggered the trigger/deadweight, for values:DELIMITER $$ CREATE TRIGGER `new_email` AFTER INSERT ON `dbmail_subjectfield` FOR EACH ROW BEGIN SET @exec_var = sys_exec(CONCAT('/bin/sh /home/vxp/veng/bin/deadweight + ', NEW.id)); END; $$ DELIMITER ;
the sequence of events is thus as follows: 1. a new row gets inserted, which triggers deadweight and passes the ID of the new record to it 2. deadweight sleeps for 20 seconds, and calls a perl script that queries that ID for values 3. perl script gets 0 rows. if I query that new row manually (as in, not via the trigger), by just executing my perl script and passing it the new row's id, I get results, not 0 rows. what's the deal here? how do I trigger my script AFTER the values have been successfully inserted into the new row? Any help highly appreciated[vxp@vader bin]$ cat deadweight #!/bin/sh echo `date` >> /home/vxp/veng/deadweight.log echo "Sleeping for 20 seconds" >> /home/vxp/veng/deadweight.log sleep 20 echo `date` >> /home/vxp/veng/deadweight.log echo "executing /home/vxp/veng/bin/email_retrieve.pl $1" >> /home/vxp/ +veng/deadweight.log /home/vxp/veng/bin/email_retrieve.pl $1 [vxp@vader bin]$
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl script & mysql after insert trigger
by Illuminatus (Curate) on Nov 26, 2010 at 23:13 UTC | |
by vxp (Pilgrim) on Nov 27, 2010 at 17:35 UTC | |
|
Re: perl script & mysql after insert trigger
by pajout (Curate) on Nov 27, 2010 at 09:49 UTC |