Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi. I realize this may not be the right place to ask, as it's a mysql trigger related question.. but there's some perl here too! Please see if you can spot something silly here, as I am running out of ideas with this issue here.. here's what's up: it seems like the "after insert" trigger gets triggered before the values get inserted into the new row in table. here's my trigger:
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 "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:
[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]$
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

In reply to perl script & mysql after insert trigger by vxp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-16 20:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found