Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 2303B9FB7B7 for ; Tue, 20 Mar 2007 16:47:19 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 26215-03 for ; Tue, 20 Mar 2007 16:47:13 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id BF3789FB70A for ; Tue, 20 Mar 2007 16:47:12 -0300 (ADT) Received: (qmail 25102 invoked from network); 20 Mar 2007 19:47:11 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.14?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 20 Mar 2007 19:47:11 -0000 In-Reply-To: References: <1174339672.7880.107.camel@archimedes> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: multipart/alternative; boundary=Apple-Mail-19-691822106 Message-Id: <54271772-A7CB-47D6-84EC-194A6F2F1A1C@fastcrypt.com> Cc: pgsql-jdbc@postgresql.org From: Dave Cramer Subject: Re: query manipulation Date: Tue, 20 Mar 2007 15:47:13 -0400 To: Randall Smith X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/107 X-Sequence-Number: 16821 --Apple-Mail-19-691822106 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed 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 --Apple-Mail-19-691822106 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1
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:


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


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


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


and it shows type type is:


=A0 =A0 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 =3D = DriverManager.getConnection('jdbc:postgresql:mydb','myuser','mypass')

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

stmt.setString(1, myvalue)

rs =3D stmt.executeQuery()

=


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


Randall

=

= --Apple-Mail-19-691822106--