Changed the package names so dbutils and dbutils2 won't conflict if both loaded
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/dbutils/branches/2_0@1454860 13f79535-47bb-0310-9956-ffa450edef68 Project: http://git-wip-us.apache.org/repos/asf/commons-dbutils/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-dbutils/commit/41d6d58c Tree: http://git-wip-us.apache.org/repos/asf/commons-dbutils/tree/41d6d58c Diff: http://git-wip-us.apache.org/repos/asf/commons-dbutils/diff/41d6d58c Branch: refs/heads/2_0 Commit: 41d6d58c09ac2d0299292080a6845547404f14d7 Parents: b579869 Author: Bill Speirs <[email protected]> Authored: Sun Mar 10 14:54:34 2013 +0000 Committer: Bill Speirs <[email protected]> Committed: Sun Mar 10 14:54:34 2013 +0000 ---------------------------------------------------------------------- .../commons/dbutils/AbstractExecutor.java | 323 --- .../apache/commons/dbutils/AsyncExecutor.java | 129 -- .../commons/dbutils/BaseResultSetHandler.java | 1923 ------------------ .../commons/dbutils/BasicRowProcessor.java | 239 --- .../apache/commons/dbutils/BatchExecutor.java | 117 -- .../apache/commons/dbutils/BeanProcessor.java | 504 ----- .../org/apache/commons/dbutils/DbUtils.java | 406 ---- .../commons/dbutils/GenerousBeanProcessor.java | 71 - .../apache/commons/dbutils/InsertExecutor.java | 100 - .../apache/commons/dbutils/ProxyFactory.java | 135 -- .../apache/commons/dbutils/QueryExecutor.java | 82 - .../org/apache/commons/dbutils/QueryLoader.java | 124 -- .../org/apache/commons/dbutils/QueryRunner.java | 315 --- .../commons/dbutils/ResultSetHandler.java | 43 - .../commons/dbutils/ResultSetIterator.java | 141 -- .../apache/commons/dbutils/RowProcessor.java | 86 - .../apache/commons/dbutils/UpdateExecutor.java | 57 - .../dbutils/handlers/AbstractKeyedHandler.java | 87 - .../dbutils/handlers/AbstractListHandler.java | 61 - .../commons/dbutils/handlers/ArrayHandler.java | 81 - .../dbutils/handlers/ArrayListHandler.java | 72 - .../commons/dbutils/handlers/BeanHandler.java | 83 - .../dbutils/handlers/BeanListHandler.java | 85 - .../dbutils/handlers/BeanMapHandler.java | 185 -- .../dbutils/handlers/ColumnListHandler.java | 105 - .../commons/dbutils/handlers/KeyedHandler.java | 161 -- .../commons/dbutils/handlers/MapHandler.java | 76 - .../dbutils/handlers/MapListHandler.java | 73 - .../commons/dbutils/handlers/ScalarHandler.java | 110 - .../commons/dbutils/handlers/package-info.java | 21 - .../apache/commons/dbutils/package-info.java | 26 - .../wrappers/SqlNullCheckedResultSet.java | 608 ------ .../wrappers/StringTrimmedResultSet.java | 109 - .../commons/dbutils/wrappers/package-info.java | 21 - .../commons/dbutils2/AbstractExecutor.java | 323 +++ .../apache/commons/dbutils2/AsyncExecutor.java | 129 ++ .../commons/dbutils2/BaseResultSetHandler.java | 1923 ++++++++++++++++++ .../commons/dbutils2/BasicRowProcessor.java | 239 +++ .../apache/commons/dbutils2/BatchExecutor.java | 117 ++ .../apache/commons/dbutils2/BeanProcessor.java | 504 +++++ .../org/apache/commons/dbutils2/DbUtils.java | 406 ++++ .../commons/dbutils2/GenerousBeanProcessor.java | 71 + .../apache/commons/dbutils2/InsertExecutor.java | 100 + .../apache/commons/dbutils2/ProxyFactory.java | 135 ++ .../apache/commons/dbutils2/QueryExecutor.java | 82 + .../apache/commons/dbutils2/QueryLoader.java | 124 ++ .../apache/commons/dbutils2/QueryRunner.java | 315 +++ .../commons/dbutils2/ResultSetHandler.java | 43 + .../commons/dbutils2/ResultSetIterator.java | 141 ++ .../apache/commons/dbutils2/RowProcessor.java | 86 + .../apache/commons/dbutils2/UpdateExecutor.java | 57 + .../dbutils2/handlers/AbstractKeyedHandler.java | 87 + .../dbutils2/handlers/AbstractListHandler.java | 61 + .../commons/dbutils2/handlers/ArrayHandler.java | 81 + .../dbutils2/handlers/ArrayListHandler.java | 72 + .../commons/dbutils2/handlers/BeanHandler.java | 83 + .../dbutils2/handlers/BeanListHandler.java | 85 + .../dbutils2/handlers/BeanMapHandler.java | 185 ++ .../dbutils2/handlers/ColumnListHandler.java | 105 + .../commons/dbutils2/handlers/KeyedHandler.java | 161 ++ .../commons/dbutils2/handlers/MapHandler.java | 76 + .../dbutils2/handlers/MapListHandler.java | 73 + .../dbutils2/handlers/ScalarHandler.java | 110 + .../commons/dbutils2/handlers/package-info.java | 21 + .../apache/commons/dbutils2/package-info.java | 26 + .../wrappers/SqlNullCheckedResultSet.java | 608 ++++++ .../wrappers/StringTrimmedResultSet.java | 109 + .../commons/dbutils2/wrappers/package-info.java | 21 + .../commons/dbutils/AbstractExecutorTest.java | 122 -- .../commons/dbutils/AsyncExecutorTest.java | 93 - .../dbutils/BaseResultSetHandlerTestCase.java | 71 - .../apache/commons/dbutils/BaseTestCase.java | 127 -- .../commons/dbutils/BasicRowProcessorTest.java | 139 -- .../commons/dbutils/BatchExecutorTest.java | 67 - .../commons/dbutils/BeanProcessorTest.java | 113 - .../org/apache/commons/dbutils/DbUtilsTest.java | 272 --- .../dbutils/GenerousBeanProcessorTest.java | 113 - .../commons/dbutils/InsertExecutorTest.java | 91 - .../apache/commons/dbutils/MockResultSet.java | 363 ---- .../commons/dbutils/MockResultSetMetaData.java | 95 - .../commons/dbutils/ProxyFactoryTest.java | 66 - .../commons/dbutils/QueryExecutorTest.java | 91 - .../apache/commons/dbutils/QueryLoaderTest.java | 49 - .../apache/commons/dbutils/QueryRunnerTest.java | 159 -- .../commons/dbutils/ResultSetIteratorTest.java | 49 - .../org/apache/commons/dbutils/TestBean.java | 148 -- .../commons/dbutils/UpdateExecutorTest.java | 74 - .../dbutils/handlers/ArrayHandlerTest.java | 47 - .../dbutils/handlers/ArrayListHandlerTest.java | 66 - .../dbutils/handlers/BeanHandlerTest.java | 48 - .../dbutils/handlers/BeanListHandlerTest.java | 67 - .../dbutils/handlers/BeanMapHandlerTest.java | 90 - .../dbutils/handlers/ColumnListHandlerTest.java | 71 - .../dbutils/handlers/KeyedHandlerTest.java | 101 - .../dbutils/handlers/MapHandlerTest.java | 48 - .../dbutils/handlers/MapListHandlerTest.java | 67 - .../dbutils/handlers/ScalarHandlerTest.java | 53 - .../wrappers/SqlNullCheckedResultSetTest.java | 1020 ---------- .../wrappers/StringTrimmedResultSetTest.java | 69 - .../commons/dbutils2/AbstractExecutorTest.java | 124 ++ .../commons/dbutils2/AsyncExecutorTest.java | 100 + .../dbutils2/BaseResultSetHandlerTestCase.java | 72 + .../apache/commons/dbutils2/BaseTestCase.java | 127 ++ .../commons/dbutils2/BasicRowProcessorTest.java | 142 ++ .../commons/dbutils2/BatchExecutorTest.java | 69 + .../commons/dbutils2/BeanProcessorTest.java | 116 ++ .../apache/commons/dbutils2/DbUtilsTest.java | 273 +++ .../dbutils2/GenerousBeanProcessorTest.java | 115 ++ .../commons/dbutils2/InsertExecutorTest.java | 94 + .../apache/commons/dbutils2/MockResultSet.java | 365 ++++ .../commons/dbutils2/MockResultSetMetaData.java | 97 + .../commons/dbutils2/ProxyFactoryTest.java | 68 + .../commons/dbutils2/QueryExecutorTest.java | 94 + .../commons/dbutils2/QueryLoaderTest.java | 51 + .../commons/dbutils2/QueryRunnerTest.java | 161 ++ .../commons/dbutils2/ResultSetIteratorTest.java | 51 + .../org/apache/commons/dbutils2/TestBean.java | 148 ++ .../commons/dbutils2/UpdateExecutorTest.java | 76 + .../dbutils2/handlers/ArrayHandlerTest.java | 48 + .../dbutils2/handlers/ArrayListHandlerTest.java | 67 + .../dbutils2/handlers/BeanHandlerTest.java | 49 + .../dbutils2/handlers/BeanListHandlerTest.java | 68 + .../dbutils2/handlers/BeanMapHandlerTest.java | 91 + .../handlers/ColumnListHandlerTest.java | 72 + .../dbutils2/handlers/KeyedHandlerTest.java | 102 + .../dbutils2/handlers/MapHandlerTest.java | 49 + .../dbutils2/handlers/MapListHandlerTest.java | 68 + .../dbutils2/handlers/ScalarHandlerTest.java | 54 + .../wrappers/SqlNullCheckedResultSetTest.java | 1021 ++++++++++ .../wrappers/StringTrimmedResultSetTest.java | 71 + 130 files changed, 10862 insertions(+), 10808 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41d6d58c/src/main/java/org/apache/commons/dbutils/AbstractExecutor.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/dbutils/AbstractExecutor.java b/src/main/java/org/apache/commons/dbutils/AbstractExecutor.java deleted file mode 100644 index 63fa3ab..0000000 --- a/src/main/java/org/apache/commons/dbutils/AbstractExecutor.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.dbutils; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Types; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Abstract class for executing a query, insert, update, or batch. - * - * @since 2.0 - * @author William Speirs <[email protected]> - */ -abstract class AbstractExecutor<T extends AbstractExecutor<T>> { - - private static final String COLON = ":"; // TODO: change this to any character - - private final Connection conn; - private final String sql; - private final PreparedStatement stmt; - - private final Map<String, List<Integer>> paramPosMap; - private final Map<String, Object> paramValueMap; - private Integer currentPosition = Integer.valueOf(0); - - public AbstractExecutor(final Connection conn, final String sql) throws SQLException { - this.conn = conn; - this.sql = sql; - this.paramPosMap = new HashMap<String, List<Integer>>(); - this.paramValueMap = new HashMap<String, Object>(); - - final Pattern paramPattern = Pattern.compile("(:\\w+)"); - final Matcher matcher = paramPattern.matcher(sql); - - // go through finding params - while(matcher.find()) { - insertParamPosition(matcher.group().replace(COLON, "")); - } - - // replace all of the :names with ?, and create a prepared statement - stmt = conn.prepareStatement(sql.replaceAll(":\\w+", "\\?")); - } - - /** - * Helper method to insert params and the current position into the map. - * @param param the SQL param. - */ - private void insertParamPosition(final String param) { - List<Integer> posList = paramPosMap.get(param); - - // create a new list if we need to - if(posList == null) { - posList = new ArrayList<Integer>(); - paramPosMap.put(param, posList); - } - - // increment first, so we match SQL numbering - posList.add(++currentPosition); - } - - /** - * Gets the SQL statement that was passed into the constructor. - * @return the SQL statement passed into the constructor. - */ - protected String getSql() { - return sql; - } - - /** - * Returns the underlying prepared statement. - * @return the underlying prepared statement. - */ - protected PreparedStatement getStatement() { - return stmt; - } - - /** - * Returns the underlying connection. - * @return the underlying connection. - */ - protected Connection getConnection() { - return conn; - } - - /** - * Throws an exception if there are unmapped params. - * @throws SQLException if there are unmapped params. - */ - protected void throwIfUnmappedParams() throws SQLException { - if(paramPosMap.size() != 0) { - final Set<String> unmappedParams = paramPosMap.keySet(); - final StringBuilder sb = new StringBuilder("There are unbound parameters: "); - - for(String param:unmappedParams) { - sb.append(param); - sb.append(", "); - } - - // remove the last comma - sb.delete(sb.length()-2, sb.length()); - - // throw our exception - throw new SQLException(sb.toString()); - } - } - - /** - * Binds a named parameter to a value. - * - * @param name the name of the parameter in the SQL statement. - * @param value the value of the parameter in the SQL statement. - * @return this execution object to provide the fluent style. - * @throws SQLException thrown if the parameter is not found, already bound, or there is an issue binding it. - */ - public T bind(final String name, final Object value) throws SQLException { - return bind(name, value, true); - } - - /** - * Binds null to a parameter. - * Types.VARCHAR is used as the type's parameter. - * This usually works, but fails with some Oracle and MS SQL drivers. - * @param name the name of the parameter. - * @return this execution object to provide the fluent style. - * @throws SQLException throw if the parameter is not found, already bound, or there is an issue binding null. - */ - public T bindNull(final String name) throws SQLException { - return bindNull(name, Types.VARCHAR, true); - } - - /** - * Binds null to a parameter, specifying the parameter's type. - * @param name the name of the parameter. - * @param sqlType the type of the parameter. - * @return this execution object to provide the fluent style. - * @throws SQLException throw if the parameter is not found, already bound, or there is an issue binding null. - */ - public T bindNull(final String name, final int sqlType) throws SQLException { - return bindNull(name, sqlType, true); - } - - /** - * Given a param name and sqlType, binds a null to that parameter. - * @param name the name of the parameter. - * @param sqlType the type of the parameter. - * @param removeFromPosMap if the param should be removed from the pos map. - * @return this - * @throws SQLException if there is an SQLException during binding. - */ - protected T bindNull(String name, int sqlType, boolean removeFromPosMap) throws SQLException { - name = name.replace(COLON, ""); // so we can take ":name" or "name" - - final List<Integer> pos = removeFromPosMap ? paramPosMap.remove(name) : paramPosMap.get(name); - - if(pos == null) { - throw new SQLException(name + " is not found in the SQL statement"); - } - - // go through and bind all of the positions for this name - for(Integer p:pos) { - stmt.setNull(p, sqlType); - } - - // add the param and value to our map - paramValueMap.put(name, null); - - // suppressed because the casting will always work here - @SuppressWarnings("unchecked") - final T ret = (T) this; - - return ret; - } - - /** - * Binds value to name, but does not do the bookkeeping. - * @param name the parameter name. - * @param value the value. - * @param removeFromPosMap if the param should be removed from the pos map. - * @return this - * @throws SQLException if there is an SQLException during binding. - */ - protected T bind(String name, final Object value, boolean removeFromPosMap) throws SQLException { - name = name.replace(COLON, ""); // so we can take ":name" or "name" - - final List<Integer> pos = removeFromPosMap ? paramPosMap.remove(name) : paramPosMap.get(name); - - if(pos == null) { - throw new SQLException(name + " is not found in the SQL statement"); - } - - // go through and bind all of the positions for this name - for(Integer p:pos) { - // TODO: need to figure out how to bind NULL - stmt.setObject(p, value); - } - - // add the param and value to our map - paramValueMap.put(name, value); - - // suppressed because the casting will always work here - @SuppressWarnings("unchecked") - final T ret = (T) this; - - return ret; - } - - /** - * Used for batch calls so we can clear the map after the addBatch call. - */ - protected void clearValueMap() { - paramValueMap.clear(); - } - - /** - * Throws a new exception with a more informative error message. - * - * @param cause The original exception that will be chained to the new - * exception when it's rethrown. - * - * @throws SQLException if a database access error occurs - */ - protected void rethrow(SQLException cause) throws SQLException { - String causeMessage = cause.getMessage(); - - if (causeMessage == null) { - causeMessage = ""; - } - - final StringBuffer msg = new StringBuffer(causeMessage); - - msg.append(" Query: "); - msg.append(sql); - msg.append(" Parameters: "); - - // loop through adding the parameter to value mappings - for(Map.Entry<String, Object> param:paramValueMap.entrySet()) { - msg.append(param.getKey()); - msg.append("="); - msg.append(param.getValue()); - msg.append(" "); - } - - final SQLException e = new SQLException(msg.toString(), cause.getSQLState(), cause.getErrorCode()); - e.setNextException(cause); - - throw e; - } - - /** - * Wrap the <code>ResultSet</code> in a decorator before processing it. This - * implementation returns the <code>ResultSet</code> it is given without any - * decoration. - * - * @param rs The <code>ResultSet</code> to decorate; never <code>null</code>. - * @return The <code>ResultSet</code> wrapped in some decorator. - */ - protected ResultSet wrap(ResultSet rs) { - return rs; - } - - /** - * Close a <code>Connection</code>. This implementation avoids closing if - * null and does <strong>not</strong> suppress any exceptions. Subclasses - * can override to provide special handling like logging. - * - * @param conn Connection to close - * @throws SQLException if a database access error occurs - */ - protected void close(Connection conn) throws SQLException { - DbUtils.close(conn); - } - - /** - * Close a <code>Statement</code>. This implementation avoids closing if - * null and does <strong>not</strong> suppress any exceptions. Subclasses - * can override to provide special handling like logging. - * - * @param stmt Statement to close - * @throws SQLException if a database access error occurs - */ - protected void close(Statement stmt) throws SQLException { - DbUtils.close(stmt); - } - - /** - * Close a <code>ResultSet</code>. This implementation avoids closing if - * null and does <strong>not</strong> suppress any exceptions. Subclasses - * can override to provide special handling like logging. - * - * @param rs ResultSet to close - * @throws SQLException if a database access error occurs - */ - protected void close(ResultSet rs) throws SQLException { - DbUtils.close(rs); - } - - -} http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41d6d58c/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java b/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java deleted file mode 100644 index 295e368..0000000 --- a/src/main/java/org/apache/commons/dbutils/AsyncExecutor.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.dbutils; - -import java.sql.SQLException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; - -/** - * Convenience class for executing QueryExecutor, InsertExecutor, or UpdateExecutors asynchronously. - * - * @author William Speirs <[email protected]> - * @since 2.0 - */ -public class AsyncExecutor { - - private final ExecutorService executorService; - - /** - * Constructor for AsyncQueryRunner which uses a provided ExecutorService and underlying QueryRunner. - * - * @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently. - * @param queryRunner the {@code QueryRunner} instance to use for the queries. - */ - public AsyncExecutor(ExecutorService executorService) { - this.executorService = executorService; - } - - /** - * Execute a {@link org.apache.commons.dbutils.BatchExecutor}. - * @return A <code>Future</code> which returns the result of the batch call. - * @throws SQLException if a database access error occurs - */ - public Future<int[]> execute(final BatchExecutor executor) throws SQLException { - return executorService.submit(new Callable<int[]>() { - - @Override - public int[] call() throws Exception { - return executor.execute(); - } - - }); - } - - /** - * Execute a {@link org.apache.commons.dbutils.QueryExecutor} given a handler. - * @param <T> The type of object that the handler returns - * @param handler The handler that converts the results into an object. - * @return A <code>Future</code> which returns the result of the query call. - * @throws SQLException if a database access error occurs - */ - public <T> Future<T> execute(final QueryExecutor executor, final ResultSetHandler<T> handler) throws SQLException { - return executorService.submit(new Callable<T>() { - - @Override - public T call() throws Exception { - return executor.execute(handler); - } - - }); - } - - /** - * Execute a {@link org.apache.commons.dbutils.UpdateExecutor}. - * @param <T> The type of object that the handler returns - * @return A <code>Future</code> which returns the result of the query call. - * @throws SQLException if a database access error occurs - */ - public Future<Integer> execute(final UpdateExecutor executor) throws SQLException { - return executorService.submit(new Callable<Integer>() { - - @Override - public Integer call() throws Exception { - return executor.execute(); - } - - }); - } - - /** - * Execute a {@link org.apache.commons.dbutils.InsertExecutor} given a handler. - * @param <T> The type of object that the handler returns - * @param handler The handler that converts the results into an object. - * @return A <code>Future</code> which returns the result of the query call. - * @throws SQLException if a database access error occurs - */ - public <T> Future<T> execute(final InsertExecutor executor, final ResultSetHandler<T> handler) throws SQLException { - return executorService.submit(new Callable<T>() { - - @Override - public T call() throws Exception { - return executor.execute(handler); - } - - }); - } - - /** - * Execute a {@link org.apache.commons.dbutils.InsertExecutor} given a handler. - * @return A <code>Future</code> which returns the number of rows inserted. - * @throws SQLException if a database access error occurs - */ - public Future<Integer> execute(final InsertExecutor executor) throws SQLException { - return executorService.submit(new Callable<Integer>() { - - @Override - public Integer call() throws Exception { - return executor.execute(); - } - - }); - } - -} http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41d6d58c/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java b/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java deleted file mode 100644 index 0fbe1ea..0000000 --- a/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java +++ /dev/null @@ -1,1923 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.dbutils; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.NClob; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Map; - -/** - * Extensions of this class convert ResultSets into other objects. - * - * According to the <i>DRY</i> principle (Don't Repeat Yourself), repeating <code>resultSet</code> - * variable inside the {@link ResultSetHandler#handle(ResultSet)} over and over for each iteration - * can get a little tedious, <code>AbstractResultSetHandler</code> implicitly gives users access to - * <code>ResultSet</code>'s methods. - * - * <b>NOTE</b> This class is <i>NOT</i> thread safe! - * - * @param <T> the target type the input ResultSet will be converted to. - * @since 1.6 - */ -public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> { - - /** - * The adapted ResultSet. - */ - private ResultSet rs; - - /** - * {@inheritDoc} - */ - @Override - public final T handle(ResultSet rs) throws SQLException { - if (this.rs != null) { - throw new IllegalStateException("Re-entry not allowed!"); - } - - this.rs = rs; - - try { - return handle(); - } finally { - this.rs = null; - } - } - - /** - * Turn the <code>ResultSet</code> into an Object. - * - * @return An Object initialized with <code>ResultSet</code> data - * @throws SQLException if a database access error occurs - * @see {@link ResultSetHandler#handle(ResultSet)} - */ - protected abstract T handle() throws SQLException; - - /** - * @param row - * @return - * @throws SQLException - * @see java.sql.ResultSet#absolute(int) - */ - protected final boolean absolute(int row) throws SQLException { - return rs.absolute(row); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#afterLast() - */ - protected final void afterLast() throws SQLException { - rs.afterLast(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#beforeFirst() - */ - protected final void beforeFirst() throws SQLException { - rs.beforeFirst(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#cancelRowUpdates() - */ - protected final void cancelRowUpdates() throws SQLException { - rs.cancelRowUpdates(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#clearWarnings() - */ - protected final void clearWarnings() throws SQLException { - rs.clearWarnings(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#close() - */ - protected final void close() throws SQLException { - rs.close(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#deleteRow() - */ - protected final void deleteRow() throws SQLException { - rs.deleteRow(); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#findColumn(java.lang.String) - */ - protected final int findColumn(String columnLabel) throws SQLException { - return rs.findColumn(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#first() - */ - protected final boolean first() throws SQLException { - return rs.first(); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getArray(int) - */ - protected final Array getArray(int columnIndex) throws SQLException { - return rs.getArray(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getArray(java.lang.String) - */ - protected final Array getArray(String columnLabel) throws SQLException { - return rs.getArray(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getAsciiStream(int) - */ - protected final InputStream getAsciiStream(int columnIndex) throws SQLException { - return rs.getAsciiStream(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getAsciiStream(java.lang.String) - */ - protected final InputStream getAsciiStream(String columnLabel) throws SQLException { - return rs.getAsciiStream(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBigDecimal(int) - */ - protected final BigDecimal getBigDecimal(int columnIndex) throws SQLException { - return rs.getBigDecimal(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBigDecimal(java.lang.String) - */ - protected final BigDecimal getBigDecimal(String columnLabel) throws SQLException { - return rs.getBigDecimal(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBinaryStream(int) - */ - protected final InputStream getBinaryStream(int columnIndex) throws SQLException { - return rs.getBinaryStream(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBinaryStream(java.lang.String) - */ - protected final InputStream getBinaryStream(String columnLabel) throws SQLException { - return rs.getBinaryStream(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBlob(int) - */ - protected final Blob getBlob(int columnIndex) throws SQLException { - return rs.getBlob(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBlob(java.lang.String) - */ - protected final Blob getBlob(String columnLabel) throws SQLException { - return rs.getBlob(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBoolean(int) - */ - protected final boolean getBoolean(int columnIndex) throws SQLException { - return rs.getBoolean(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBoolean(java.lang.String) - */ - protected final boolean getBoolean(String columnLabel) throws SQLException { - return rs.getBoolean(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getByte(int) - */ - protected final byte getByte(int columnIndex) throws SQLException { - return rs.getByte(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getByte(java.lang.String) - */ - protected final byte getByte(String columnLabel) throws SQLException { - return rs.getByte(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBytes(int) - */ - protected final byte[] getBytes(int columnIndex) throws SQLException { - return rs.getBytes(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getBytes(java.lang.String) - */ - protected final byte[] getBytes(String columnLabel) throws SQLException { - return rs.getBytes(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getCharacterStream(int) - */ - protected final Reader getCharacterStream(int columnIndex) throws SQLException { - return rs.getCharacterStream(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getCharacterStream(java.lang.String) - */ - protected final Reader getCharacterStream(String columnLabel) throws SQLException { - return rs.getCharacterStream(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getClob(int) - */ - protected final Clob getClob(int columnIndex) throws SQLException { - return rs.getClob(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getClob(java.lang.String) - */ - protected final Clob getClob(String columnLabel) throws SQLException { - return rs.getClob(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getConcurrency() - */ - protected final int getConcurrency() throws SQLException { - return rs.getConcurrency(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getCursorName() - */ - protected final String getCursorName() throws SQLException { - return rs.getCursorName(); - } - - /** - * @param columnIndex - * @param cal - * @return - * @throws SQLException - * @see java.sql.ResultSet#getDate(int, java.util.Calendar) - */ - protected final Date getDate(int columnIndex, Calendar cal) throws SQLException { - return rs.getDate(columnIndex, cal); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getDate(int) - */ - protected final Date getDate(int columnIndex) throws SQLException { - return rs.getDate(columnIndex); - } - - /** - * @param columnLabel - * @param cal - * @return - * @throws SQLException - * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar) - */ - protected final Date getDate(String columnLabel, Calendar cal) throws SQLException { - return rs.getDate(columnLabel, cal); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getDate(java.lang.String) - */ - protected final Date getDate(String columnLabel) throws SQLException { - return rs.getDate(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getDouble(int) - */ - protected final double getDouble(int columnIndex) throws SQLException { - return rs.getDouble(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getDouble(java.lang.String) - */ - protected final double getDouble(String columnLabel) throws SQLException { - return rs.getDouble(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getFetchDirection() - */ - protected final int getFetchDirection() throws SQLException { - return rs.getFetchDirection(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getFetchSize() - */ - protected final int getFetchSize() throws SQLException { - return rs.getFetchSize(); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getFloat(int) - */ - protected final float getFloat(int columnIndex) throws SQLException { - return rs.getFloat(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getFloat(java.lang.String) - */ - protected final float getFloat(String columnLabel) throws SQLException { - return rs.getFloat(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getHoldability() - */ - protected final int getHoldability() throws SQLException { - return rs.getHoldability(); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getInt(int) - */ - protected final int getInt(int columnIndex) throws SQLException { - return rs.getInt(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getInt(java.lang.String) - */ - protected final int getInt(String columnLabel) throws SQLException { - return rs.getInt(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getLong(int) - */ - protected final long getLong(int columnIndex) throws SQLException { - return rs.getLong(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getLong(java.lang.String) - */ - protected final long getLong(String columnLabel) throws SQLException { - return rs.getLong(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getMetaData() - */ - protected final ResultSetMetaData getMetaData() throws SQLException { - return rs.getMetaData(); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getNCharacterStream(int) - */ - protected final Reader getNCharacterStream(int columnIndex) throws SQLException { - return rs.getNCharacterStream(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getNCharacterStream(java.lang.String) - */ - protected final Reader getNCharacterStream(String columnLabel) throws SQLException { - return rs.getNCharacterStream(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getNClob(int) - */ - protected final NClob getNClob(int columnIndex) throws SQLException { - return rs.getNClob(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getNClob(java.lang.String) - */ - protected final NClob getNClob(String columnLabel) throws SQLException { - return rs.getNClob(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getNString(int) - */ - protected final String getNString(int columnIndex) throws SQLException { - return rs.getNString(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getNString(java.lang.String) - */ - protected final String getNString(String columnLabel) throws SQLException { - return rs.getNString(columnLabel); - } - - /** - * @param columnIndex - * @param map - * @return - * @throws SQLException - * @see java.sql.ResultSet#getObject(int, java.util.Map) - */ - protected final Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { - return rs.getObject(columnIndex, map); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getObject(int) - */ - protected final Object getObject(int columnIndex) throws SQLException { - return rs.getObject(columnIndex); - } - - /** - * @param columnLabel - * @param map - * @return - * @throws SQLException - * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map) - */ - protected final Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { - return rs.getObject(columnLabel, map); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getObject(java.lang.String) - */ - protected final Object getObject(String columnLabel) throws SQLException { - return rs.getObject(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getRef(int) - */ - protected final Ref getRef(int columnIndex) throws SQLException { - return rs.getRef(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getRef(java.lang.String) - */ - protected final Ref getRef(String columnLabel) throws SQLException { - return rs.getRef(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getRow() - */ - protected final int getRow() throws SQLException { - return rs.getRow(); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getRowId(int) - */ - protected final RowId getRowId(int columnIndex) throws SQLException { - return rs.getRowId(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getRowId(java.lang.String) - */ - protected final RowId getRowId(String columnLabel) throws SQLException { - return rs.getRowId(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getSQLXML(int) - */ - protected final SQLXML getSQLXML(int columnIndex) throws SQLException { - return rs.getSQLXML(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getSQLXML(java.lang.String) - */ - protected final SQLXML getSQLXML(String columnLabel) throws SQLException { - return rs.getSQLXML(columnLabel); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getShort(int) - */ - protected final short getShort(int columnIndex) throws SQLException { - return rs.getShort(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getShort(java.lang.String) - */ - protected final short getShort(String columnLabel) throws SQLException { - return rs.getShort(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getStatement() - */ - protected final Statement getStatement() throws SQLException { - return rs.getStatement(); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getString(int) - */ - protected final String getString(int columnIndex) throws SQLException { - return rs.getString(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getString(java.lang.String) - */ - protected final String getString(String columnLabel) throws SQLException { - return rs.getString(columnLabel); - } - - /** - * @param columnIndex - * @param cal - * @return - * @throws SQLException - * @see java.sql.ResultSet#getTime(int, java.util.Calendar) - */ - protected final Time getTime(int columnIndex, Calendar cal) throws SQLException { - return rs.getTime(columnIndex, cal); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getTime(int) - */ - protected final Time getTime(int columnIndex) throws SQLException { - return rs.getTime(columnIndex); - } - - /** - * @param columnLabel - * @param cal - * @return - * @throws SQLException - * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar) - */ - protected final Time getTime(String columnLabel, Calendar cal) throws SQLException { - return rs.getTime(columnLabel, cal); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getTime(java.lang.String) - */ - protected final Time getTime(String columnLabel) throws SQLException { - return rs.getTime(columnLabel); - } - - /** - * @param columnIndex - * @param cal - * @return - * @throws SQLException - * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar) - */ - protected final Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { - return rs.getTimestamp(columnIndex, cal); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getTimestamp(int) - */ - protected final Timestamp getTimestamp(int columnIndex) throws SQLException { - return rs.getTimestamp(columnIndex); - } - - /** - * @param columnLabel - * @param cal - * @return - * @throws SQLException - * @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar) - */ - protected final Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { - return rs.getTimestamp(columnLabel, cal); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getTimestamp(java.lang.String) - */ - protected final Timestamp getTimestamp(String columnLabel) throws SQLException { - return rs.getTimestamp(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getType() - */ - protected final int getType() throws SQLException { - return rs.getType(); - } - - /** - * @param columnIndex - * @return - * @throws SQLException - * @see java.sql.ResultSet#getURL(int) - */ - protected final URL getURL(int columnIndex) throws SQLException { - return rs.getURL(columnIndex); - } - - /** - * @param columnLabel - * @return - * @throws SQLException - * @see java.sql.ResultSet#getURL(java.lang.String) - */ - protected final URL getURL(String columnLabel) throws SQLException { - return rs.getURL(columnLabel); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#getWarnings() - */ - protected final SQLWarning getWarnings() throws SQLException { - return rs.getWarnings(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#insertRow() - */ - protected final void insertRow() throws SQLException { - rs.insertRow(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#isAfterLast() - */ - protected final boolean isAfterLast() throws SQLException { - return rs.isAfterLast(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#isBeforeFirst() - */ - protected final boolean isBeforeFirst() throws SQLException { - return rs.isBeforeFirst(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#isClosed() - */ - protected final boolean isClosed() throws SQLException { - return rs.isClosed(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#isFirst() - */ - protected final boolean isFirst() throws SQLException { - return rs.isFirst(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#isLast() - */ - protected final boolean isLast() throws SQLException { - return rs.isLast(); - } - - /** - * @param iface - * @return - * @throws SQLException - * @see java.sql.Wrapper#isWrapperFor(java.lang.Class) - */ - protected final boolean isWrapperFor(Class<?> iface) throws SQLException { - return rs.isWrapperFor(iface); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#last() - */ - protected final boolean last() throws SQLException { - return rs.last(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#moveToCurrentRow() - */ - protected final void moveToCurrentRow() throws SQLException { - rs.moveToCurrentRow(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#moveToInsertRow() - */ - protected final void moveToInsertRow() throws SQLException { - rs.moveToInsertRow(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#next() - */ - protected final boolean next() throws SQLException { - return rs.next(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#previous() - */ - protected final boolean previous() throws SQLException { - return rs.previous(); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#refreshRow() - */ - protected final void refreshRow() throws SQLException { - rs.refreshRow(); - } - - /** - * @param rows - * @return - * @throws SQLException - * @see java.sql.ResultSet#relative(int) - */ - protected final boolean relative(int rows) throws SQLException { - return rs.relative(rows); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#rowDeleted() - */ - protected final boolean rowDeleted() throws SQLException { - return rs.rowDeleted(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#rowInserted() - */ - protected final boolean rowInserted() throws SQLException { - return rs.rowInserted(); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#rowUpdated() - */ - protected final boolean rowUpdated() throws SQLException { - return rs.rowUpdated(); - } - - /** - * @param direction - * @throws SQLException - * @see java.sql.ResultSet#setFetchDirection(int) - */ - protected final void setFetchDirection(int direction) throws SQLException { - rs.setFetchDirection(direction); - } - - /** - * @param rows - * @throws SQLException - * @see java.sql.ResultSet#setFetchSize(int) - */ - protected final void setFetchSize(int rows) throws SQLException { - rs.setFetchSize(rows); - } - - /** - * @param iface - * @return - * @throws SQLException - * @see java.sql.Wrapper#unwrap(java.lang.Class) - */ - protected final <E> E unwrap(Class<E> iface) throws SQLException { - return rs.unwrap(iface); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateArray(int, java.sql.Array) - */ - protected final void updateArray(int columnIndex, Array x) throws SQLException { - rs.updateArray(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array) - */ - protected final void updateArray(String columnLabel, Array x) throws SQLException { - rs.updateArray(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int) - */ - protected final void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { - rs.updateAsciiStream(columnIndex, x, length); - } - - /** - * @param columnIndex - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, long) - */ - protected final void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { - rs.updateAsciiStream(columnIndex, x, length); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream) - */ - protected final void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { - rs.updateAsciiStream(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, int) - */ - protected final void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { - rs.updateAsciiStream(columnLabel, x, length); - } - - /** - * @param columnLabel - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, long) - */ - protected final void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { - rs.updateAsciiStream(columnLabel, x, length); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream) - */ - protected final void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { - rs.updateAsciiStream(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal) - */ - protected final void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { - rs.updateBigDecimal(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBigDecimal(java.lang.String, java.math.BigDecimal) - */ - protected final void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { - rs.updateBigDecimal(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int) - */ - protected final void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { - rs.updateBinaryStream(columnIndex, x, length); - } - - /** - * @param columnIndex - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, long) - */ - protected final void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { - rs.updateBinaryStream(columnIndex, x, length); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream) - */ - protected final void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { - rs.updateBinaryStream(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, int) - */ - protected final void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { - rs.updateBinaryStream(columnLabel, x, length); - } - - /** - * @param columnLabel - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, long) - */ - protected final void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { - rs.updateBinaryStream(columnLabel, x, length); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream) - */ - protected final void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { - rs.updateBinaryStream(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob) - */ - protected final void updateBlob(int columnIndex, Blob x) throws SQLException { - rs.updateBlob(columnIndex, x); - } - - /** - * @param columnIndex - * @param inputStream - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream, long) - */ - protected final void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { - rs.updateBlob(columnIndex, inputStream, length); - } - - /** - * @param columnIndex - * @param inputStream - * @throws SQLException - * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream) - */ - protected final void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { - rs.updateBlob(columnIndex, inputStream); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob) - */ - protected final void updateBlob(String columnLabel, Blob x) throws SQLException { - rs.updateBlob(columnLabel, x); - } - - /** - * @param columnLabel - * @param inputStream - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream, long) - */ - protected final void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { - rs.updateBlob(columnLabel, inputStream, length); - } - - /** - * @param columnLabel - * @param inputStream - * @throws SQLException - * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream) - */ - protected final void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { - rs.updateBlob(columnLabel, inputStream); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBoolean(int, boolean) - */ - protected final void updateBoolean(int columnIndex, boolean x) throws SQLException { - rs.updateBoolean(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean) - */ - protected final void updateBoolean(String columnLabel, boolean x) throws SQLException { - rs.updateBoolean(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateByte(int, byte) - */ - protected final void updateByte(int columnIndex, byte x) throws SQLException { - rs.updateByte(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateByte(java.lang.String, byte) - */ - protected final void updateByte(String columnLabel, byte x) throws SQLException { - rs.updateByte(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBytes(int, byte[]) - */ - protected final void updateBytes(int columnIndex, byte[] x) throws SQLException { - rs.updateBytes(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[]) - */ - protected final void updateBytes(String columnLabel, byte[] x) throws SQLException { - rs.updateBytes(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int) - */ - protected final void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { - rs.updateCharacterStream(columnIndex, x, length); - } - - /** - * @param columnIndex - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, long) - */ - protected final void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { - rs.updateCharacterStream(columnIndex, x, length); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader) - */ - protected final void updateCharacterStream(int columnIndex, Reader x) throws SQLException { - rs.updateCharacterStream(columnIndex, x); - } - - /** - * @param columnLabel - * @param reader - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, int) - */ - protected final void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { - rs.updateCharacterStream(columnLabel, reader, length); - } - - /** - * @param columnLabel - * @param reader - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, long) - */ - protected final void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { - rs.updateCharacterStream(columnLabel, reader, length); - } - - /** - * @param columnLabel - * @param reader - * @throws SQLException - * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader) - */ - protected final void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { - rs.updateCharacterStream(columnLabel, reader); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateClob(int, java.sql.Clob) - */ - protected final void updateClob(int columnIndex, Clob x) throws SQLException { - rs.updateClob(columnIndex, x); - } - - /** - * @param columnIndex - * @param reader - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateClob(int, java.io.Reader, long) - */ - protected final void updateClob(int columnIndex, Reader reader, long length) throws SQLException { - rs.updateClob(columnIndex, reader, length); - } - - /** - * @param columnIndex - * @param reader - * @throws SQLException - * @see java.sql.ResultSet#updateClob(int, java.io.Reader) - */ - protected final void updateClob(int columnIndex, Reader reader) throws SQLException { - rs.updateClob(columnIndex, reader); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob) - */ - protected final void updateClob(String columnLabel, Clob x) throws SQLException { - rs.updateClob(columnLabel, x); - } - - /** - * @param columnLabel - * @param reader - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader, long) - */ - protected final void updateClob(String columnLabel, Reader reader, long length) throws SQLException { - rs.updateClob(columnLabel, reader, length); - } - - /** - * @param columnLabel - * @param reader - * @throws SQLException - * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader) - */ - protected final void updateClob(String columnLabel, Reader reader) throws SQLException { - rs.updateClob(columnLabel, reader); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateDate(int, java.sql.Date) - */ - protected final void updateDate(int columnIndex, Date x) throws SQLException { - rs.updateDate(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date) - */ - protected final void updateDate(String columnLabel, Date x) throws SQLException { - rs.updateDate(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateDouble(int, double) - */ - protected final void updateDouble(int columnIndex, double x) throws SQLException { - rs.updateDouble(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateDouble(java.lang.String, double) - */ - protected final void updateDouble(String columnLabel, double x) throws SQLException { - rs.updateDouble(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateFloat(int, float) - */ - protected final void updateFloat(int columnIndex, float x) throws SQLException { - rs.updateFloat(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateFloat(java.lang.String, float) - */ - protected final void updateFloat(String columnLabel, float x) throws SQLException { - rs.updateFloat(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateInt(int, int) - */ - protected final void updateInt(int columnIndex, int x) throws SQLException { - rs.updateInt(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateInt(java.lang.String, int) - */ - protected final void updateInt(String columnLabel, int x) throws SQLException { - rs.updateInt(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateLong(int, long) - */ - protected final void updateLong(int columnIndex, long x) throws SQLException { - rs.updateLong(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateLong(java.lang.String, long) - */ - protected final void updateLong(String columnLabel, long x) throws SQLException { - rs.updateLong(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader, long) - */ - protected final void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { - rs.updateNCharacterStream(columnIndex, x, length); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader) - */ - protected final void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { - rs.updateNCharacterStream(columnIndex, x); - } - - /** - * @param columnLabel - * @param reader - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader, long) - */ - protected final void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { - rs.updateNCharacterStream(columnLabel, reader, length); - } - - /** - * @param columnLabel - * @param reader - * @throws SQLException - * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader) - */ - protected final void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { - rs.updateNCharacterStream(columnLabel, reader); - } - - /** - * @param columnIndex - * @param nClob - * @throws SQLException - * @see java.sql.ResultSet#updateNClob(int, java.sql.NClob) - */ - protected final void updateNClob(int columnIndex, NClob nClob) throws SQLException { - rs.updateNClob(columnIndex, nClob); - } - - /** - * @param columnIndex - * @param reader - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateNClob(int, java.io.Reader, long) - */ - protected final void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { - rs.updateNClob(columnIndex, reader, length); - } - - /** - * @param columnIndex - * @param reader - * @throws SQLException - * @see java.sql.ResultSet#updateNClob(int, java.io.Reader) - */ - protected final void updateNClob(int columnIndex, Reader reader) throws SQLException { - rs.updateNClob(columnIndex, reader); - } - - /** - * @param columnLabel - * @param nClob - * @throws SQLException - * @see java.sql.ResultSet#updateNClob(java.lang.String, java.sql.NClob) - */ - protected final void updateNClob(String columnLabel, NClob nClob) throws SQLException { - rs.updateNClob(columnLabel, nClob); - } - - /** - * @param columnLabel - * @param reader - * @param length - * @throws SQLException - * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader, long) - */ - protected final void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { - rs.updateNClob(columnLabel, reader, length); - } - - /** - * @param columnLabel - * @param reader - * @throws SQLException - * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader) - */ - protected final void updateNClob(String columnLabel, Reader reader) throws SQLException { - rs.updateNClob(columnLabel, reader); - } - - /** - * @param columnIndex - * @param nString - * @throws SQLException - * @see java.sql.ResultSet#updateNString(int, java.lang.String) - */ - protected final void updateNString(int columnIndex, String nString) throws SQLException { - rs.updateNString(columnIndex, nString); - } - - /** - * @param columnLabel - * @param nString - * @throws SQLException - * @see java.sql.ResultSet#updateNString(java.lang.String, java.lang.String) - */ - protected final void updateNString(String columnLabel, String nString) throws SQLException { - rs.updateNString(columnLabel, nString); - } - - /** - * @param columnIndex - * @throws SQLException - * @see java.sql.ResultSet#updateNull(int) - */ - protected final void updateNull(int columnIndex) throws SQLException { - rs.updateNull(columnIndex); - } - - /** - * @param columnLabel - * @throws SQLException - * @see java.sql.ResultSet#updateNull(java.lang.String) - */ - protected final void updateNull(String columnLabel) throws SQLException { - rs.updateNull(columnLabel); - } - - /** - * @param columnIndex - * @param x - * @param scaleOrLength - * @throws SQLException - * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int) - */ - protected final void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { - rs.updateObject(columnIndex, x, scaleOrLength); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateObject(int, java.lang.Object) - */ - protected final void updateObject(int columnIndex, Object x) throws SQLException { - rs.updateObject(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @param scaleOrLength - * @throws SQLException - * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object, int) - */ - protected final void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { - rs.updateObject(columnLabel, x, scaleOrLength); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object) - */ - protected final void updateObject(String columnLabel, Object x) throws SQLException { - rs.updateObject(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateRef(int, java.sql.Ref) - */ - protected final void updateRef(int columnIndex, Ref x) throws SQLException { - rs.updateRef(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref) - */ - protected final void updateRef(String columnLabel, Ref x) throws SQLException { - rs.updateRef(columnLabel, x); - } - - /** - * @throws SQLException - * @see java.sql.ResultSet#updateRow() - */ - protected final void updateRow() throws SQLException { - rs.updateRow(); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateRowId(int, java.sql.RowId) - */ - protected final void updateRowId(int columnIndex, RowId x) throws SQLException { - rs.updateRowId(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateRowId(java.lang.String, java.sql.RowId) - */ - protected final void updateRowId(String columnLabel, RowId x) throws SQLException { - rs.updateRowId(columnLabel, x); - } - - /** - * @param columnIndex - * @param xmlObject - * @throws SQLException - * @see java.sql.ResultSet#updateSQLXML(int, java.sql.SQLXML) - */ - protected final void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { - rs.updateSQLXML(columnIndex, xmlObject); - } - - /** - * @param columnLabel - * @param xmlObject - * @throws SQLException - * @see java.sql.ResultSet#updateSQLXML(java.lang.String, java.sql.SQLXML) - */ - protected final void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { - rs.updateSQLXML(columnLabel, xmlObject); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateShort(int, short) - */ - protected final void updateShort(int columnIndex, short x) throws SQLException { - rs.updateShort(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateShort(java.lang.String, short) - */ - protected final void updateShort(String columnLabel, short x) throws SQLException { - rs.updateShort(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateString(int, java.lang.String) - */ - protected final void updateString(int columnIndex, String x) throws SQLException { - rs.updateString(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String) - */ - protected final void updateString(String columnLabel, String x) throws SQLException { - rs.updateString(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateTime(int, java.sql.Time) - */ - protected final void updateTime(int columnIndex, Time x) throws SQLException { - rs.updateTime(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time) - */ - protected final void updateTime(String columnLabel, Time x) throws SQLException { - rs.updateTime(columnLabel, x); - } - - /** - * @param columnIndex - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp) - */ - protected final void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { - rs.updateTimestamp(columnIndex, x); - } - - /** - * @param columnLabel - * @param x - * @throws SQLException - * @see java.sql.ResultSet#updateTimestamp(java.lang.String, java.sql.Timestamp) - */ - protected final void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { - rs.updateTimestamp(columnLabel, x); - } - - /** - * @return - * @throws SQLException - * @see java.sql.ResultSet#wasNull() - */ - protected final boolean wasNull() throws SQLException { - return rs.wasNull(); - } - - protected final ResultSet getAdaptedResultSet() { - return rs; - } - -} \ No newline at end of file
