Re: SQL::Statement - how easy to subclass?

Jens Rehsack <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
Am 16.03.2012 01:50, schrieb David Muir Sharnoff:
> Hi.

Hi,

> I want to build a SQL query translater for my OOPS module.

I want users reading the support section of the modules they use
or a business support contract when they want private or special
support.

> I need an SQL parser for that I can modify so that it will accept perl
> data expressions as terms.
> 
> For example:
> 
>     select $x from objects where $x->isa('Foo') and $x->{field1} == 'bar'
> 
> The perl expressions can be parsed by PPI.
> 
> How easy is it to subclass SQL::Statement?  Can I grab control of terms
> and lists when I see a '$' or '@'?
> 
> I had a brief look and I saw some subclassing hooks, but it wasn't clear
> that there were enough to do what I need.

As long as you want to parse SQL, it's easy. When you're going to mix
languages and the functions API of SQL::Statement doesn't fit your
requirements any more, you can develop a complete new parser. The API
requirements are mixed in the accessors of SQL::Statement - sorry, heritage.

Best regards,
Jens
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.