From: | Ulrich Meis <kenobi(at)halifax(dot)rwth-aachen(dot)de> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | General Parser |
Date: | 2004-11-01 02:41:28 |
Message-ID: | 200411010341.28499.kenobi@halifax.rwth-aachen.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
QueryParser.java | text/x-java | 16.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2004-11-01 11:06:25 | Re: General Parser |
Previous Message | Ulrich Meis | 2004-10-31 20:29:57 | Re: persistence of java objects |