John! Good job! John McNally wrote: > > Here is a patch that allows dbcp to be compiled under jdk 1.3 and 1.4. > > The TesterXXX classes are Lev's noop versions. I implemented working > versions for the DelegatingXXX classes. The new methods are surrounded > by comments. > > I modified the build system to copy the src to a build directory and > then the comments that hide the code for 1.3 are removed if > java.sql.Savepoint is available. > > john mcnally > > Lev Assinovsky wrote: > > > > I attached the classes modified for JSK 1.4/JDBC 3.0 > > Use it as you want. > > -- > > Lev Assinovsky Peterlink Web > > Programmer St. Petersburg, Russia > > Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7� > > E-mail: [EMAIL PROTECTED] > > > > ------------------------------------------------------------------------ > > Name: dbcp_jdbc3.0.tar.gz > > dbcp_jdbc3.0.tar.gz Type: Unix Tape Archive (application/x-tar) > > Encoding: base64 > > > > ------------------------------------------------------------------------ > > -- > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > ------------------------------------------------------------------------ > ? jdbc3.patch > Index: build.xml > =================================================================== > RCS file: /home/cvspublic/jakarta-commons/dbcp/build.xml,v > retrieving revision 1.5 > diff -u -r1.5 build.xml > --- build.xml 16 Jan 2002 00:19:36 -0000 1.5 > +++ build.xml 18 Mar 2002 09:01:56 -0000 > @@ -59,6 +59,7 @@ > <property name="source.src.test" value="${source.src}/test"/> > <property name="source.doc" value="${basedir}/doc"/> > <property name="dest" value="${basedir}/dist"/> > + <property name="dest.src" value="${dest}/src"/> > <property name="dest.classes" value="${dest}/classes"/> > <property name="dest.doc" value="${dest}/docs"/> > <property name="dest.doc.api" value="${dest.doc}/api"/> > @@ -69,6 +70,7 @@ > <available property="available-src-java" file="${source.src.java}"/> <!-- >does this module have java src? --> > <available property="available-src-test" file="${source.src.test}"/> <!-- >does this module have test src? --> > <available property="jndi.present" classname="javax.naming.Context"/> > + <available property="jdbc3.present" classname="java.sql.Savepoint"/> > > </target> > > @@ -168,10 +170,31 @@ > > <target name="build" depends="init,build-java" description="compiles source >files"/> > > - <target name="build-java" depends="init" if="available-src-java"> > + <target name="copy-src" depends="init"> > + <mkdir dir="${dest.src}"/> > + > + <!-- the source code directory --> > + <copy todir="${dest.src}/org" filtering="yes"> > + <fileset dir="${source.src.java}" defaultexcludes="no"> > + <include name="**/*.java"/> > + <include name="**/*.xml"/> > + <include name="**/*.properties"/> > + <include name="**/package.html"/> > + </fileset> > + </copy> > + > + </target> > + > + <target name="prepare-jdbc3" if="jdbc3.present"> > + <replace dir="${dest.src}" token="/* JDBC_3_ANT_KEY" value="" /> > + <replace dir="${dest.src}" token="JDBC_3_ANT_KEY */" value="" /> > + </target> > + > + <target name="build-java" depends="copy-src, prepare-jdbc3" >if="available-src-java"> > <mkdir dir="${dest.classes}"/> > + > <javac destdir="${dest.classes}" > - srcdir="${source.src.java}" > + srcdir="${dest.src}" > classpath="${classpath}" > debug="false" > deprecation="true" > @@ -182,9 +205,19 @@ > </target> > > <target name="build-test" depends="init,build-java" if="available-src-test"> > + <mkdir dir="${dest.src}"/> > + <!-- the source code directory --> > + <copy todir="${dest.src}/org" filtering="yes"> > + <fileset dir="${source.src.test}" defaultexcludes="no"> > + <include name="**/*.java"/> > + </fileset> > + </copy> > + > + <antcall target="prepare-jdbc3" /> > + > <mkdir dir="${dest.classes}"/> > <javac destdir="${dest.classes}" > - srcdir="${source.src.test}" > + srcdir="${dest.src}" > classpath="${classpath}" > debug="false" > deprecation="true" > Index: src/java/org/apache/commons/dbcp/DelegatingConnection.java > =================================================================== > RCS file: >/home/cvspublic/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DelegatingConnection.java,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 DelegatingConnection.java > --- src/java/org/apache/commons/dbcp/DelegatingConnection.java 14 Apr 2001 17:15:17 >-0000 1.1.1.1 > +++ src/java/org/apache/commons/dbcp/DelegatingConnection.java 18 Mar 2002 09:01:56 >-0000 > @@ -172,4 +172,95 @@ > ((DelegatingConnection)_conn).passivate(); > } > } > -} > \ No newline at end of file > + > + // -------------------- JDBC 3.0 ------------------------------------ > + /* JDBC_3_ANT_KEY > + > + public void setHoldability(int holdability) throws SQLException > + { > + checkOpen(); > + _conn.setHoldability(holdability); > + } > + > + public int getHoldability() throws SQLException > + { > + checkOpen(); > + return _conn.getHoldability(); > + } > + > + public java.sql.Savepoint setSavepoint() throws SQLException > + { > + checkOpen(); > + return _conn.setSavepoint(); > + } > + > + public java.sql.Savepoint setSavepoint(String name) throws SQLException > + { > + checkOpen(); > + return _conn.setSavepoint(name); > + } > + > + public void rollback(java.sql.Savepoint savepoint) throws SQLException > + { > + checkOpen(); > + _conn.rollback(savepoint); > + } > + > + public void releaseSavepoint(java.sql.Savepoint savepoint) > + throws SQLException > + { > + checkOpen(); > + _conn.releaseSavepoint(savepoint); > + } > + > + public Statement createStatement(int resultSetType, > + int resultSetConcurrency, > + int resultSetHoldability) > + throws SQLException > + { > + checkOpen(); > + return _conn.createStatement(resultSetType, resultSetConcurrency, > + resultSetHoldability); > + } > + > + public PreparedStatement prepareStatement(String sql, int resultSetType, > + int resultSetConcurrency, int >resultSetHoldability) > + throws SQLException > + { > + checkOpen(); > + return _conn.prepareStatement(sql, resultSetType, > + resultSetConcurrency, resultSetHoldability); > + } > + > + public CallableStatement prepareCall(String sql, int resultSetType, > + int resultSetConcurrency, > + int resultSetHoldability) throws SQLException > + { > + checkOpen(); > + return _conn.prepareCall(sql, resultSetType, > + resultSetConcurrency, resultSetHoldability); > + } > + > + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) > + throws SQLException > + { > + checkOpen(); > + return _conn.prepareStatement(sql, autoGeneratedKeys); > + } > + > + public PreparedStatement prepareStatement(String sql, int columnIndexes[]) > + throws SQLException > + { > + checkOpen(); > + return _conn.prepareStatement(sql, columnIndexes); > + } > + > + public PreparedStatement prepareStatement(String sql, String columnNames[]) > + throws SQLException > + { > + checkOpen(); > + return _conn.prepareStatement(sql, columnNames); > + } > + > + JDBC_3_ANT_KEY */ > +} > Index: src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java > =================================================================== > RCS file: >/home/cvspublic/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 DelegatingPreparedStatement.java > --- src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java 14 Apr 2001 >17:15:22 -0000 1.1.1.1 > +++ src/java/org/apache/commons/dbcp/DelegatingPreparedStatement.java 18 Mar 2002 >09:01:57 -0000 > @@ -215,4 +215,76 @@ > } > > protected boolean _closed = false; > -} > \ No newline at end of file > + > + > + // --------------------- JDBC 3.0 ----------------------------- > + /* JDBC_3_ANT_KEY > + > + public boolean getMoreResults(int current) throws SQLException > + { > + checkOpen(); > + return _stmt.getMoreResults(current); > + } > + > + public ResultSet getGeneratedKeys() throws SQLException > + { > + checkOpen(); > + return _stmt.getGeneratedKeys(); > + } > + > + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException > + { > + checkOpen(); > + return _stmt.executeUpdate(sql, autoGeneratedKeys); > + } > + > + public int executeUpdate(String sql, int columnIndexes[]) throws SQLException > + { > + checkOpen(); > + return _stmt.executeUpdate(sql, columnIndexes); > + } > + > + public int executeUpdate(String sql, String columnNames[]) throws SQLException > + { > + checkOpen(); > + return _stmt.executeUpdate(sql, columnNames); > + } > + > + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException > + { > + checkOpen(); > + return _stmt.execute(sql, autoGeneratedKeys); > + } > + > + public boolean execute(String sql, int columnIndexes[]) throws SQLException > + { > + checkOpen(); > + return _stmt.execute(sql, columnIndexes); > + } > + > + public boolean execute(String sql, String columnNames[]) throws SQLException > + { > + checkOpen(); > + return _stmt.execute(sql, columnNames); > + } > + > + public int getResultSetHoldability() throws SQLException > + { > + checkOpen(); > + return _stmt.getResultSetHoldability(); > + } > + > + public void setURL(int parameterIndex, java.net.URL x) throws SQLException > + { > + checkOpen(); > + _stmt.setURL(parameterIndex, x); > + } > + > + public ParameterMetaData getParameterMetaData() throws SQLException > + { > + checkOpen(); > + return _stmt.getParameterMetaData(); > + } > + > + JDBC_3_ANT_KEY */ > +} > Index: src/java/org/apache/commons/dbcp/DelegatingStatement.java > =================================================================== > RCS file: >/home/cvspublic/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DelegatingStatement.java,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 DelegatingStatement.java > --- src/java/org/apache/commons/dbcp/DelegatingStatement.java 14 Apr 2001 17:15:27 >-0000 1.1.1.1 > +++ src/java/org/apache/commons/dbcp/DelegatingStatement.java 18 Mar 2002 09:01:58 >-0000 > @@ -174,4 +174,68 @@ > } > > protected boolean _closed = false; > -} > \ No newline at end of file > + > + // --------------------------- JDBC 3.0 -------------------------------- > + /* JDBC_3_ANT_KEY > + > + public boolean getMoreResults(int current) > + throws SQLException > + { > + checkOpen(); > + return _stmt.getMoreResults(current); > + } > + > + public ResultSet getGeneratedKeys() throws SQLException > + { > + checkOpen(); > + return _stmt.getGeneratedKeys(); > + } > + > + public int executeUpdate(String sql, int autoGeneratedKeys) > + throws SQLException > + { > + checkOpen(); > + return _stmt.executeUpdate(sql, autoGeneratedKeys); > + } > + > + public int executeUpdate(String sql, int columnIndexes[]) > + throws SQLException > + { > + checkOpen(); > + return _stmt.executeUpdate(sql, columnIndexes); > + } > + > + public int executeUpdate(String sql, String columnNames[]) > + throws SQLException > + { > + checkOpen(); > + return _stmt.executeUpdate(sql, columnNames); > + } > + > + public boolean execute(String sql, int autoGeneratedKeys) > + throws SQLException > + { > + checkOpen(); > + return _stmt.execute(sql, autoGeneratedKeys); > + } > + > + public boolean execute(String sql, int columnIndexes[]) throws SQLException > + { > + checkOpen(); > + return _stmt.execute(sql, columnIndexes); > + } > + > + public boolean execute(String sql, String columnNames[]) throws SQLException > + { > + checkOpen(); > + return _stmt.execute(sql, columnNames); > + } > + > + public int getResultSetHoldability() throws SQLException > + { > + checkOpen(); > + return _stmt.getResultSetHoldability(); > + } > + > + JDBC_3_ANT_KEY */ > +} > Index: src/test/org/apache/commons/dbcp/TesterConnection.java > =================================================================== > RCS file: >/home/cvspublic/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterConnection.java,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 TesterConnection.java > --- src/test/org/apache/commons/dbcp/TesterConnection.java 14 Apr 2001 17:16:27 >-0000 1.1.1.1 > +++ src/test/org/apache/commons/dbcp/TesterConnection.java 18 Mar 2002 09:01:59 >-0000 > @@ -199,4 +199,77 @@ > throw new SQLException("Connection is closed."); > } > } > + > + // -------------------- JDBC 3.0 ------------------------------------ > + /* JDBC_3_ANT_KEY > + > + public void setHoldability(int holdability) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int getHoldability() throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public Savepoint setSavepoint() throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public Savepoint setSavepoint(String name) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void rollback(Savepoint savepoint) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void releaseSavepoint(Savepoint savepoint) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public Statement createStatement(int resultSetType, int resultSetConcurrency, > + int resultSetHoldability) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public PreparedStatement prepareStatement(String sql, int resultSetType, > + int resultSetConcurrency, int >resultSetHoldability) > + throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public CallableStatement prepareCall(String sql, int resultSetType, > + int resultSetConcurrency, > + int resultSetHoldability) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) > + throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public PreparedStatement prepareStatement(String sql, int columnIndexes[]) > + throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public PreparedStatement prepareStatement(String sql, String columnNames[]) > + throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + JDBC_3_ANT_KEY */ > } > Index: src/test/org/apache/commons/dbcp/TesterPreparedStatement.java > =================================================================== > RCS file: >/home/cvspublic/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterPreparedStatement.java,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 TesterPreparedStatement.java > --- src/test/org/apache/commons/dbcp/TesterPreparedStatement.java 14 Apr 2001 >17:16:40 -0000 1.1.1.1 > +++ src/test/org/apache/commons/dbcp/TesterPreparedStatement.java 18 Mar 2002 >09:02:00 -0000 > @@ -232,4 +232,65 @@ > public void setNull (int paramIndex, int sqlType, String typeName) throws >SQLException { > checkOpen(); > } > + > + > + // --------------------- JDBC 3.0 ----------------------------- > + /* JDBC_3_ANT_KEY > + > + public boolean getMoreResults(int current) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public ResultSet getGeneratedKeys() throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int executeUpdate(String sql, int columnIndexes[]) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int executeUpdate(String sql, String columnNames[]) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public boolean execute(String sql, int columnIndexes[]) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public boolean execute(String sql, String columnNames[]) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int getResultSetHoldability() throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void setURL(int parameterIndex, java.net.URL x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public ParameterMetaData getParameterMetaData() throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + JDBC_3_ANT_KEY */ > } > Index: src/test/org/apache/commons/dbcp/TesterResultSet.java > =================================================================== > RCS file: >/home/cvspublic/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterResultSet.java,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 TesterResultSet.java > --- src/test/org/apache/commons/dbcp/TesterResultSet.java 14 Apr 2001 17:16:37 >-0000 1.1.1.1 > +++ src/test/org/apache/commons/dbcp/TesterResultSet.java 18 Mar 2002 09:02:02 >-0000 > @@ -633,14 +633,62 @@ > throw new SQLException("Connection is closed."); > } > } > -} > - > - > - > - > > > + // --------------------- JDBC 3.0 ----------------------------- > + /* JDBC_3_ANT_KEY > > + public java.net.URL getURL(int columnIndex) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public java.net.URL getURL(String columnName) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void updateRef(String columnName, java.sql.Ref x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void updateBlob(String columnName, java.sql.Blob x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void updateClob(String columnName, java.sql.Clob x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void updateArray(int columnIndex, java.sql.Array x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public void updateArray(String columnName, java.sql.Array x) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > > + JDBC_3_ANT_KEY */ > +} > > > Index: src/test/org/apache/commons/dbcp/TesterStatement.java > =================================================================== > RCS file: >/home/cvspublic/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/TesterStatement.java,v > retrieving revision 1.1.1.1 > diff -u -r1.1.1.1 TesterStatement.java > --- src/test/org/apache/commons/dbcp/TesterStatement.java 14 Apr 2001 17:16:42 >-0000 1.1.1.1 > +++ src/test/org/apache/commons/dbcp/TesterStatement.java 18 Mar 2002 09:02:02 >-0000 > @@ -225,4 +225,55 @@ > throw new SQLException("Connection is closed."); > } > } > + > + // --------------------------- JDBC 3.0 -------------------------------- > + /* JDBC_3_ANT_KEY > + > + public boolean getMoreResults(int current) > + throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public ResultSet getGeneratedKeys() throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int executeUpdate(String sql, int columnIndexes[]) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int executeUpdate(String sql, String columnNames[]) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public boolean execute(String sql, int columnIndexes[]) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public boolean execute(String sql, String columnNames[]) throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + public int getResultSetHoldability() throws SQLException > + { > + throw new SQLException("Not implemented."); > + } > + > + JDBC_3_ANT_KEY */ > } > > ------------------------------------------------------------------------ > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
Regards, -- Lev Assinovsky Peterlink Web Programmer St. Petersburg, Russia Tel/Fax: +7 812 3275343 197022 ul.Chapigina 7� E-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
