General Parser - Mailing list pgsql-jdbc

From Ulrich Meis
Subject General Parser
Date
Msg-id 200411010341.28499.kenobi@halifax.rwth-aachen.de
Whole thread Raw
Responses Re: General Parser  (Oliver Jowett <oliver@opencloud.com>)
Re: General Parser  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
I was still worried about that "two words" table bug, so I tried myself on the
parser todo.

I skimmed through the code and found parsers at the following spots:
(tell me if I missed something)

1. AbstractJdbc2Statement.replaceProcessing
2. AbstractJdbc2Statement.modifyJdbcCall
3. V2Query constructor
4. v3/QueryExecutorImpl.parseQuery
5. AbstractJdbc2ResultSet.parseQuery

Problems I discovered:

Number 3 and 4 do not handle an escaped literal quote, i.e. \'
Number 5 doesn't handle (among other things) any quotes, joins, unions.

Finally, none of the above handle dollar quoting.

Attached you'll find a QueryParser class I've written that has all the
functionality that is implemented in the above methods and handles dollar
quoting. It parses the query in one run, so I believe it's pretty fast.

For testing purposes it has a main method so you can fire queries at it and it
will show you the determined subqueries and their fragments (delimited by
X?X).

I hope it's what you had in mind with the parser todo.

The class still needs extensive testing but I wanted to make sure that I'm
doing the right thing first...so what are your thoughts?

Uli

Attachment

pgsql-jdbc by date:

Previous
From: Ulrich Meis
Date:
Subject: Re: persistence of java objects
Next
From: Oliver Jowett
Date:
Subject: Re: General Parser