Fast and dirty solution:

It probably wouldn't be that hard to programatically extract the SQL bits from a DBI->trace dump, so he doesn't have to find the needle amid the haystack. Below is an excerpt from a DBI->trace(1, $tracefile) dump I did the other day from Class::DBI code:

<- connect= DBIx::ContextualFetch::db=HASH(0x573ae0) T <- STORE('dbi_connect_closure' CODE(0x573b88))= 1 at DBI.pm line 6 +62 T <- prepare_cached('SELECT id, location, membership_level, im_servi +ce, last_name, password, im_handle, url, registration_date, profile_u +pdated, priv_email, email, email_bouncing_p, first_names FROM dashboard_user WHERE id = ? ')= ( DBIx::ContextualFetch::st=HASH(0x5674a4) ) [1 items] at DBI.pm l +ine 391 T <- FETCH('Active')= '' at DBI.pm line 1124 T <- FETCH('Taint')= 1 at ContextualFetch.pm line 49 <- STORE('Taint' 0)= 1 at ContextualFetch.pm line 50 <- execute(1)= 1 at ContextualFetch.pm line 51 T <- STORE('Taint' 1)= 1 at ContextualFetch.pm line 52

Depending on the specifics of your configuration, you might be able to get away with looping through the tracefile with a regex like (untested):

/^ T  <- prepare(_cached)?\('(.+?)'\)= \( DBIx::ContextualFetch::st=HASH\(/

... where the SQL would be stored in $2.

(Incidentally, it looks like my tainting is being turned off on every execute! I had never noticed that before ...)


In reply to Re: Obtaining SQL updates for application to another database by ryantate
in thread Obtaining SQL updates for application to another database by rinceWind

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.