Hi folks,
I would like to have some wisdom's advice.
I've following problem:
I'm trying to setup an automatic testing system for DB programs (Informatica ETLs and PL/SQL programs) basend on my testadata generation tool(http://dbfeeder.sourceforge.net/)
Now one of the major problems that I encouter is to get data which fits to program's database queries.
I try to achieve this goal by parsing program's code and in particular SQL queries, to detect literal values (strings, numbers, dates) and join condition between tables.
I decided to adopt following strategy:
- use Parse::Recdescent
- limit the parsing to join conditions and literal expression (ie not try to query the whole sql)
- collect all db information (table structures, column names and types) in advance
- accept failures (few undetected literals or join conditions in a long query could be acceptable since that can be fixed manually afterwards in DBFeeder).
I thought at the beginning that in this way I could be faster than implementing a formal SQL parser in arse::Recdescent and then look for the literals.
Now I'm not sure if this is the right strategy to go.
How would you proceed to get literals and join conditions from SQLs?

Thanks in advance for any suggestion.
Best Regards,
Davide.

In reply to SQL Parsing with Parse::RecDescent by DACONTI

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.