*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
* @author Csaba Nagy (ncsaba@yahoo.com)
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class PooledConnectionImpl implements PooledConnection
{
else if(method.getName().equals("createStatement"))
{
Statement st = (Statement)method.invoke(con, args);
- return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Statement.class}, new StatementHandler(this, st));
+ return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Statement.class, org.postgresql.PGStatement.class}, new StatementHandler(this, st));
}
else if(method.getName().equals("prepareCall"))
{
Statement st = (Statement)method.invoke(con, args);
- return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{CallableStatement.class}, new StatementHandler(this, st));
+ return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{CallableStatement.class, org.postgresql.PGStatement.class}, new StatementHandler(this, st));
}
else if(method.getName().equals("prepareStatement"))
{
Statement st = (Statement)method.invoke(con, args);
- return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{PreparedStatement.class}, new StatementHandler(this, st));
+ return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{PreparedStatement.class, org.postgresql.PGStatement.class}, new StatementHandler(this, st));
}
else
{
* interface to the PooledConnection is through the CPDS.
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class ConnectionPoolTest extends BaseDataSourceTest
{
}
}
+ /**
+ * Ensure that a statement created from a pool can be used
+ * like any other statement in regard to pg extensions.
+ */
+ public void testStatementsProxyPGStatement() {
+ try {
+ PooledConnection pc = getPooledConnection();
+ con = pc.getConnection();
+
+ Statement s = con.createStatement();
+ boolean b = ((org.postgresql.PGStatement)s).isUseServerPrepare();
+
+ PreparedStatement ps = con.prepareStatement("select 'x'");
+ b = ((org.postgresql.PGStatement)ps).isUseServerPrepare();
+
+ CallableStatement cs = con.prepareCall("select 'x'");
+ b = ((org.postgresql.PGStatement)cs).isUseServerPrepare();
+
+ } catch (SQLException e) {
+ fail(e.getMessage());
+ }
+ }
+
/**
* Helper class to remove a listener during event dispatching.
*/