question about SQL Parser

question about SQL Parser

am 25.06.2007 11:23:35 von Maribel.Felipe

------_=_NextPart_001_01C7B70A.82177AA2
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable



Hello Jeff,

=20

I have installed this application to parse SQL queries, but it doesn't
work with the query I try to, it is to say, the parser doesn't match the
query I send it. That is because my query has sentences like
'mydb.dbo.mytable' or "case when" in SELECT clause, etc. Besides the
queries I want to parse don't have always the reserved words in capital
letters. Is there something that I can do to solve this, the idea is to
use de SQL Standard 92. I don't have a lot of experience with Perl, so
I'm a little lost.

=20

Thank you very much for your time.

Maribel.



************************************ DISCLAIMER =
*****************************************

This message is intended exclusively for the named person. It may contain=
confidential,=20
propietary or legally privileged information No confidentiality or=
privilege is waived=20
or lost by any mistransmission. If you receive this message in error,=
please immediately=20
delete it and all copies of it from your system, destroy any hard copies of=
it and notify
the sender. Your must not, directly or indirectly, use, disclose,=
distribute, print, or=20
copy any part of this message if you are not the intended recipient. Any=
views expressed
in this message are those of the individual sender, except where the=
message states=20
otherwise and the sender is authorised to state them to be the views of=
BBVA Suiza.
Please note that internet e-mail neither guarantees the confidentiality nor=
the proper=20
receipt of the message sent. If the addressee of this message does not=
consent to=20
the use of internet e-mail, please communicate it to us immediately.
------_=_NextPart_001_01C7B70A.82177AA2--

Re: question about SQL Parser

am 25.06.2007 17:57:08 von jeff

Hi,

Felipe Maribel wrote:
> I have installed this application to parse SQL queries, but it doesn't
> work with the query I try to, it is to say, the parser doesn't match the
> query I send it. That is because my query has sentences like
> 'mydb.dbo.mytable'
The parser currently won't break on foo.bar syntax but (if I'm
remembering correctly) can't handle foo.bar.baz, that wouldn't be too
hard to add.
> or "case when" in SELECT clause, etc. Besides the
>
Sorry, the parser does not handle CASE statements and they would not be
easy to add (though patches and collaborators are always welcome).
> queries I want to parse don't have always the reserved words in capital
> letters.
Identifier case is insensitive - in other words it doesn't matter if the
reserved words are in capital letters.

For Data Definition Language (DDL), you should check out
SQL::Translator, it is much more complete for DDL. It doesn't, at least
the last time I checked, handle Data Modification.

At the moment your best option may be wrapping the parsing in an eval
and creating two output files - one of successfully parsed statements
and one of statements that couldn't be parsed. (Though depending on
what you are trying to do, this may not be useful)

You may also want to look at some non-Perl SQL parsers such as the one
by Mimer. Sorry I can't be more helpful, good luck.

--
Jeff

P.S. Since this isn't strictly DBI, perhaps you should send your reply
to me directly.