Re: query manipulation - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: query manipulation
Date
Msg-id 54271772-A7CB-47D6-84EC-194A6F2F1A1C@fastcrypt.com
Whole thread Raw
In response to Re: query manipulation  (Randall Smith <randall@tnr.cc>)
Responses Re: query manipulation  (Randall Smith <randall@tnr.cc>)
List pgsql-jdbc
You don't want to do that you want proxy PreparedStatement, then override PreparedStatement.prepareStatement

He is checking the return type of every method to see what is returning a prepared statement

Dave

On 20-Mar-07, at 3:21 PM, Randall Smith wrote:

This particular statement:


    if(method.getReturnType().isInstance(PreparedStatement.class))


is returning false for my prepared statement.  I'm printing the type like this:


    System.out.println(method.getReturnType());


and it shows type type is:


    interface java.sql.PreparedStatement


I'm using Jython to test, and my test program looks like so:


from java.lang import *

from java.sql import *

Class.forName("randall.PGProxyDriver")

con = DriverManager.getConnection('jdbc:postgresql:mydb','myuser','mypass')

stmt = con.prepareStatement('select * from mytablename where myfield = ?')

stmt.setString(1, myvalue)

rs = stmt.executeQuery()


How do I match "interface java.sql.PreparedStatement" ?


Randall


pgsql-jdbc by date:

Previous
From: Randall Smith
Date:
Subject: Re: query manipulation
Next
From: Randall Smith
Date:
Subject: Re: query manipulation