Index: build.xml
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/build.xml,v
retrieving revision 1.69
diff -c -b -r1.69 build.xml
*** build.xml	8 Jun 2006 10:34:50 -0000	1.69
--- build.xml	19 Jun 2006 16:41:18 -0000
***************
*** 155,160 ****
--- 155,163 ----
         <include name="${package}/jdbc3/Jdbc3ResultSet.java" if="jdbc3"/>
         <include name="${package}/jdbc3/Jdbc3ResultSetMetaData.java.java" if="jdbc3"/>
         <include name="${package}/jdbc3/Jdbc3Statement.java" if="jdbc3"/>
+        <include name="${package}/jdbc3/CacheablePreparedStatement.java" if="jdbc3"/>
+        <include name="${package}/jdbc3/CacheConnection.java" if="jdbc3"/>
+        <include name="${package}/jdbc3/StatementPool.java" if="jdbc3"/>
  
         <!-- jdbc3g subpackage -->
         <include name="${package}/jdbc3g/*.java" if="jdbc3g" />
***************
*** 222,231 ****
      <condition property="connectclass" value="org.postgresql.jdbc2.Jdbc2Connection">
          <equals arg1="${jdbc2}" arg2="true"/>
      </condition>
!     <condition property="connectclass" value="org.postgresql.jdbc3.Jdbc3Connection">
          <equals arg1="${jdbc3}" arg2="true"/>
      </condition>
!     <condition property="connectclass" value="org.postgresql.jdbc3g.Jdbc3gConnection">
          <equals arg1="${jdbc3g}" arg2="true"/>
      </condition>
      <condition property="connectclass" value="org.postgresql.jdbc4.Jdbc4Connection">
--- 225,234 ----
      <condition property="connectclass" value="org.postgresql.jdbc2.Jdbc2Connection">
          <equals arg1="${jdbc2}" arg2="true"/>
      </condition>
!     <condition property="connectclass" value="org.postgresql.jdbc3.CacheConnection">
          <equals arg1="${jdbc3}" arg2="true"/>
      </condition>
!     <condition property="connectclass" value="org.postgresql.jdbc3g.CacheConnection">
          <equals arg1="${jdbc3g}" arg2="true"/>
      </condition>
      <condition property="connectclass" value="org.postgresql.jdbc4.Jdbc4Connection">
***************
*** 323,330 ****
    <!-- Password must be something.  Doesn't matter if trust is used! -->
    <property name="password" value="password" />
    <property name="preparethreshold" value="0" />
!   <property name="loglevel" value="0" />
!   <property name="protocolVersion" value="0" />
  
    <!-- The tests now build to a separate directory and jarfile from the
         driver build, to ensure we're really testing against the jar we just
--- 326,333 ----
    <!-- Password must be something.  Doesn't matter if trust is used! -->
    <property name="password" value="password" />
    <property name="preparethreshold" value="0" />
!   <property name="loglevel" value="1" />
!   <property name="protocolVersion" value="3" />
  
    <!-- The tests now build to a separate directory and jarfile from the
         driver build, to ensure we're really testing against the jar we just
Index: org/postgresql/jdbc2/AbstractJdbc2Connection.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java,v
retrieving revision 1.37
diff -c -b -r1.37 AbstractJdbc2Connection.java
*** org/postgresql/jdbc2/AbstractJdbc2Connection.java	24 Nov 2005 06:44:21 -0000	1.37
--- org/postgresql/jdbc2/AbstractJdbc2Connection.java	19 Jun 2006 16:41:19 -0000
***************
*** 15,21 ****
  import java.util.*;
  import org.postgresql.core.*;
  import org.postgresql.Driver;
- import org.postgresql.PGConnection;
  import org.postgresql.PGNotification;
  import org.postgresql.fastpath.Fastpath;
  import org.postgresql.largeobject.LargeObjectManager;
--- 15,20 ----
***************
*** 1077,1080 ****
--- 1076,1080 ----
      {
          return bindStringAsVarchar;
      }
+     
  }
Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v
retrieving revision 1.91
diff -c -b -r1.91 AbstractJdbc2Statement.java
*** org/postgresql/jdbc2/AbstractJdbc2Statement.java	8 Jun 2006 10:34:50 -0000	1.91
--- org/postgresql/jdbc2/AbstractJdbc2Statement.java	19 Jun 2006 16:41:21 -0000
***************
*** 419,431 ****
          // Every statement execution clears any previous warnings.
          clearWarnings();
  
!         // Close any existing resultsets associated with this statement.
!         while (firstUnclosedResult != null)
!         {
!             if (firstUnclosedResult.getResultSet() != null)
!                 firstUnclosedResult.getResultSet().close();
!             firstUnclosedResult = firstUnclosedResult.getNext();
!         }
  
          if (lastSimpleQuery != null) {
              lastSimpleQuery.close();
--- 419,425 ----
          // Every statement execution clears any previous warnings.
          clearWarnings();
  
!         this.closeResultSets();
  
          if (lastSimpleQuery != null) {
              lastSimpleQuery.close();
***************
*** 711,724 ****
          // closing an already closed Statement is a no-op.
          if (isClosed)
              return ;
  
-         // Force the ResultSet(s) to close
-         while (firstUnclosedResult != null)
-         {
-             if (firstUnclosedResult.getResultSet() != null)
-                 firstUnclosedResult.getResultSet().close();
-             firstUnclosedResult = firstUnclosedResult.getNext();
-         }
  
          if (lastSimpleQuery != null)
              lastSimpleQuery.close();
--- 705,712 ----
          // closing an already closed Statement is a no-op.
          if (isClosed)
              return ;
+         closeResultSets();
          
  
          if (lastSimpleQuery != null)
              lastSimpleQuery.close();
***************
*** 727,736 ****
              preparedQuery.close();
  
          // Disasociate it from us
-         result = firstUnclosedResult = null;
          isClosed = true;
      }
  
      /**
       * This finalizer ensures that statements that have allocated server-side
       * resources free them when they become unreferenced.
--- 715,735 ----
              preparedQuery.close();
  
          // Disasociate it from us
          isClosed = true;
      }
      
+     public void closeResultSets() throws SQLException 
+     {
+         // Force the ResultSet(s) to close
+         while (firstUnclosedResult != null)
+         {
+             if (firstUnclosedResult.getResultSet() != null)
+                 firstUnclosedResult.getResultSet().close();
+             firstUnclosedResult = firstUnclosedResult.getNext();
+         }
+         result = firstUnclosedResult = null;
+                 
+     }
      /**
       * This finalizer ensures that statements that have allocated server-side
       * resources free them when they become unreferenced.
Index: org/postgresql/test/jdbc2/ConnectionTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/ConnectionTest.java,v
retrieving revision 1.21
diff -c -b -r1.21 ConnectionTest.java
*** org/postgresql/test/jdbc2/ConnectionTest.java	24 Nov 2005 02:31:43 -0000	1.21
--- org/postgresql/test/jdbc2/ConnectionTest.java	19 Jun 2006 16:41:21 -0000
***************
*** 9,14 ****
--- 9,15 ----
  */
  package org.postgresql.test.jdbc2;
  
+ import org.postgresql.Driver;
  import org.postgresql.test.TestUtil;
  import junit.framework.TestCase;
  import java.sql.*;
***************
*** 22,27 ****
--- 23,32 ----
  public class ConnectionTest extends TestCase
  {
  
+     static
+     {
+         Driver.setLogLevel(0);
+     }
      /*
       * Constructor
       */
Index: org/postgresql/test/jdbc2/PreparedStatementTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/PreparedStatementTest.java,v
retrieving revision 1.16
diff -c -b -r1.16 PreparedStatementTest.java
*** org/postgresql/test/jdbc2/PreparedStatementTest.java	15 May 2006 09:35:57 -0000	1.16
--- org/postgresql/test/jdbc2/PreparedStatementTest.java	19 Jun 2006 16:41:21 -0000
***************
*** 25,37 ****
      public PreparedStatementTest(String name)
      {
          super(name);
-         
-         try 
-         { 
-             org.postgresql.Driver driver = new org.postgresql.Driver();
-         } 
-         catch (Exception ex) 
-         {;}
      }
  
      protected void setUp() throws Exception
--- 25,30 ----
