pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Randall Smith <randall@tnr.cc>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: query manipulation
Date: Tue, 20 Mar 2007 15:47:13 -0400
Message-ID: <54271772-A7CB-47D6-84EC-194A6F2F1A1C@fastcrypt.com> (raw)
In-Reply-To: <etpc85$ptq$1@sea.gmane.org>
References: <etmr99$4og$1@sea.gmane.org>
	<DD57BABC-5E3B-46EB-B5C7-A6AA78350279@fastcrypt.com>
	<1174339672.7880.107.camel@archimedes>
	<etpc85$ptq$1@sea.gmane.org>

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

view thread (12+ messages)  latest in thread

Message-ID: <54271772-A7CB-47D6-84EC-194A6F2F1A1C@fastcrypt.com>
Permalink:  ../54271772-A7CB-47D6-84EC-194A6F2F1A1C@fastcrypt.com/
Also on:    postgresql.org/message-id/54271772-A7CB-47D6-84EC-194A6F2F1A1C@fastcrypt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pg@fastcrypt.com, randall@tnr.cc
  Subject: Re: query manipulation
  In-Reply-To: <54271772-A7CB-47D6-84EC-194A6F2F1A1C@fastcrypt.com>
  References: <etmr99$4og$1@sea.gmane.org> <DD57BABC-5E3B-46EB-B5C7-A6AA78350279@fastcrypt.com> <1174339672.7880.107.camel@archimedes> <etpc85$ptq$1@sea.gmane.org> <54271772-A7CB-47D6-84EC-194A6F2F1A1C@fastcrypt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox