AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL parsing library

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Chris Smith
Guest





PostPosted: Thu Jan 15, 2004 1:51 pm    Post subject: SQL parsing library Reply with quote



Good evening,

I'm hunting for an SQL parsing library. Specifically, the task I have
in mind is as follows: take an SQL query (which may already contain some
'?' characters for parameterized values), and replace ALL literal values
with the '?' character, while not touching anything else in the query.

I want to do this because I'm instrumenting a JDBC driver to provide
metrics on the frequency and average running time of queries in the
application, and I want to treat all queries of the same general form as
being identical to each other when counting frequency and average
running time.

Thanks in advance,

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Back to top
Robert Klemme
Guest





PostPosted: Fri Jan 16, 2004 9:08 am    Post subject: Re: SQL parsing library Reply with quote




"Chris Smith" <cdsmith (AT) twu (DOT) net> schrieb im Newsbeitrag
news:MPG.1a7048b59068cf599898a8 (AT) news (DOT) pop4.net...
Quote:
Good evening,

I'm hunting for an SQL parsing library. Specifically, the task I have
in mind is as follows: take an SQL query (which may already contain some
'?' characters for parameterized values), and replace ALL literal values
with the '?' character, while not touching anything else in the query.

I want to do this because I'm instrumenting a JDBC driver to provide
metrics on the frequency and average running time of queries in the
application, and I want to treat all queries of the same general form as
being identical to each other when counting frequency and average
running time.

It might be sufficient to come up with a regexp sophisticated enough.
Something along the lines of

/'[^']*'|[+-]?[0-9]+(.[0-9]+)?([eE][+-]?[0-9]+)?|[0-9]{4}-[0-9]{2}-[0-9]{
2}([0-9]{2}:[0-9]{2}(:[0-9]{2})?)?/

That should catch
- string literals
- numbers
- date / timestamp

Note: untested.

Not so simple though... :-}

robert


Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.