I agree with the others, you cannot really do what you are asking. I can't give you a silver bullet, but I can offer a process that might help.

I had a similar situation with a large amount of code that inconsistently referenced various schemas. Sometimes it was hard coded in the connect string, sometimes it was in a config file, sometimes it was hard coded in the SQL statements themselves, etc...

My approach was to build a bunch of regular expressions to filter the source code and pinpoint likely problem areas. In my case, I left all the legacy code in place so as not to break anything, then used the regex to change the schema between development and production database instances. Anything I found that I couldn't reliably manipulate with a regex got immediate priority for refactoring. It was a bit ugly, but it worked really, really well.

I literally started with regex's something like this:

/dbi\W+connect\(/i # grab every DBI connection call /(select)|(update)|(delete)/i # grab every thing that looks like SQL

Then I eyeballed the output for problem areas and patterns, refined the regex's to ignore some things & detect others, and repeated. Even though it was a large code base it didn't take too long to zero in on the true problem areas.

You can scan a lot of code very quickly this way, and that's basically what you will have to do. Using perl to scan perl source is really effective, and I'm sure there are modules out there to help.


In reply to Re: Can I tell if DBI's quote() was used? by Cabrion
in thread Can I tell if DBI's quote() was used? by kyle

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.