Folks,
I am looking for the best option here. I am supporting a legacy application that occasionally gets duff data in its database. I have written a reconciler perl script, using Class::DBI, which reports any inconsistencies.
I have included an update option, which corrects the data; I have also put this in a transaction which can be rolled back at the end.
My client's change management procedures require that the script is run by a DBA - supplying a write permitted username and password. During the testing phase, the DBA has asked me whether I can show him the SQL.
I showed him DBI_TRACE, but even level 1 gives a copious amount of output, and it was a needle in a haystack finding the updates. Implementation of this particular data fix has been agreed according to the logic I have provided.
What he is really looking for is a way that my script could emit the SQL updates, so that these can be taken into production and run in isolation - without needing to run my script in production.
I am looking for a way of doing this - generically. I have several options:
- I could hook DBI, possibly by taking the DBI_TRACE output and munging it into freestanding SQL.
- I could hook Class::DBI, Ima::DBI or DBIx::ContextualFetch to grab the SQL before it gets executed.
- I could build the logic into the application as Class::DBI triggers, or validate_column_values methods.
This would then involve hand-crafting some update SQL.
I'm not sure which way to go on this one. Any suggestions?
--
I'm Not Just Another Perl Hacker
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.