You have DBI access to the table and you want to have a subroutine that you have written called whenever a new record is inserted into the table.
You're facing a couple of immovable objects here.
First, DBI/DBD is fundamentally request-response. There's no facility for asynchronous notifications.
Second, MySQL doesn't have stored procedures. You are, however, free to invest time and effort adding them, but it's not a trivial project.
Third, unless you're able to add a notification layer between the database and clients who are adding data, you're going to have to poll, and efficient polling is going to require either a unique ID field or a timestamp on the table, so that can avoid a full linear scan time you poll.
Bottom line: If the requirements are non-negotiable, walk away from this one.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.