Re: Parsing some but not all of SQL

"Hannes liesen" <surgeonde@yahoo.de>
13 Oct 2002 16:41:07 -0400

          From comp.compilers

Related articles
Parsing some but not all of SQL 3328749@sina.com (GuaGuaHuang) (2002-09-25)
Re: Parsing some but not all of SQL Mark.van.den.Brand@cwi.nl (M.G.J. van den Brand) (2002-10-13)
Re: Parsing some but not all of SQL surgeonde@yahoo.de (Hannes liesen) (2002-10-13)
| List of all articles for this month |

From: "Hannes liesen" <surgeonde@yahoo.de>
Newsgroups: comp.compilers
Date: 13 Oct 2002 16:41:07 -0400
Organization: T-Online
References: 02-09-152
Keywords: SQL, parse
Posted-Date: 13 Oct 2002 16:41:07 EDT

GuaGuaHuang wrote:
> I am using yacc&lex to analysis a SQL batch. I only want to find out
> the SELECT statements in the batch and make some transformation to
> them. Other statements will not be changed.
>
> Must I write a full syntax of SQL, or are there some other simple
> ways?
> [Since it's usually pretty simple to find the statement boundaries in SQL,
> you can probably look at the first token of each statement, if it's
> SELECT parse it and change it, if not just skip up to the next statement.
> -John]


There is an sql parser in the lex&yacc book (you know this have some
animals on the cover .. in a nutshell company)


[Yes, I wrote it. It's for a 10 year old version of SQL so it's a
reasonable starting point, but I'd still do some ad hoc peeking so it
only tries to parse SELECT statements and doesn't waste time with the
other half of SQL. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.