Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: rewriting SQL

by sundialsvc4 (Abbot)
on Jun 22, 2014 at 12:59 UTC ( [id://1090833]=note: print w/replies, xml ) Need Help??


in reply to rewriting SQL

An interesting proposition.   If you truly need to parse any SQL statement, then it seems to me that you may(?) need to obtain (from the web) an actual, authoritative BNF grammar for the SQL dialect that you are using, then employ a Lex/Yacc style parser using it.   Which I can see that Perl can do, although I have not personally used that parser with Perl.   I can’t yet speak for Marpa, although it looks interesting and possibly applicable too.   I do not know, but certainly would like to know, if there are any Perl modules out there with this degree of rigor and completeness.

The difficulty that I foresee is having to compare two statements by comparing two AST parse-trees, which I do think that you would have to do instead of trying to “un-parse” them back to a then-comparable string.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1090833]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found