DBIx::MyParsePP
DBIx::MyParsePP is a Pure-perl implementation of the MySQL SQL parser.
[edit] Synopsis
ue DBIx::MyParsePP;
use Data::Dumper;
my $parser = DBIx::MyParsePP->new();
my $query = $parser->parse("SELECT 1");
print Dumper $query;
print $query->toString();
[edit] Method of Operation
This module works by taking the sql_yacc.yy grammar file from the MySQL source, removing all C code and compiling it using Parse::Yapp. The lexer from sql_lex.cc has also been translated in Perl.
The end result is a self-contained, stand-alone, pure-Perl (My)SQL parser.
For a faster, C-based parsing solution, please check out DBIx::MyParse