I have any interesting problem. I need to add a degree of fault tolerance to a program that monitors device activity, and updates database tables when there are certain changes. Currently, when needed, I update records as follows:
$sql = qq{ UPDATE wms_rf_server_port SET available = ?, last_updated_by = ?, last_updated_date = ? WHERE port_id IN ( $port_ids ) }; eval { $rows = $dbh->do($sql,undef,$available,$0,_timestamp()); $dbh->commit(); }; if ($@) { _DB_ErrorHandler($@); $dbh->rollback(); }

At this point, _DB_ErrorHandler() only logs the errors. What I would like to do is, in the event that the error is due to loss of connection to the database, to queue up this transaction, so that it can be processed when the connection is reestablished. The example SQL statement is representative of the type of statements that would need to be queued, however, there are actually 6 different statements, with differing tables, parameters, etc.

Does anyone know of a module that does what I need, or comes close? As always, any suggestions are welcome.

Thanks,
Akoya


In reply to Queuing DBI transactions by Akoya

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.