Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > preprocessing o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1976 of 2028
Post > Topic >>

preprocessing of sql in the jdbc driver

by andrea.nasato@[EMAIL PROTECTED] ("Andrea Nasato") Jun 20, 2008 at 11:01 AM

Hi to all,

I'm developing a standard java web application using postgres as dbms.
I'm using postgres 8.2.4 on RHEL and the 8.2-504 jdbc driver

I use an mda tool which generates both java and sql code. The problem
is that the sql code generated is not so compliant with postgres
syntax.

Specifically, the SELECT ... FOR UPDATE statement is generated with this
syntax:

SELECT T1.column_1, ..., T1.column_N
FROM table_name AS T1
WHERE ...
FOR UPDATE OF T1.column_1, ..., T1.column_n

instead of

SELECT T1.column_1, ..., T1.column_N
FROM table_name AS T1
WHERE ...
FOR UPDATE

So the generator qualifies columns in the FOR UPDATE clause. When I
submit this SQL to the dbms I receive a syntax error:

ERROR:  syntax error at or near "." at character 119
LINE 5: FOR UPDATE OF T1.TABLENAME, T1.SURROGATE

We can't patch the generator (we don't have the code!) but we can
modify the jdbc driver to insert a sort of preprocessing of the sql in
order to adjust the syntax.

So my question is, which is the right place to do such operation? I
analyzed the call stack and I've found that the method called before
the execution of "for update" queries is
org.postgresql.jdbc3.Jdbc3Connection.prepareStatement(String , int ,
int , int ).

Maybe I can pre process the sql string in this method, before the
construction of the PreparedStatement. Is this correct?

Thank you for yor attention and thanks in advance

Andrea

-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
 




 1 Posts in Topic:
preprocessing of sql in the jdbc driver
andrea.nasato@[EMAIL PROT  2008-06-20 11:01:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 1:55:09 CDT 2008.