From 384becea89fe67d2804d340f8e10b59f9a295685 Mon Sep 17 00:00:00 2001 From: tball Date: Wed, 14 Sep 2016 13:41:34 -0700 Subject: [PATCH] Updated java.sql package to OpenJDK. Change on 2016/09/14 by tball ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133167563 --- .../luni/src/main/java/java/sql/Array.java | 173 - .../java/java/sql/BatchUpdateException.java | 233 - .../luni/src/main/java/java/sql/Blob.java | 191 - .../main/java/java/sql/CallableStatement.java | 1621 ------- .../main/java/java/sql/ClientInfoStatus.java | 28 - .../luni/src/main/java/java/sql/Clob.java | 194 - .../src/main/java/java/sql/Connection.java | 841 ---- .../main/java/java/sql/DataTruncation.java | 163 - .../main/java/java/sql/DatabaseMetaData.java | 3237 ------------- .../luni/src/main/java/java/sql/Date.java | 246 - .../luni/src/main/java/java/sql/Driver.java | 121 - .../src/main/java/java/sql/DriverManager.java | 397 -- .../java/java/sql/DriverPropertyInfo.java | 73 - .../luni/src/main/java/java/sql/NClob.java | 21 - .../main/java/java/sql/ParameterMetaData.java | 189 - .../main/java/java/sql/PreparedStatement.java | 918 ---- .../luni/src/main/java/java/sql/Ref.java | 82 - .../src/main/java/java/sql/ResultSet.java | 2269 --------- .../main/java/java/sql/ResultSetMetaData.java | 282 -- .../luni/src/main/java/java/sql/RowId.java | 36 - .../src/main/java/java/sql/RowIdLifetime.java | 28 - .../java/java/sql/SQLClientInfoException.java | 212 - .../luni/src/main/java/java/sql/SQLData.java | 114 - .../main/java/java/sql/SQLDataException.java | 144 - .../src/main/java/java/sql/SQLException.java | 260 -- .../sql/SQLFeatureNotSupportedException.java | 147 - .../luni/src/main/java/java/sql/SQLInput.java | 358 -- ...IntegrityConstraintViolationException.java | 153 - .../SQLInvalidAuthorizationSpecException.java | 151 - .../SQLNonTransientConnectionException.java | 151 - .../java/sql/SQLNonTransientException.java | 141 - .../src/main/java/java/sql/SQLOutput.java | 334 -- .../src/main/java/java/sql/SQLPermission.java | 36 - .../java/sql/SQLRecoverableException.java | 141 - .../java/sql/SQLSyntaxErrorException.java | 141 - .../java/java/sql/SQLTimeoutException.java | 139 - .../sql/SQLTransactionRollbackException.java | 143 - .../sql/SQLTransientConnectionException.java | 143 - .../java/java/sql/SQLTransientException.java | 139 - .../src/main/java/java/sql/SQLWarning.java | 152 - .../luni/src/main/java/java/sql/SQLXML.java | 86 - .../src/main/java/java/sql/Savepoint.java | 45 - .../src/main/java/java/sql/Statement.java | 670 --- .../luni/src/main/java/java/sql/Struct.java | 68 - .../luni/src/main/java/java/sql/Time.java | 247 - .../src/main/java/java/sql/Timestamp.java | 512 --- .../luni/src/main/java/java/sql/Types.java | 214 - .../luni/src/main/java/java/sql/Wrapper.java | 52 - .../ojluni/src/main/java/java/sql/Array.java | 366 ++ .../java/java/sql/BatchUpdateException.java | 340 ++ .../ojluni/src/main/java/java/sql/Blob.java | 304 ++ .../main/java/java/sql/CallableStatement.java | 2440 ++++++++++ .../main/java/java/sql/ClientInfoStatus.java | 62 + .../ojluni/src/main/java/java/sql/Clob.java | 348 ++ .../src/main/java/java/sql/Connection.java | 1306 ++++++ .../main/java/java/sql/DataTruncation.java | 188 + .../main/java/java/sql/DatabaseMetaData.java | 3577 +++++++++++++++ .../ojluni/src/main/java/java/sql/Date.java | 252 + .../ojluni/src/main/java/java/sql/Driver.java | 156 + .../java/java/sql/DriverPropertyInfo.java | 84 + .../ojluni/src/main/java/java/sql/NClob.java | 55 + .../main/java/java/sql/ParameterMetaData.java | 196 + .../main/java/java/sql/PreparedStatement.java | 1225 +++++ .../ojluni/src/main/java/java/sql/Ref.java | 127 + .../src/main/java/java/sql/ResultSet.java | 4082 +++++++++++++++++ .../main/java/java/sql/ResultSetMetaData.java | 277 ++ .../ojluni/src/main/java/java/sql/RowId.java | 120 + .../src/main/java/java/sql/RowIdLifetime.java | 67 + .../java/java/sql/SQLClientInfoException.java | 321 ++ .../src/main/java/java/sql/SQLData.java | 137 + .../main/java/java/sql/SQLDataException.java | 173 + .../sql/SQLFeatureNotSupportedException.java | 179 + .../src/main/java/java/sql/SQLInput.java | 424 ++ ...IntegrityConstraintViolationException.java | 174 + .../SQLInvalidAuthorizationSpecException.java | 174 + .../SQLNonTransientConnectionException.java | 176 + .../java/sql/SQLNonTransientException.java | 175 + .../src/main/java/java/sql/SQLOutput.java | 437 ++ .../src/main/java/java/sql/SQLPermission.java | 43 + .../java/sql/SQLRecoverableException.java | 175 + .../java/sql/SQLSyntaxErrorException.java | 173 + .../java/java/sql/SQLTimeoutException.java | 171 + .../sql/SQLTransactionRollbackException.java | 173 + .../sql/SQLTransientConnectionException.java | 174 + .../java/java/sql/SQLTransientException.java | 172 + .../src/main/java/java/sql/SQLWarning.java | 217 + .../ojluni/src/main/java/java/sql/SQLXML.java | 425 ++ .../src/main/java/java/sql/Savepoint.java | 60 + .../src/main/java/java/sql/Statement.java | 1033 +++++ .../ojluni/src/main/java/java/sql/Struct.java | 106 + .../ojluni/src/main/java/java/sql/Time.java | 248 + .../src/main/java/java/sql/Timestamp.java | 532 +++ .../ojluni/src/main/java/java/sql/Types.java | 314 ++ .../src/main/java/java/sql/Wrapper.java | 80 + .../src/main/java/java/sql/package.html | 326 ++ .../java/sun/reflect/CallerSensitive.java | 44 + .../src/objc/java/java/sql/DriverManager.java | 609 +++ .../src/objc/java/java/sql/SQLException.java | 395 ++ jre_emul/java_sources.mk | 1 + 99 files changed, 23413 insertions(+), 16436 deletions(-) delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Array.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/BatchUpdateException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Blob.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/CallableStatement.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/ClientInfoStatus.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Clob.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Connection.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/DataTruncation.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/DatabaseMetaData.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Date.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Driver.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/DriverManager.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/DriverPropertyInfo.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/NClob.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/ParameterMetaData.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/PreparedStatement.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Ref.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/ResultSet.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/ResultSetMetaData.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/RowId.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/RowIdLifetime.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLClientInfoException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLData.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLDataException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLFeatureNotSupportedException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLInput.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLIntegrityConstraintViolationException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLInvalidAuthorizationSpecException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLNonTransientConnectionException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLNonTransientException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLOutput.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLPermission.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLRecoverableException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLSyntaxErrorException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTimeoutException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransactionRollbackException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransientConnectionException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransientException.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLWarning.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/SQLXML.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Savepoint.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Statement.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Struct.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Time.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Timestamp.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Types.java delete mode 100644 jre_emul/android/libcore/luni/src/main/java/java/sql/Wrapper.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Array.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/BatchUpdateException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Blob.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/CallableStatement.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ClientInfoStatus.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Clob.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Connection.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DataTruncation.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DatabaseMetaData.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Date.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Driver.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DriverPropertyInfo.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/NClob.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ParameterMetaData.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/PreparedStatement.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Ref.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ResultSet.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ResultSetMetaData.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/RowId.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/RowIdLifetime.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLClientInfoException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLData.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLDataException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLFeatureNotSupportedException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLInput.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLIntegrityConstraintViolationException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLInvalidAuthorizationSpecException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLNonTransientConnectionException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLNonTransientException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLOutput.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLPermission.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLRecoverableException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLSyntaxErrorException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTimeoutException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransactionRollbackException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransientConnectionException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransientException.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLWarning.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLXML.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Savepoint.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Statement.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Struct.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Time.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Timestamp.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Types.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Wrapper.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/package.html create mode 100644 jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/CallerSensitive.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/objc/java/java/sql/DriverManager.java create mode 100644 jre_emul/android/platform/libcore/ojluni/src/objc/java/java/sql/SQLException.java diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Array.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Array.java deleted file mode 100644 index 2ad1ea4d2a..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Array.java +++ /dev/null @@ -1,173 +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 java.sql; - -import java.util.Map; - -/** - * A Java representation of the SQL {@code ARRAY} type. - */ -public interface Array { - - /** - * Retrieves the contents of the SQL {@code ARRAY} value as a Java array - * object. - * - * @return A Java array containing the elements of this Array - * @throws SQLException - * if there is a database error. - */ - public Object getArray() throws SQLException; - - /** - * Returns part of the SQL {@code ARRAY} associated with this array, - * starting at a particular {@code index} and comprising up to {@code count} - * successive elements of the SQL array. - * - * @param index - * the start position in the array where the values are - * retrieved. - * @param count - * the number of elements to retrieve. - * @return A Java array containing the desired set of elements from this Array - * @throws SQLException - * if there is a database error. - */ - public Object getArray(long index, int count) throws SQLException; - - /** - * Returns part of the SQL {@code ARRAY} associated with this array, - * starting at a particular {@code index} and comprising up to {@code count} - * successive elements of the SQL array. - * - * @param index - * the start position in the array where the values are - * retrieved. - * @param count - * the number of elements to retrieve. - * @param map - * the map defining the correspondence between SQL type names - * and Java types. - * @return A Java array containing the desired set of elements from this Array - * @throws SQLException - * if there is a database error. - */ - public Object getArray(long index, int count, Map> map) - throws SQLException; - - /** - * Returns the data from the underlying SQL {@code ARRAY} as a Java array. - * - * @param map - * the map defining the correspondence between SQL type names - * and Java types. - * @return A Java array containing the elements of this array - * @throws SQLException - * if there is a database error. - */ - public Object getArray(Map> map) throws SQLException; - - /** - * Returns the JDBC type of the entries in this array's underlying - * SQL array. - * - * @return An integer constant from the {@code java.sql.Types} class - * @throws SQLException - * if there is a database error. - */ - public int getBaseType() throws SQLException; - - /** - * Returns the SQL type name of the entries in this array's underlying - * SQL array. - * - * @return The database specific name or a fully-qualified SQL type name. - * @throws SQLException - * if there is a database error. - */ - public String getBaseTypeName() throws SQLException; - - /** - * Returns a ResultSet object which holds the entries of the SQL {@code - * ARRAY} associated with this array. - * - * @return the elements of the array as a {@code ResultSet}. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getResultSet() throws SQLException; - - /** - * Returns a {@code ResultSet} object that holds the entries of a subarray, - * beginning at a particular index and comprising up to {@code count} - * successive entries. - * - * @param index - * the start position in the array where the values are - * retrieved. - * @param count - * the number of elements to retrieve. - * @return the elements of the array as a {@code ResultSet}. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getResultSet(long index, int count) throws SQLException; - - /** - * Returns a {@code ResultSet} object that holds the entries of a subarray, - * beginning at a particular index and comprising up to {@code count} - * successive entries. - * - * @param index - * the start position in the array where the values are - * retrieved. - * @param count - * the number of elements to retrieve. - * @param map - * the map defining the correspondence between SQL type names - * and Java types. - * @return the {@code ResultSet} the array's custom type values. if a - * database error has occurred. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getResultSet(long index, int count, - Map> map) throws SQLException; - - /** - * Returns a {@code ResultSet} object which holds the entries of the SQL - * {@code ARRAY} associated with this array. - * - * @param map - * the map defining the correspondence between SQL type names - * and Java types. - * @return the array as a {@code ResultSet}. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getResultSet(Map> map) - throws SQLException; - - /** - * Frees any resources held by this array. After {@code free} is called, calling - * method other than {@code free} will throw {@code SQLException} (calling {@code free} - * repeatedly will do nothing). - * @throws SQLException - */ - public void free() throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/BatchUpdateException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/BatchUpdateException.java deleted file mode 100644 index 352ab6ab70..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/BatchUpdateException.java +++ /dev/null @@ -1,233 +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 java.sql; - -import java.io.Serializable; - -/** - * This exception is thrown if a problem occurs during a batch update operation. - *

- * A {@code BatchUpdateException} provides additional information about the - * problem that occurred, compared with a standard {@code SQLException}. It - * supplies update counts for successful commands which were executed before the - * exception was encountered. - *

- * The element order in the array of update counts matches the order that the - * commands were added to the batch operation. - *

- * Once a batch update command fails and a {@code BatchUpdateException} is - * thrown, the JDBC driver may continue processing the remaining commands in the - * batch. If the driver does process more commands after the problem occurs, the - * array returned by {@code BatchUpdateException.getUpdateCounts} has an element - * for every command in the batch, not only those that executed successfully. In - * this case, the array element for any command which encountered a problem is - * set to {@code Statement.EXECUTE_FAILED}. - */ -public class BatchUpdateException extends SQLException implements Serializable { - - private static final long serialVersionUID = 5977529877145521757L; - - private int[] updateCounts = null; - - /** - * Creates a default {@code BatchUpdateException} with the parameters - * reason, SQLState, and update counts set to {@code - * null} and the vendor code set to 0. - */ - public BatchUpdateException() { - } - - /** - * Creates an BatchUpdateException object. The reason is set to - * null if cause == null otherwise to cause.toString(), and the cause - * Throwable object is set to the given cause Throwable object. - * - * @param cause the Throwable object for the underlying reason this SQLException - * - * @since 1.6 - */ - public BatchUpdateException(Throwable cause) { - this(null, cause); - } - - /** - * Creates an BatchUpdateException object. The Reason string is set to the - * null if cause == null otherwise to cause.toString(), and the cause - * Throwable object is set to the given cause Throwable object. SQLState is - * initialized to null while vendorCode is zero. - * - * @param cause the Throwable object for the underlying reason this SQLException - * - * @since 1.6 - */ - public BatchUpdateException(int[] updateCounts, Throwable cause) { - super(cause); - this.updateCounts = updateCounts; - } - - /** - * Creates an BatchUpdateException object. The cause Throwable object is set - * to the given cause Throwable object. SQLState is initialized to null - * while vendorCode is zero. - * - * @param cause the Throwable object for the underlying reason this SQLException - * - * @since 1.6 - */ - public BatchUpdateException(String reason, int[] updateCounts, - Throwable cause) { - super(reason, cause); - this.updateCounts = updateCounts; - } - - /** - * Creates an BatchUpdateException object. The cause Throwable object is set - * to the given cause Throwable object and the updateCounts array set to the - * int array parameter. SQLState is initialized to null while vendorCode is - * zero. - * - * @param cause the Throwable object for the underlying reason this SQLException - * - * @since 1.6 - */ - public BatchUpdateException(String reason, String SQLState, - int[] updateCounts, Throwable cause) { - super(reason, SQLState, cause); - this.updateCounts = updateCounts; - } - - /** - * Creates an BatchUpdateException object. The cause Throwable object is set - * to the given cause Throwable object and the updateCounts array set to the - * int array parameter. VendorCode is set to the given vendorCode. SQLState - * is initialized to null while vendorCode is zero. - * - * @param cause the Throwable object for the underlying reason this SQLException - * - * @since 1.6 - */ - public BatchUpdateException(String reason, String SQLState, int vendorCode, - int[] updateCounts, Throwable cause) { - super(reason, SQLState, vendorCode, cause); - this.updateCounts = updateCounts; - } - - /** - * Creates a {@code BatchUpdateException} with the {@code updateCounts} set - * to the supplied value. All other fields are set to their - * default values. - * - * @param updateCounts - * the array of {@code updateCounts} giving the number of - * successful updates (or another status code) for each command - * in the batch that was attempted. - */ - public BatchUpdateException(int[] updateCounts) { - this.updateCounts = updateCounts; - } - - /** - * Creates a {@code BatchUpdateException} with the {@code updateCounts} and - * {@code reason} set to the supplied values. All other fields are set to their - * default values. - * - * @param reason - * the message providing information about the source of this - * exception. - * @param updateCounts - * the array of {@code updateCounts} giving the number of - * successful updates (or another status code) for each command - * in the batch that was attempted. - */ - public BatchUpdateException(String reason, int[] updateCounts) { - super(reason); - this.updateCounts = updateCounts; - } - - /** - * Creates a {@code BatchUpdateException} with the {@code reason}, {@code - * SQLState} and {@code updateCounts} set to the supplied values. All other - * fields are set to their default values. - * - * @param reason - * the message providing information about the source of this - * exception. - * @param SQLState - * the X/OPEN value to use for the {@code SQLState} - * @param updateCounts - * the array of {@code updateCounts} giving the number of - * successful updates (or another status code) for each command - * in the batch that was attempted. - */ - public BatchUpdateException(String reason, String SQLState, - int[] updateCounts) { - super(reason, SQLState); - this.updateCounts = updateCounts; - } - - /** - * Creates a {@code BatchUpdateException} for the case where all relevant - * information is provided. - * - * @param reason - * the message providing information about the source of this - * exception. - * @param SQLState - * the X/OPEN value to use for the {@code SQLState}. - * @param vendorCode - * the value to use for the vendor error code. - * @param updateCounts - * the array of {@code updateCounts} giving the number of - * successful updates (or another status code) for each command - * in the batch that was attempted. - */ - public BatchUpdateException(String reason, String SQLState, int vendorCode, - int[] updateCounts) { - super(reason, SQLState, vendorCode); - this.updateCounts = updateCounts; - } - - /** - * Gets the update count array giving status information for every - * command that was attempted in the batch. - *

- * If a batch update command fails and a {@code BatchUpdateException} is - * thrown, the JDBC driver may continue processing the remaining commands in - * the batch. If the driver does so, the array returned by {@code - * BatchUpdateException.getUpdateCounts} has an element for every command in - * the batch, not only those that executed successfully. In this case, the - * array element for any command which encountered a problem is set to - * {@code Statement.EXECUTE_FAILED}. - * - * @return an array that contains the successful update counts, before this - * exception was thrown. Alternatively, if the driver continues to - * process commands following an error, for each successive command - * there is a corresponding element in the array giving one of the - * following status values: - *

    - *
  1. the number of successful updates
  2. {@code - * Statement.SUCCESS_NO_INFO} indicating that the command completed - * successfully, but the amount of altered rows is unknown.
  3. - *
  4. {@code Statement.EXECUTE_FAILED} indicating that the command - * was unsuccessful.
  5. - *
- */ - public int[] getUpdateCounts() { - return updateCounts; - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Blob.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Blob.java deleted file mode 100644 index d465a1f6ac..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Blob.java +++ /dev/null @@ -1,191 +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 java.sql; - -import java.io.InputStream; -import java.io.OutputStream; - -/** - * A Java interface representing the SQL {@code BLOB} type. - *

- * An SQL {@code BLOB} type stores a large array of binary data (bytes) as the - * value in a column of a database. - *

- * The {@code java.sql.Blob} interface provides methods for setting and - * retrieving data in the {@code Blob}, for querying {@code Blob} data length, - * and for searching for data within the {@code Blob}. - */ -public interface Blob { - - /** - * Retrieves this {@code Blob} object as a binary stream. - * - * @return a binary {@code InputStream} giving access to the {@code Blob} - * data. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public InputStream getBinaryStream() throws SQLException; - - /** - * Retrieves {@code length} bytes from this {@code Blob}, starting at 1-based - * offset {@code pos}, and returns them as a binary stream. - * - * @return a binary {@code InputStream} giving access to the {@code Blob} - * data. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public InputStream getBinaryStream(long pos, long length) throws SQLException; - - /** - * Gets a portion of the value of this {@code Blob} as an array of bytes. - * - * @param pos - * the position of the first byte in the {@code Blob} to get, - * where the first byte in the {@code Blob} has position 1. - * @param length - * the number of bytes to get. - * @return a byte array containing the data from the {@code Blob}, starting - * at {@code pos} and is up to {@code length} bytes long. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public byte[] getBytes(long pos, int length) throws SQLException; - - /** - * Gets the number of bytes in this {@code Blob} object. - * - * @return a {@code long} value with the length of the {@code Blob} in - * bytes. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public long length() throws SQLException; - - /** - * Search for the position in this {@code Blob} at which a specified pattern - * begins, starting at a specified position within the {@code Blob}. - * - * @param pattern - * a {@code Blob} containing the pattern of data to search for in - * this {@code Blob}. - * @param start - * the position within this {@code Blob} to start the search, - * where the first position in the {@code Blob} is {@code 1}. - * @return a {@code long} value with the position at which the pattern - * begins. Returns {@code -1} if the pattern is not found in this - * {@code Blob}. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public long position(Blob pattern, long start) throws SQLException; - - /** - * Search for the position in this {@code Blob} at which the specified - * pattern begins, starting at a specified position within the {@code Blob}. - * - * @param pattern - * a byte array containing the pattern of data to search for in - * this {@code Blob}. - * @param start - * the position within this {@code Blob} to start the search, - * where the first position in the {@code Blob} is {@code 1}. - * @return a {@code long} value with the position at which the pattern - * begins. Returns {@code -1} if the pattern is not found in this - * {@code Blob}. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public long position(byte[] pattern, long start) throws SQLException; - - /** - * Gets a stream that can be used to write binary data to this {@code Blob}. - * - * @param pos - * the position within this {@code Blob} at which to start - * writing, where the first position in the {@code Blob} is - * {@code 1}. - * @return a binary {@code InputStream} which can be used to write data into - * the {@code Blob} starting at the specified position. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public OutputStream setBinaryStream(long pos) throws SQLException; - - /** - * Writes a specified array of bytes to this {@code Blob} object, starting - * at a specified position. Returns the number of bytes written. - * - * @param pos - * the position within this {@code Blob} at which to start - * writing, where the first position in the {@code Blob} is - * {@code 1}. - * @param theBytes - * an array of bytes to write into the {@code Blob}. - * @return an integer containing the number of bytes written to the {@code - * Blob}. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public int setBytes(long pos, byte[] theBytes) throws SQLException; - - /** - * Writes a portion of a specified byte array to this {@code Blob}. Returns - * the number of bytes written. - * - * @param pos - * the position within this {@code Blob} at which to start - * writing, where the first position in the {@code Blob} is - * {@code 1}. - * @param theBytes - * an array of bytes to write into the {@code Blob}. - * @param offset - * the offset into the byte array from which to start writing - * data - the first byte in the array has offset {@code 0}. - * @param len - * the length of data to write in number of bytes. - * @return an integer containing the number of bytes written to the {@code - * Blob}. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public int setBytes(long pos, byte[] theBytes, int offset, int len) - throws SQLException; - - /** - * Truncate the value of this {@code Blob} object to a specified length in - * bytes. - * - * @param len - * the length of data in bytes after which this {@code Blob} - * is to be truncated. - * @throws SQLException - * if an error occurs accessing the {@code Blob}. - */ - public void truncate(long len) throws SQLException; - - /** - * Frees any resources held by this blob. After {@code free} is called, calling - * method other than {@code free} will throw {@code SQLException} (calling {@code free} - * repeatedly will do nothing). - * - * @throws SQLException - */ - public void free() throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/CallableStatement.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/CallableStatement.java deleted file mode 100644 index 162841ddb4..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/CallableStatement.java +++ /dev/null @@ -1,1621 +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 java.sql; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.util.Calendar; -import java.util.Map; - -/** - * An interface used to call Stored Procedures. - *

- * The JDBC API provides an SQL escape syntax allowing Stored Procedures - * to be called in a standard way for all databases. The JDBC escape syntax has - * two forms. One form includes a result parameter. The second form does not - * include a result parameter. Where the result parameter is used, it must be - * declared as an {@code OUT} parameter. Other parameters can be declared as - * {@code IN}, {@code OUT}, or {@code INOUT}. Parameters are referenced either by - * name or by a numerical index starting at 1. - *

- * The correct syntax is: - *

- *
- * { ?= call <procedurename> [( [parameter1,parameter2,...] )] } - *
- *
- * { call <procedurename> [( [parameter1,parameter2,...] )] } - *
- *
- * {@code IN} parameters are set before calling the procedure, - * using the setter methods which are inherited from {@code PreparedStatement}. - * For {@code OUT} parameters, their type must be registered before executing - * the stored procedure. The values are retrieved using the getter methods - * defined in the {@code CallableStatement} interface. - *

- * {@code CallableStatement}s can return one or more {@code ResultSets}. In the - * event that multiple {@code ResultSets} are returned, they are accessed using - * the methods inherited from the {@code Statement} interface. - */ -public interface CallableStatement extends PreparedStatement { - - /** - * Gets the value of a specified JDBC {@code ARRAY} parameter as a - * {@code java.sql.Array}. - * - * @param parameterIndex - * the parameter index, where the first parameter has - * index 1. - * @return a {@code java.sql.Array} containing the parameter value. - * @throws SQLException - * if a database error occurs. - */ - public Array getArray(int parameterIndex) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code ARRAY} parameter as a {@code - * java.sql.Array}. - * - * @param parameterName - * the desired parameter's name. - * @return a {@code java.sql.Array} containing the parameter's value. - * @throws SQLException - * if there is a problem accessing the database. - */ - public Array getArray(String parameterName) throws SQLException; - - /** - * Returns a new {@link BigDecimal} representation of the JDBC {@code - * NUMERIC} parameter specified by the input index. - * - * @param parameterIndex - * the parameter number index where the first parameter has index - * 1. - * @return a {@code java.math.BigDecimal} representing the value of the - * specified parameter. The value {@code null} is returned if - * the parameter in question is an SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public BigDecimal getBigDecimal(int parameterIndex) throws SQLException; - - /** - * Returns a new {@link BigDecimal} representation of the JDBC {@code - * NUMERIC} parameter specified by the input index. The number of digits - * after the decimal point is specified by {@code scale}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param scale - * the number of digits after the decimal point to get. - * @return a {@code java.math.BigDecimal} representing the value of the - * specified parameter. The value {@code null} is returned if - * the parameter in question is an SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @deprecated Use {@link #getBigDecimal(int)} or {@link #getBigDecimal(String)} instead. - */ - @Deprecated - public BigDecimal getBigDecimal(int parameterIndex, int scale) - throws SQLException; - - /** - * Returns a new {@link BigDecimal} representation of the JDBC {@code - * NUMERIC} parameter specified by the input name. - * - * @param parameterName - * the desired parameter's name. - * @return a {@code java.math.BigDecimal} representing the value of the - * specified parameter. The value {@code null} is returned if - * the parameter in question is an SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public BigDecimal getBigDecimal(String parameterName) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code BLOB} parameter as a {@code - * java.sql.Blob}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return a {@code java.sql.Blob} representing the value of the - * specified parameter. The value {@code null} is returned if - * the parameter in question is an SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public Blob getBlob(int parameterIndex) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code BLOB} parameter as a {@code - * java.sql.Blob}. - * - * @param parameterName - * the desired parameter's name. - * @return a {@code java.sql.Blob} representing the value of the - * specified parameter. The value {@code null} is returned if - * the parameter in question is an SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public Blob getBlob(String parameterName) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code BIT} parameter as a boolean. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return a {@code boolean} representing the parameter value. {@code false} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public boolean getBoolean(int parameterIndex) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code BIT} parameter as a {@code - * boolean}. - * - * @param parameterName - * the desired parameter's name. - * @return a {@code boolean} representation of the value of the parameter. - * {@code false} is returned if the SQL value is {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public boolean getBoolean(String parameterName) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code TINYINT} parameter as a {@code - * byte}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return a {@code byte} representation of the value of the parameter. - * {@code 0} is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public byte getByte(int parameterIndex) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code TINYINT} parameter as a Java - * {@code byte}. - * - * @param parameterName - * the desired parameter's name. - * @return a {@code byte} representation of the value of the parameter. - * {@code 0} is returned if the SQL value is {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public byte getByte(String parameterName) throws SQLException; - - /** - * Returns a byte array representation of the indexed JDBC {@code BINARY} or - * {@code VARBINARY} parameter. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return an array of bytes giving the value of the parameter. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public byte[] getBytes(int parameterIndex) throws SQLException; - - /** - * Returns a byte array representation of the named JDBC {@code BINARY} or - * {@code VARBINARY} parameter. - * - * @param parameterName - * the name of the parameter. - * @return an array of bytes giving the value of the parameter. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public byte[] getBytes(String parameterName) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code CLOB} parameter as a {@code - * java.sql.Clob}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return a {@code java.sql.Clob} representing the value of the - * parameter. {@code null} is returned if the value is SQL - * {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Clob - */ - public Clob getClob(int parameterIndex) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code CLOB} parameter as a {@code - * java.sql.Clob}. - * - * @param parameterName - * the name of the parameter. - * @return a {@code java.sql.Clob} with the value of the parameter. {@code - * null} is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Clob - */ - public Clob getClob(String parameterName) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code DATE} parameter as a {@code - * java.sql.Date}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return the {@code java.sql.Date} representing the parameter's value. - * {@code null} is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Date - */ - public Date getDate(int parameterIndex) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code DATE} parameter as a {@code - * java.sql.Date}, using the specified {@code Calendar} to construct the date. - * - *

The JDBC driver uses the calendar to create the Date using a particular - * timezone and locale. The default behavior of the driver is to use the VM defaults. - * See "Be wary of the default locale". - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param cal - * the {@code Calendar} to use to construct the date - * @return the {@code java.sql.Date} giving the parameter's value. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Date - */ - public Date getDate(int parameterIndex, Calendar cal) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code DATE} parameter as a {@code - * java.sql.Date}. - * - * @param parameterName - * the name of the desired parameter. - * @return the {@code java.sql.Date} giving the parameter's value. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Date - */ - public Date getDate(String parameterName) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code DATE} parameter as a {@code - * java.sql.Date}, using the specified {@code Calendar} to construct the date. - * - *

The JDBC driver uses the calendar to create the date using a particular - * timezone and locale. The default behavior of the driver is to use the VM defaults. - * See "Be wary of the default locale". - * - * @param parameterName - * the name of the desired parameter. - * @param cal - * used for creating the returned {@code Date}. - * @return the {@code java.sql.Date} giving the parameter's value. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Date - */ - public Date getDate(String parameterName, Calendar cal) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code DOUBLE} parameter as a - * {@code double}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return the parameter's value as a {@code double}. {@code 0.0} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public double getDouble(int parameterIndex) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code DOUBLE} parameter as a - * {@code double}. - * - * @param parameterName - * the name of the desired parameter. - * @return the parameter's value as a {@code double}. {@code 0.0} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public double getDouble(String parameterName) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code FLOAT} parameter as a {@code - * float}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return the parameter's value as a {@code float}. {@code 0.0} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public float getFloat(int parameterIndex) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code FLOAT} parameter as a Java - * {@code float}. - * - * @param parameterName - * the name of the desired parameter. - * @return the parameter's value as a {@code float}. {@code 0.0} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public float getFloat(String parameterName) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code INTEGER} parameter as an - * {@code int}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return the {@code int} giving the parameter's value. {@code 0} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public int getInt(int parameterIndex) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code INTEGER} parameter as an - * {@code int}. - * - * @param parameterName - * the name of the desired parameter. - * @return the {@code int} giving the parameter's value. {@code 0} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public int getInt(String parameterName) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code BIGINT} parameter as a - * {@code long}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return the {@code long} giving the parameter's value. {@code 0} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public long getLong(int parameterIndex) throws SQLException; - - /** - * Gets the value of the specified JDBC {@code BIGINT} parameter as a - * {@code long}. - * - * @param parameterName - * the name of the desired parameter. - * @return the {@code long} giving the parameter's value. {@code 0} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public long getLong(String parameterName) throws SQLException; - - /** - * Gets the value of the specified parameter as a Java {@code Object}. - *

- * The object type returned is the JDBC type registered for the parameter - * with a {@code registerOutParameter} call. If a parameter was registered - * as a {@code java.sql.Types.OTHER} then it may hold abstract types that - * are particular to the connected database. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return an Object holding the value of the parameter. - * @throws SQLException - * if a database error occurs. - */ - public Object getObject(int parameterIndex) throws SQLException; - - /** - * Gets the value of the specified parameter as an {@code Object}. The - * {@code Map} gives the correspondence between SQL types and Java classes. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param map - * the {@code Map} giving the correspondence between SQL - * types and Java classes. - * @return an Object holding the value of the parameter. - * @throws SQLException - * if a database error occurs. - */ - public Object getObject(int parameterIndex, Map> map) - throws SQLException; - - /** - * Gets the value of the specified parameter as an {@code Object}. - *

- * The object type returned is the JDBC type that was registered for - * the parameter by an earlier call to {@link #registerOutParameter}. - * If a parameter was registered as a {@code java.sql.Types.OTHER} - * then it may hold abstract types that are particular to the - * connected database. - * - * @param parameterName - * the parameter name. - * @return the Java {@code Object} representation of the value of the - * parameter. - * @throws SQLException - * if there is a problem accessing the database. - */ - public Object getObject(String parameterName) throws SQLException; - - /** - * Gets the value of a specified parameter as an {@code Object}. The - * actual return type is determined by the {@code Map} parameter which - * gives the correspondence between SQL types and Java classes. - * - * @param parameterName - * the parameter name. - * @param map - * the {@code Map} of SQL types to their Java counterparts - * @return an {@code Object} holding the value of the parameter. - * @throws SQLException - * if there is a problem accessing the database. - */ - public Object getObject(String parameterName, Map> map) - throws SQLException; - - /** - * Gets the value of a specified SQL {@code REF()} - * parameter as a {@code java.sql.Ref}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return a {@code java.sql.Ref} with the parameter value. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public Ref getRef(int parameterIndex) throws SQLException; - - /** - * Gets the value of a specified SQL {@code REF()} - * parameter as a {@code java.sql.Ref}. - * - * @param parameterName - * the desired parameter's name. - * @return the parameter's value in the form of a {@code - * java.sql.Ref}. A {@code null} reference is returned if the - * parameter's value is SQL {@code NULL}. - * @throws SQLException - * if there is a problem accessing the database. - * @see Ref - */ - public Ref getRef(String parameterName) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code SMALLINT} parameter as a - * {@code short}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return the parameter's value as a {@code short}. 0 is returned - * if the parameter's value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - */ - public short getShort(int parameterIndex) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code SMALLINT} parameter as a - * {@code short}. - * - * @param parameterName - * the desired parameter's name. - * @return the parameter's value as a {@code short}. 0 is returned - * if the parameter's value is SQL {@code NULL}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public short getShort(String parameterName) throws SQLException; - - /** - * Returns the indexed parameter's value as a {@code String}. The - * parameter value must be one of the JDBC types {@code CHAR}, - * {@code VARCHAR} or {@code LONGVARCHAR}. - *

- * The {@code String} corresponding to a {@code CHAR} of fixed length - * will be of identical length to the value in the database inclusive - * of padding characters. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return the parameter's value as a {@code String}. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public String getString(int parameterIndex) throws SQLException; - - /** - * Returns the named parameter's value as a string. The parameter value must - * be one of the JDBC types {@code CHAR}, {@code VARCHAR} or {@code - * LONGVARCHAR}. - *

- * The string corresponding to a {@code CHAR} of fixed length will be of - * identical length to the value in the database inclusive of padding - * characters. - * - * @param parameterName - * the desired parameter's name. - * @return the parameter's value as a {@code String}. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public String getString(String parameterName) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code TIME} parameter as a {@code - * java.sql.Time}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return the parameter's value as a {@code java.sql.Time}. - * {@code null} is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Time - */ - public Time getTime(int parameterIndex) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code TIME} parameter as a {@code - * java.sql.Time}, using the supplied {@code Calendar} to construct the - * time. The JDBC driver uses the calendar to handle specific timezones - * and locales in order to determine {@code Time}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param cal - * the calendar to use in constructing {@code Time}. - * @return the parameter's value as a {@code java.sql.Time}. - * {@code null} is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Time - * @see java.util.Calendar - */ - public Time getTime(int parameterIndex, Calendar cal) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code TIME} parameter as a {@code - * java.sql.Time}. - * - * @param parameterName - * the name of the desired parameter. - * @return a new {@code java.sql.Time} with the parameter's value. A {@code - * null} reference is returned for an SQL value of {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Time - */ - public Time getTime(String parameterName) throws SQLException; - - /** - * Gets the value of a specified JDBC {@code TIME} parameter as a {@code - * java.sql.Time}, using the supplied {@code Calendar} to construct - * the time. The JDBC driver uses the calendar to handle specific - * timezones and locales when creating {@code Time}. - * - * @param parameterName - * the name of the desired parameter. - * @param cal - * used for creating the returned {@code Time} - * @return a new {@code java.sql.Time} with the parameter's value. A {@code - * null} reference is returned for an SQL value of {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see Time - * @see java.util.Calendar - */ - public Time getTime(String parameterName, Calendar cal) throws SQLException; - - /** - * Returns the indexed parameter's {@code TIMESTAMP} value as a {@code - * java.sql.Timestamp}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1 - * @return the parameter's value as a {@code java.sql.Timestamp}. A - * {@code null} reference is returned for an SQL value of {@code - * NULL}. - * @throws SQLException - * if a database error occurs. - * @see Timestamp - */ - public Timestamp getTimestamp(int parameterIndex) throws SQLException; - - /** - * Returns the indexed parameter's {@code TIMESTAMP} value as a {@code - * java.sql.Timestamp}. The JDBC driver uses the supplied {@code Calendar} - * to handle specific timezones and locales when creating the result. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1 - * @param cal - * used for creating the returned {@code Timestamp} - * @return the parameter's value as a {@code java.sql.Timestamp}. A - * {@code null} reference is returned for an SQL value of {@code - * NULL}. - * @throws SQLException - * if a database error occurs. - * @see Timestamp - */ - public Timestamp getTimestamp(int parameterIndex, Calendar cal) - throws SQLException; - - /** - * Returns the named parameter's {@code TIMESTAMP} value as a {@code - * java.sql.Timestamp}. - * - * @param parameterName - * the name of the desired parameter. - * @return the parameter's value as a {@code java.sql.Timestamp}. A - * {@code null} reference is returned for an SQL value of {@code - * NULL}. - * @throws SQLException - * if a database error occurs. - * @see Timestamp - */ - public Timestamp getTimestamp(String parameterName) throws SQLException; - - /** - * Returns the indexed parameter's {@code TIMESTAMP} value as a {@code - * java.sql.Timestamp}. The JDBC driver uses the supplied {@code Calendar} - * to handle specific timezones and locales when creating the result. - * - * @param parameterName - * the name of the desired parameter. - * @param cal - * used for creating the returned {@code Timestamp} - * @return the parameter's value as a {@code java.sql.Timestamp}. A - * {@code null} reference is returned for an SQL value of {@code - * NULL}. - * @throws SQLException - * if a database error occurs. - * @see Timestamp - */ - public Timestamp getTimestamp(String parameterName, Calendar cal) - throws SQLException; - - /** - * Gets the value of a specified JDBC {@code DATALINK} parameter as a - * {@code java.net.URL}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @return a {@code URL} giving the parameter's value. {@code null} - * is returned if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error occurs. - * @see java.net.URL - */ - public URL getURL(int parameterIndex) throws SQLException; - - /** - * Returns the named parameter's JDBC {@code DATALINK} value in a new Java - * {@code java.net.URL}. - * - * @param parameterName - * the name of the desired parameter. - * @return a new {@code java.net.URL} encapsulating the parameter value. A - * {@code null} reference is returned for an SQL value of {@code - * NULL}. - * @throws SQLException - * if a database error occurs. - * @see java.net.URL - */ - public URL getURL(String parameterName) throws SQLException; - - /** - * Defines the type of a specified {@code OUT} parameter. All {@code OUT} - * parameters must have their type defined before a stored procedure is - * executed. - *

- * The type supplied in the {@code sqlType} parameter fixes the - * type that will be returned by the getter methods of - * {@code CallableStatement}. - * If a database specific type is expected for a parameter, the Type {@code - * java.sql.Types.OTHER} should be used. Note that there is another variant - * of this method for User Defined Types or a {@code REF} type. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1 - * @param sqlType - * the JDBC type as defined by {@code java.sql.Types}. The JDBC - * types {@code NUMERIC} and {@code DECIMAL} should be defined - * using {@link #registerOutParameter(int, int, int)}. - * @throws SQLException - * if a database error occurs. - * @see Types - */ - public void registerOutParameter(int parameterIndex, int sqlType) - throws SQLException; - - /** - * Defines the Type of a specified {@code OUT} parameter. All {@code OUT} - * parameters must have their type defined before a stored procedure is - * executed. This version of the {@code registerOutParameter} method, which - * has a scale parameter, should be used for the JDBC types {@code NUMERIC} - * and {@code DECIMAL}, where there is a need to specify the number of - * digits expected after the decimal point. - *

- * The type supplied in the {@code sqlType} parameter fixes the - * type that will be returned by the getter methods of - * {@code CallableStatement}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1 - * @param sqlType - * the JDBC type as defined by {@code java.sql.Types}. - * @param scale - * the number of digits after the decimal point. Must be greater - * than or equal to 0. - * @throws SQLException - * if a database error occurs. - * @see Types - */ - public void registerOutParameter(int parameterIndex, int sqlType, int scale) - throws SQLException; - - /** - * Defines the Type of a specified {@code OUT} parameter. This variant - * of the method is designed for use with parameters that are - * User Defined Types (UDT) or a {@code REF} type, although it - * can be used for any type. - * - * @param paramIndex - * the parameter number index, where the first parameter has - * index 1. - * @param sqlType - * a JDBC type expressed as a constant from {@link Types}. - * @param typeName - * an SQL type name. For a {@code REF} type, this name should be - * the fully qualified name of the referenced type. - * @throws SQLException - * if a database error occurs. - * @see Ref - */ - public void registerOutParameter(int paramIndex, int sqlType, - String typeName) throws SQLException; - - /** - * Defines the Type of a specified {@code OUT} parameter. All OUT parameters - * must have their Type defined before a stored procedure is executed. - *

- * The type supplied in the {@code sqlType} parameter fixes the - * type that will be returned by the getter methods of - * {@code CallableStatement}. - * If a database-specific type is expected for a parameter, the Type {@code - * java.sql.Types.OTHER} should be used. Note that there is another variant - * of this method for User Defined Types or a {@code REF} type. - * - * @param parameterName - * the parameter name. - * @param sqlType - * a JDBC type expressed as a constant from {@link Types}. Types - * {@code NUMERIC} and {@code DECIMAL} should be defined using - * the variant of this method that takes a {@code scale} - * parameter. - * @throws SQLException - * if a database error occurs. - */ - public void registerOutParameter(String parameterName, int sqlType) - throws SQLException; - - /** - * Defines the Type of a specified {@code OUT} parameter. All {@code OUT} - * parameters must have their Type defined before a stored procedure is - * executed. This version of the {@code registerOutParameter} method, which - * has a scale parameter, should be used for the JDBC types {@code NUMERIC} - * and {@code DECIMAL}, where there is a need to specify the number of - * digits expected after the decimal point. - *

- * The type supplied in the {@code sqlType} parameter fixes the - * type that will be returned by the getter methods of - * {@code CallableStatement}. - * - * @param parameterName - * the parameter name. - * @param sqlType - * a JDBC type expressed as a constant from {@link Types}. - * @param scale - * the number of digits after the decimal point. Must be greater - * than or equal to 0. - * @throws SQLException - * if a database error occurs. - */ - public void registerOutParameter(String parameterName, int sqlType, - int scale) throws SQLException; - - /** - * Defines the Type of a specified {@code OUT} parameter. This variant of - * the method is designed for use with parameters that are User Defined - * Types (UDT) or a {@code REF} type, although it can be used for any - * type. - * - * @param parameterName - * the parameter name - * @param sqlType - * a JDBC type expressed as a constant from {@link Types} - * @param typeName - * the fully qualified name of an SQL structured type. For a - * {@code REF} type, this name should be the fully qualified name - * of the referenced type. - * @throws SQLException - * if a database error occurs. - */ - public void registerOutParameter(String parameterName, int sqlType, - String typeName) throws SQLException; - - /** - * Sets the value of a specified parameter to the content of a supplied - * {@code InputStream}, which has a specified number of bytes. - *

- * This is a good method for setting an SQL {@code LONGVARCHAR} parameter - * where the length of the data is large. Data is read from the {@code - * InputStream} until end-of-file is reached or the specified number of - * bytes is copied. - * - * @param parameterName - * the parameter name - * @param theInputStream - * the ASCII input stream carrying the data to update the - * parameter with. - * @param length - * the number of bytes in the {@code InputStream} to copy to the - * parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setAsciiStream(String parameterName, - InputStream theInputStream, int length) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.math.BigDecimal} value. - * - * @param parameterName - * the name of the parameter. - * @param theBigDecimal - * the {@code java.math.BigInteger} value to set. - * @throws SQLException - * if a database error occurs. - */ - public void setBigDecimal(String parameterName, BigDecimal theBigDecimal) - throws SQLException; - - /** - * Sets the value of a specified parameter to the content of a supplied - * binary {@code InputStream}, which has a specified number of bytes. - *

- * Use this method when a large amount of data needs to be set into a - * {@code LONGVARBINARY} parameter. - * - * @param parameterName - * the name of the parameter. - * @param theInputStream - * the binary {@code InputStream} carrying the data to update the - * parameter. - * @param length - * the number of bytes in the {@code InputStream} to copy to the - * parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setBinaryStream(String parameterName, - InputStream theInputStream, int length) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code boolean} - * value. - * - * @param parameterName - * the parameter name. - * @param theBoolean - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setBoolean(String parameterName, boolean theBoolean) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code byte} value. - * - * @param parameterName - * the parameter name. - * @param theByte - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setByte(String parameterName, byte theByte) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied array of bytes. The - * array is mapped to {@code VARBINARY} or else {@code LONGVARBINARY} in the - * connected database. - * - * @param parameterName - * the parameter name. - * @param theBytes - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setBytes(String parameterName, byte[] theBytes) - throws SQLException; - - /** - * Sets the value of a specified parameter to the character content of a - * {@code Reader} object, with the specified length of character data. - * - * @param parameterName - * the parameter name. - * @param reader - * the new value with which to update the parameter. - * @param length - * a count of the characters contained in {@code reader}. - * @throws SQLException - * if a database error occurs. - */ - public void setCharacterStream(String parameterName, Reader reader, - int length) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Date} value. - * - * @param parameterName - * the parameter name. - * @param theDate - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setDate(String parameterName, Date theDate) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Date} value, using a supplied calendar to map the date. The - * calendar allows the application to control the timezone used to compute - * the SQL {@code DATE} in the database. In case that no calendar is - * supplied, the driver uses the default timezone of the Java virtual - * machine. - * - * @param parameterName - * the parameter name. - * @param theDate - * the new value with which to update the parameter. - * @param cal - * a {@code Calendar} to use to construct the SQL {@code DATE} - * value. - * @throws SQLException - * if a database error occurs. - * @see java.util.Calendar - * @see Date - */ - public void setDate(String parameterName, Date theDate, Calendar cal) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code double} - * value. - * - * @param parameterName - * the parameter name. - * @param theDouble - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setDouble(String parameterName, double theDouble) - throws SQLException; - - /** - * Sets the value of a specified parameter to to a supplied {@code float} - * value. - * - * @param parameterName - * the parameter name. - * @param theFloat - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setFloat(String parameterName, float theFloat) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code int} value. - * - * @param parameterName - * the parameter name. - * @param theInt - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setInt(String parameterName, int theInt) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code long} value. - * - * @param parameterName - * the parameter name. - * @param theLong - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setLong(String parameterName, long theLong) throws SQLException; - - /** - * Sets the value of a specified parameter to SQL {@code NULL}. Don't use - * this version of {@code setNull} for User Defined Types (UDT) or - * for {@code REF} type parameters. - * - * @param parameterName - * the parameter name. - * @param sqlType - * a JDBC type expressed as a constant from {@link Types}. - * @throws SQLException - * if a database error occurs. - */ - public void setNull(String parameterName, int sqlType) throws SQLException; - - /** - * Sets the value of a specified parameter to be SQL {@code NULL} where the - * parameter type is either {@code REF} or user defined (e.g. {@code STRUCT} - * , {@code JAVA_OBJECT} etc). - *

- * For reasons of portability, the caller is expected to supply both the SQL - * type code and type name (which is just the parameter name if the type is - * user defined, referred to as a {@code UDT}, or the name of the referenced - * type in case of a {@code REF} type). - * - * @param parameterName - * the parameter name. - * @param sqlType - * a JDBC type expressed as a constant from {@link Types}. - * @param typeName - * if the target parameter is a user defined type then this - * should contain the full type name. The fully qualified name of - * a {@code UDT} or {@code REF} type is ignored if the parameter - * is not a {@code UDT}. - * @throws SQLException - * if a database error occurs. - * @see Types - */ - public void setNull(String parameterName, int sqlType, String typeName) - throws SQLException; - - /** - * Sets the value of a specified parameter using a supplied object. Prior to - * issuing this request to the connected database {@code theObject} is - * transformed to the corresponding SQL type according to the standard Java - * to SQL mapping rules. - *

- * If the object's class implements the interface {@code SQLData}, the JDBC - * driver calls {@code SQLData.writeSQL} to write it to the SQL data stream. - * If {@code theObject} implements any of the following interfaces then the - * driver is in charge of mapping the value to the appropriate SQL type. - *

  • {@link Ref}
  • - *
  • {@link Struct}
  • - *
  • {@link Array}
  • - *
  • {@link Clob}
  • - *
  • {@link Blob}
- * - * @param parameterName - * the parameter name - * @param theObject - * the new value with which to update the parameter - * @throws SQLException - * if a database error occurs. - * @see SQLData - */ - public void setObject(String parameterName, Object theObject) - throws SQLException; - - /** - * Sets the value of a specified parameter using a supplied object. - *

- * The parameter {@code theObject} is converted to the given {@code - * targetSqlType} before it is sent to the database. If the object has a - * custom mapping (its class implements the interface {@code SQLData}), the - * JDBC driver calls the method {@code SQLData.writeSQL} to write it to the - * SQL data stream. If {@code theObject} is an instance of one of the - * following types - *

    - *
  • {@link Ref}
  • - *
  • {@link Struct}
  • - *
  • {@link Array}
  • - *
  • {@link Clob}
  • - *
  • {@link Blob}
  • - *
- * then the driver is in charge of mapping the value to the appropriate - * SQL type and deliver it to the database. - * - * @param parameterName - * the parameter name. - * @param theObject - * the new value with which to update the parameter. - * @param targetSqlType - * a JDBC type expressed as a constant from {@link Types}. - * @throws SQLException - * if a database error occurs. - * @see SQLData - */ - public void setObject(String parameterName, Object theObject, - int targetSqlType) throws SQLException; - - /** - * Sets the value of a specified parameter using a supplied object. - *

- * The object is converted to the given {@code targetSqlType} before it is - * sent to the database. If the object has a custom mapping (its class - * implements the interface {@code SQLData}), the JDBC driver calls the - * method {@code SQLData.writeSQL} to write it to the SQL data stream. If - * {@code theObject} implements any of the following interfaces - *

    - *
  • {@link Ref}
  • - *
  • {@link Struct}
  • - *
  • {@link Array}
  • - *
  • {@link Clob}
  • - *
  • {@link Blob}
  • - *
- * then the driver is charge of mapping the value to the appropriate - * SQL type. - * - * @param parameterName - * the parameter name. - * @param theObject - * the new value with which to update the parameter. - * @param targetSqlType - * a JDBC type expressed as a constant from {@link Types}. - * @param scale - * where applicable, the number of digits after the decimal. - * point. - * @throws SQLException - * if a database error occurs. - * @see SQLData - */ - public void setObject(String parameterName, Object theObject, - int targetSqlType, int scale) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code short} - * value. - * - * @param parameterName - * the name of the parameter. - * @param theShort - * a short value to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setShort(String parameterName, short theShort) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code String}. - * - * @param parameterName - * the name of the parameter. - * @param theString - * a {@code String} value to update the parameter. - * @throws SQLException - * if a database error occurs. - */ - public void setString(String parameterName, String theString) - throws SQLException; - - /** - * Sets the value of the parameter named {@code parameterName} to the value - * of the supplied {@code java.sql.Time}. - * - * @param parameterName - * the parameter name. - * @param theTime - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - * @see Time - */ - public void setTime(String parameterName, Time theTime) throws SQLException; - - /** - * Sets the value of the parameter named {@code parameterName} to the value - * of the supplied {@code java.sql.Time} using the supplied calendar. - * - *

The driver uses the supplied {@code Calendar} to create the SQL - * {@code TIME} value, which allows it to use a custom timezone - - * otherwise the driver uses the VM defaults. - * See "Be wary of the default locale". - * - * @param parameterName - * the parameter name. - * @param theTime - * the new value with which to update the parameter. - * @param cal - * used for creating the new SQL {@code TIME} value. - * @throws SQLException - * if a database error occurs. - * @see Time - */ - public void setTime(String parameterName, Time theTime, Calendar cal) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Timestamp} value. - * - * @param parameterName - * the parameter name. - * @param theTimestamp - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - * @see Timestamp - */ - public void setTimestamp(String parameterName, Timestamp theTimestamp) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Timestamp} value, using the supplied calendar. - * - *

The driver uses the supplied calendar to create the SQL {@code TIMESTAMP} - * value, which allows it to use a custom timezone - otherwise the driver - * uses the VM defaults. - * See "Be wary of the default locale". - * - * @param parameterName - * the parameter name. - * @param theTimestamp - * the new value with which to update the parameter. - * @param cal - * used for creating the new SQL {@code TIME} value. - * @throws SQLException - * if a database error occurs. - * @see Timestamp - * @see java.util.Calendar - */ - public void setTimestamp(String parameterName, Timestamp theTimestamp, - Calendar cal) throws SQLException; - - /** - * Sets the value of a specified parameter to the supplied {@code - * java.net.URL}. - * - * @param parameterName - * the parameter name. - * @param theURL - * the new value with which to update the parameter. - * @throws SQLException - * if a database error occurs. - * @see java.net.URL - */ - public void setURL(String parameterName, URL theURL) throws SQLException; - - /** - * Gets whether the value of the last {@code OUT} parameter read was SQL - * {@code NULL}. - * - * @return true if the last parameter was SQL {@code NULL}, {@code false} - * otherwise. - * @throws SQLException - * if a database error occurs. - */ - public boolean wasNull() throws SQLException; - - /** - * Gets the value of a specified {@code ROWID} parameter as a {@code - * java.sql.RowId}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @throws SQLException - * if a database error occurs. - */ - public RowId getRowId(int parameterIndex) throws SQLException; - - /** - * Returns the value of the specified SQL ROWID parameter as a {@code - * java.sql.RowId}. - * @param parameterName the parameter name - * @throws SQLException if a database error occurs - */ - public RowId getRowId(String parameterName) throws SQLException; - - /** - * Sets the named parameter to the given {@code rowId}. - * @throws SQLException if a database error occurs - */ - public void setRowId(String parameterName, RowId rowId) throws SQLException; - - /** - * Sets the named parameter to the given {@code string}. - * @throws SQLException if a database error occurs - */ - public void setNString(String parameterName, String string) throws SQLException; - - /** - * Sets the named parameter to the characters from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setNCharacterStream(String parameterName, Reader reader, long length) throws SQLException; - - /** - * Sets the named parameter to the given {@code nclob}. - * @throws SQLException if a database error occurs - */ - public void setNClob(String parameterName, NClob nclob) throws SQLException; - - /** - * Sets the named parameter to the next {@code length} characters from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setClob(String parameterName, Reader reader, long length) throws SQLException; - - /** - * Sets the named parameter to the next {@code length} bytes from the given {@code inputStream}. - * @throws SQLException if a database error occurs - */ - public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException; - - /** - * Sets the named parameter to the next {@code length} characters from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setNClob(String parameterName, Reader reader, long length) throws SQLException; - - /** - * Returns the value of the specified SQL NCLOB parameter as a {@code - * java.sql.NClob}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @throws SQLException - * if a database error occurs. - */ - public NClob getNClob(int parameterIndex) throws SQLException; - - /** - * Returns the value of the specified SQL NCLOB parameter as a {@code - * java.sql.NClob}. - * @param parameterName the parameter name - * @throws SQLException if a database error occurs - */ - public NClob getNClob(String parameterName) throws SQLException; - - /** - * Sets the named parameter to the given {@code sqlXml}. - * @throws SQLException if a database error occurs - */ - public void setSQLXML(String parameterName, SQLXML sqlXml) throws SQLException; - - /** - * Returns the value of the specified SQL XML parameter as a {@code - * java.sql.SQLXML}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @throws SQLException - * if a database error occurs. - */ - public SQLXML getSQLXML(int parameterIndex) throws SQLException; - - /** - * Returns the value of the specified SQL XML parameter as a {@code - * java.sql.SQLXML}. - * @param parameterName the parameter name - * @throws SQLException if a database error occurs - */ - public SQLXML getSQLXML(String parameterName) throws SQLException; - - /** - * Returns the value of the specified SQL NCHAR, NVARCHAR, or LONGNVARCHAR parameter as a - * {@code java.lang.String}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @throws SQLException - * if a database error occurs. - */ - public String getNString(int parameterIndex) throws SQLException; - - /** - * Returns the value of the specified SQL NCHAR, NVARCHAR, or LONGNVARCHAR parameter as a {@code - * java.lang.String}. - * @param parameterName the parameter name - * @throws SQLException if a database error occurs - */ - public String getNString(String parameterName) throws SQLException; - - /** - * Returns the value of the specified SQL NCHAR, NVARCHAR, or LONGNVARCHAR parameter - * as a {@link Reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @throws SQLException - * if a database error occurs. - */ - public Reader getNCharacterStream(int parameterIndex) throws SQLException; - - /** - * Returns the value of the specified SQL NCHAR, NVARCHAR, or LONGNVARCHAR parameter as a {@code - * java.io.Reader}. - * @param parameterName the parameter name - * @throws SQLException if a database error occurs - */ - public Reader getNCharacterStream(String parameterName) throws SQLException; - - /** - * Returns the value of the specified parameter as a {@code java.io.Reader}. - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @throws SQLException - * if a database error occurs. - */ - public Reader getCharacterStream(int parameterIndex) throws SQLException; - - /** - * Returns the value of the specified parameter as a {@code java.io.Reader}. - * @param parameterName the parameter name - * @throws SQLException if a database error occurs - */ - public Reader getCharacterStream(String parameterName) throws SQLException; - - /** - * Sets the named parameter to the given {@code blob}. - * @throws SQLException if a database error occurs - */ - public void setBlob(String parameterName, Blob blob) throws SQLException; - - /** - * Sets the named parameter to the given {@code clob}. - * @throws SQLException if a database error occurs - */ - public void setClob(String parameterName, Clob clob) throws SQLException; - - /** - * Sets the named parameter to the next {@code length} bytes from the given {@code inputStream}. - * @throws SQLException if a database error occurs - */ - public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException; - - /** - * Sets the named parameter to the bytes from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setAsciiStream(String parameterName, InputStream x) throws SQLException; - - /** - * Sets the named parameter to the next {@code length} bytes from the given {@code inputStream}. - * @throws SQLException if a database error occurs - */ - public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException; - - /** - * Sets the named parameter to the bytes from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setBinaryStream(String parameterName, InputStream x) throws SQLException; - - /** - * Sets the named parameter to the next {@code length} characters from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException; - - /** - * Sets the named parameter to the characters from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setCharacterStream(String parameterName, Reader reader) throws SQLException; - - /** - * Sets the named parameter to the characters from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setNCharacterStream(String parameterName, Reader value) throws SQLException; - - /** - * Sets the named parameter to the characters from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setClob(String parameterName, Reader reader) throws SQLException; - - /** - * Sets the named parameter to the bytes from the given {@code inputStream}. - * @throws SQLException if a database error occurs - */ - public void setBlob(String parameterName, InputStream inputStream) throws SQLException; - - /** - * Sets the named parameter to the characters from the given {@code reader}. - * @throws SQLException if a database error occurs - */ - public void setNClob(String parameterName, Reader reader) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/ClientInfoStatus.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/ClientInfoStatus.java deleted file mode 100644 index 254cc2dea5..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/ClientInfoStatus.java +++ /dev/null @@ -1,28 +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 java.sql; - -/** - * An enumeration to describe the reason why a property cannot be set by calling - * Connection.setClientInfo. - * - * @since 1.6 - */ -public enum ClientInfoStatus { - REASON_UNKNOWN, REASON_UNKNOWN_PROPERTY, REASON_VALUE_INVALID, REASON_VALUE_TRUNCATED, -} \ No newline at end of file diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Clob.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Clob.java deleted file mode 100644 index cffb4b786b..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Clob.java +++ /dev/null @@ -1,194 +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 java.sql; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; - -/** - * A Java interface mapping for the SQL CLOB type. - *

- * An SQL {@code CLOB} type stores a large array of characters as the value in a - * column of a database. - *

- * The {@code java.sql.Clob} interface provides methods for setting and - * retrieving data in the {@code Clob}, for querying {@code Clob} data length, - * for searching for data within the {@code Clob}. - */ -public interface Clob { - - /** - * Gets the value of this {@code Clob} object as an ASCII stream. - * - * @return an ASCII {@code InputStream} giving access to the - * {@code Clob} data. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public InputStream getAsciiStream() throws SQLException; - - /** - * Gets the data of this {@code Clob} object in a {@code java.io.Reader}. - * - * @return a character stream Reader object giving access to the {@code - * Clob} data. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public Reader getCharacterStream() throws SQLException; - - /** - * Gets a copy of a specified substring in this {@code Clob}. - * - * @param pos - * the index of the start of the substring in the {@code Clob}. - * @param length - * the length of the data to retrieve. - * @return A string containing the requested data. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public String getSubString(long pos, int length) throws SQLException; - - /** - * Retrieves the number of characters in this {@code Clob} object. - * - * @return a long value with the number of character in this {@code Clob}. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public long length() throws SQLException; - - /** - * Retrieves the character position at which a specified {@code Clob} object - * appears in this {@code Clob} object. - * - * @param searchstr - * the specified {@code Clob} to search for. - * @param start - * the position within this {@code Clob} to start the search - * @return a long value with the position at which the specified {@code - * Clob} occurs within this {@code Clob}. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public long position(Clob searchstr, long start) throws SQLException; - - /** - * Retrieves the character position at which a specified substring appears - * in this {@code Clob} object. - * - * @param searchstr - * the string to search for. - * @param start - * the position at which to start the search within this {@code - * Clob}. - * @return a long value with the position at which the specified string - * occurs within this {@code Clob}. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public long position(String searchstr, long start) throws SQLException; - - /** - * Retrieves a stream which can be used to write Ascii characters to this - * {@code Clob} object, starting at specified position. - * - * @param pos - * the position at which to start the writing. - * @return an OutputStream which can be used to write ASCII characters to - * this {@code Clob}. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public OutputStream setAsciiStream(long pos) throws SQLException; - - /** - * Retrieves a stream which can be used to write a stream of unicode - * characters to this {@code Clob} object, at a specified position. - * - * @param pos - * the position at which to start the writing. - * @return a Writer which can be used to write unicode characters to this - * {@code Clob}. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public Writer setCharacterStream(long pos) throws SQLException; - - /** - * Writes a given Java String to this {@code Clob} object at a specified - * position. - * - * @param pos - * the position at which to start the writing. - * @param str - * the string to write. - * @return the number of characters written. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public int setString(long pos, String str) throws SQLException; - - /** - * Writes {@code len} characters of a string, starting at a specified - * character offset, to this {@code Clob}. - * - * @param pos - * the position at which to start the writing. - * @param str - * the String to write. - * @param offset - * the offset within {@code str} to start writing from. - * @param len - * the number of characters to write. - * @return the number of characters written. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public int setString(long pos, String str, int offset, int len) - throws SQLException; - - /** - * Truncates this {@code Clob} after the specified number of characters. - * - * @param len - * the length in characters giving the place to - * truncate this {@code Clob}. - * @throws SQLException - * if an error occurs accessing the {@code Clob}. - */ - public void truncate(long len) throws SQLException; - - /** - * Frees any resources held by this clob. After {@code free} is called, calling - * method other than {@code free} will throw {@code SQLException} (calling {@code free} - * repeatedly will do nothing). - * - * @throws SQLException - */ - public void free() throws SQLException; - - /** - * Returns a {@link Reader} that reads {@code length} characters from this clob, starting - * at 1-based offset {code pos}. - */ - public Reader getCharacterStream(long pos, long length) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Connection.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Connection.java deleted file mode 100644 index 38b4b4920d..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Connection.java +++ /dev/null @@ -1,841 +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 java.sql; - -import java.util.Map; -import java.util.Properties; - -/** - * A connection represents a link from a Java application to a database. All SQL - * statements and results are returned within the context of a connection. - * Database statements that are executed within this context form a - * database session which forms one or more closed transactions. Especially in - * distributed applications, multiple concurrent connections may exist accessing - * the same values of the database. which may lead to the following phenomena - * (referred to as transaction isolation levels): - *

    - *
  • dirty reads:
    - * reading values from table rows that are not committed.
  • - *
  • non-repeatable reads:
    - * reading table rows more than once in a transaction but getting back different - * data because other transactions have altered the rows between the reads.
  • - *
  • phantom reads:
    - * retrieving additional "phantom" rows in the course of repeated table reads - * because other transactions have inserted additional rows that satisfy an - * SQL {@code WHERE} clause
  • - *
- */ -public interface Connection extends Wrapper, AutoCloseable { - - /** - * A constant indicating that transactions are not supported. - */ - public static final int TRANSACTION_NONE = 0; - - /** - * No dirty reads are permitted, therefore transactions may not read - * a row containing uncommitted values - but does not prevent an application - * from non-repeatable reads and phantom reads. - */ - public static final int TRANSACTION_READ_COMMITTED = 2; - - /** - * In the case that reading uncommitted values is allowed, the following - * incidents may happen which may lead to an invalid results: - *
    - *
  • dirty reads
  • - *
  • non-repeatable reads
  • - *
  • phantom reads
  • - *
- */ - public static final int TRANSACTION_READ_UNCOMMITTED = 1; - - /** - * A constant indicating that dirty reads and non-repeatable - * reads are prevented but phantom reads can occur. - */ - public static final int TRANSACTION_REPEATABLE_READ = 4; - - /** - * The constant that indicates that the following incidents are all - * prevented (the opposite of {@link #TRANSACTION_READ_UNCOMMITTED}): - *
    - *
  • dirty reads
  • - *
  • non-repeatable reads
  • - *
  • phantom reads
  • - *
- */ - public static final int TRANSACTION_SERIALIZABLE = 8; - - /** - * Discards all warnings that may have arisen for this connection. - * Subsequent calls to {@link #getWarnings()} will return {@code null} - * up until a new warning condition occurs. - * - * @throws SQLException - * if there is a problem accessing the database. - */ - public void clearWarnings() throws SQLException; - - /** - * Causes the instant release of all database and driver connection - * resources associated with this object. Any subsequent invocations of this - * method have no effect. - *

- * It is strongly recommended that all connections are closed before they - * are dereferenced by the application ready for garbage collection. - * Although the {@code finalize} method of the connection closes the - * connection before garbage collection takes place, it is not advisable to - * leave the {@code close} operation to take place in this way. Mainly - * because undesired side-effects may appear. - * - * @throws SQLException - * if there is a problem accessing the database. - */ - public void close() throws SQLException; - - /** - * Commits all of the changes made since the last {@code commit} or - * {@code rollback} of the associated transaction. All locks in the database - * held by this connection are also relinquished. Calling this operation on - * connection objects in {@code auto-commit} mode leads to an error. - * - * @throws SQLException - * if there is a problem accessing the database or if the target - * connection instance is in auto-commit mode. - */ - public void commit() throws SQLException; - - /** - * Returns a new instance of {@code Statement} for issuing SQL commands to - * the remote database. - *

- * {@code ResultSets} generated by the returned statement will default to - * type {@code ResultSet.TYPE_FORWARD_ONLY} and concurrency level {@code - * ResultSet.CONCUR_READ_ONLY}. - * - * @return a {@code Statement} object with default settings. - * @throws SQLException - * if there is a problem accessing the database. - * @see ResultSet - */ - public Statement createStatement() throws SQLException; - - /** - * Returns a new instance of {@code Statement} whose associated {@code - * ResultSet}s have the characteristics specified in the type and - * concurrency arguments. - * - * @param resultSetType - * one of the following type specifiers: - *

    - *
  • {@link ResultSet#TYPE_SCROLL_SENSITIVE}
  • - * {@link ResultSet#TYPE_SCROLL_INSENSITIVE}
  • - * {@link ResultSet#TYPE_FORWARD_ONLY}
  • - *
- * @param resultSetConcurrency - * one of the following concurrency mode specifiers: - *
    - *
  • {@link ResultSet#CONCUR_UPDATABLE}
  • - * {@link ResultSet#CONCUR_READ_ONLY}
  • - *
- * @return a new instance of {@code Statement} capable of manufacturing - * {@code ResultSet}s that satisfy the specified {@code - * resultSetType} and {@code resultSetConcurrency} values. - * @throws SQLException - * if there is a problem accessing the database - */ - public Statement createStatement(int resultSetType, int resultSetConcurrency) - throws SQLException; - - /** - * Returns a new instance of {@code Statement} whose associated - * {@code ResultSet}s will have the characteristics specified in the - * type, concurrency and holdability arguments. - * - * @param resultSetType - * one of the following type specifiers: - *
    - *
  • {@link ResultSet#TYPE_SCROLL_SENSITIVE}
  • - *
  • {@link ResultSet#TYPE_SCROLL_INSENSITIVE}
  • - *
  • {@link ResultSet#TYPE_FORWARD_ONLY}
  • - *
- * @param resultSetConcurrency - * one of the following concurrency mode specifiers: - *
    - *
  • {@link ResultSet#CONCUR_UPDATABLE}
  • - *
  • {@link ResultSet#CONCUR_READ_ONLY}
  • - *
- * @param resultSetHoldability - * one of the following holdability mode specifiers: - *
    - *
  • {@link ResultSet#HOLD_CURSORS_OVER_COMMIT}
  • - *
  • {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}
  • - *
- * @return a new instance of {@code Statement} capable of - * manufacturing {@code ResultSet}s that satisfy the - * specified {@code resultSetType}, - * {@code resultSetConcurrency} and - * {@code resultSetHoldability} values. - * @throws SQLException - * if there is a problem accessing the database. - */ - public Statement createStatement(int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException; - - /** - * Returns a {@code boolean} indicating whether or not this connection is in - * the {@code auto-commit} operating mode. - * - * @return {@code true} if {@code auto-commit} is on, otherwise {@code - * false}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public boolean getAutoCommit() throws SQLException; - - /** - * Gets this {@code Connection} object's current catalog name. - * - * @return the catalog name. {@code null} if there is no catalog - * name. - * @throws SQLException - * if there is a problem accessing the database. - */ - public String getCatalog() throws SQLException; - - /** - * Returns the holdability property that any {@code ResultSet} produced by - * this instance will have. - * - * @return one of the following holdability mode specifiers: - *
    - *
  • {@link ResultSet#HOLD_CURSORS_OVER_COMMIT}
  • - * {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}
  • - *
- * @throws SQLException - * if there is a problem accessing the a database. - */ - public int getHoldability() throws SQLException; - - /** - * Gets the metadata about the database referenced by this connection. The - * returned {@code DatabaseMetaData} describes the database topography, - * available stored procedures, SQL syntax and so on. - * - * @return a {@code DatabaseMetaData} object containing the database - * description. - * @throws SQLException - * if there is a problem accessing the a database. - */ - public DatabaseMetaData getMetaData() throws SQLException; - - /** - * Returns the transaction isolation level for this connection. - * - * @return the transaction isolation value. - * @throws SQLException - * if there is a problem accessing the database. - * @see #TRANSACTION_NONE - * @see #TRANSACTION_READ_COMMITTED - * @see #TRANSACTION_READ_UNCOMMITTED - * @see #TRANSACTION_REPEATABLE_READ - * @see #TRANSACTION_SERIALIZABLE - */ - public int getTransactionIsolation() throws SQLException; - - /** - * Returns the type mapping associated with this {@code Connection} object. - * The type mapping must be set on the application level. - * - * @return the Type Map as a {@code java.util.Map}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public Map> getTypeMap() throws SQLException; - - /** - * Gets the first instance of any {@code SQLWarning} objects that may have - * been created in the use of this connection. If at least one warning has - * occurred then this operation returns the first one reported. A {@code - * null} indicates that no warnings have occurred. - *

- * By invoking the {@link SQLWarning#getNextWarning()} method of the - * returned {@code SQLWarning} object it is possible to obtain all of - * this connection's warning objects. - * - * @return the first warning as an SQLWarning object (may be {@code null}). - * @throws SQLException - * if there is a problem accessing the database or if the call - * has been made on a connection which has been previously - * closed. - */ - public SQLWarning getWarnings() throws SQLException; - - /** - * Returns a {@code boolean} indicating whether or not this connection is in - * the {@code closed} state. The {@code closed} state may be entered into as - * a consequence of a successful invocation of the {@link #close()} method - * or else if an error has occurred that prevents the connection from - * functioning normally. - * - * @return {@code true} if closed, otherwise {@code false}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public boolean isClosed() throws SQLException; - - /** - * Returns a {@code boolean} indicating whether or not this connection is - * currently in the {@code read-only} state. - * - * @return {@code true} if in read-only state, otherwise {@code false}. - * @throws SQLException - * if there is a problem accessing the database. - */ - public boolean isReadOnly() throws SQLException; - - /** - * Returns a string representation of the input SQL statement - * {@code sql} expressed in the underlying system's native SQL - * syntax. - * - * @param sql - * the JDBC form of an SQL statement. - * @return the SQL statement in native database format. - * @throws SQLException - * if there is a problem accessing the database - */ - public String nativeSQL(String sql) throws SQLException; - - /** - * Returns a new instance of {@code CallableStatement} that may be used for - * making stored procedure calls to the database. - * - * @param sql - * the SQL statement that calls the stored function - * @return a new instance of {@code CallableStatement} representing the SQL - * statement. {@code ResultSet}s emitted from this {@code - * CallableStatement} will default to type - * {@link ResultSet#TYPE_FORWARD_ONLY} and concurrency - * {@link ResultSet#CONCUR_READ_ONLY}. - * @throws SQLException - * if a problem occurs accessing the database. - */ - public CallableStatement prepareCall(String sql) throws SQLException; - - /** - * Returns a new instance of {@code CallableStatement} that may be used for - * making stored procedure calls to the database. {@code ResultSet}s emitted - * from this {@code CallableStatement} will satisfy the specified {@code - * resultSetType} and {@code resultSetConcurrency} values. - * - * @param sql - * the SQL statement - * @param resultSetType - * one of the following type specifiers: - *

    - *
  • {@link ResultSet#TYPE_SCROLL_SENSITIVE}
  • - *
  • {@link ResultSet#TYPE_SCROLL_INSENSITIVE}
  • - *
  • {@link ResultSet#TYPE_FORWARD_ONLY}
  • - *
- * @param resultSetConcurrency - * one of the following concurrency mode specifiers: - *
    - *
  • {@link ResultSet#CONCUR_READ_ONLY}
  • - *
  • {@link ResultSet#CONCUR_UPDATABLE}
  • - *
- * @return a new instance of {@code CallableStatement} representing the - * precompiled SQL statement. {@code ResultSet}s emitted from this - * {@code CallableStatement} will satisfy the specified {@code - * resultSetType} and {@code resultSetConcurrency} values. - * @throws SQLException - * if a problem occurs accessing the database - */ - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException; - - /** - * Returns a new instance of {@code CallableStatement} that may be used for - * making stored procedure calls to the database. {@code ResultSet}s created - * from this {@code CallableStatement} will have characteristics determined - * by the specified type, concurrency and holdability arguments. - * - * @param sql - * the SQL statement - * @param resultSetType - * one of the following type specifiers: - *
    - *
  • {@link ResultSet#TYPE_SCROLL_SENSITIVE}
  • - *
  • {@link ResultSet#TYPE_SCROLL_INSENSITIVE}
  • - *
  • {@link ResultSet#TYPE_FORWARD_ONLY}
  • - *
- * @param resultSetConcurrency - * one of the following concurrency mode specifiers: - *
    - *
  • {@link ResultSet#CONCUR_READ_ONLY}
  • - *
  • {@link ResultSet#CONCUR_UPDATABLE}
  • - *
- * @param resultSetHoldability - * one of the following holdability mode specifiers: - *
    - *
  • {@link ResultSet#HOLD_CURSORS_OVER_COMMIT}
  • - *
  • {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}
  • - *
- * @return a new instance of {@code CallableStatement} representing the - * precompiled SQL statement. {@code ResultSet}s emitted from this - * {@code CallableStatement} will satisfy the specified {@code - * resultSetType}, {@code resultSetConcurrency} and {@code - * resultSetHoldability} values. - * @throws SQLException - * if a problem occurs accessing the database. - */ - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException; - - /** - * Returns a new instance of {@code PreparedStatement} that may be used any - * number of times to execute parameterized requests on the database server. - *

- * Subject to JDBC driver support, this operation will attempt to send the - * precompiled version of the statement to the database. If - * the driver does not support precompiled statements, the statement will - * not reach the database server until it is executed. This distinction - * determines the moment when {@code SQLException}s get raised. - *

- * By default, {@code ResultSet}s from the returned object will be - * {@link ResultSet#TYPE_FORWARD_ONLY} type with a - * {@link ResultSet#CONCUR_READ_ONLY} mode of concurrency. - * - * @param sql - * the SQL statement. - * @return the {@code PreparedStatement} containing the supplied SQL - * statement. - * @throws SQLException - * if there is a problem accessing the database. - */ - public PreparedStatement prepareStatement(String sql) throws SQLException; - - /** - * Creates a default {@code PreparedStatement} that can retrieve - * automatically generated keys. Parameter {@code autoGeneratedKeys} may be - * used to tell the driver whether such keys should be made accessible. - * This is only relevant when the {@code sql} statement is an {@code insert} - * statement. - *

- * An SQL statement which may have {@code IN} parameters can be stored and - * precompiled in a {@code PreparedStatement}. The {@code PreparedStatement} - * can then be then be used to execute the statement multiple times in an - * efficient way. - *

- * Subject to JDBC driver support, this operation will attempt to send the - * precompiled version of the statement to the database. If - * the driver does not support precompiled statements, the statement will - * not reach the database server until it is executed. This distinction - * determines the moment when {@code SQLException}s get raised. - *

- * By default, {@code ResultSet}s from the returned object will be - * {@link ResultSet#TYPE_FORWARD_ONLY} type with a - * {@link ResultSet#CONCUR_READ_ONLY} mode of concurrency. - * - * @param sql - * the SQL statement. - * @param autoGeneratedKeys - * one of the following generated key options: - *

    - *
  • {@link Statement#RETURN_GENERATED_KEYS}
  • - *
  • {@link Statement#NO_GENERATED_KEYS}
  • - *
- * @return a new {@code PreparedStatement} instance representing the input - * SQL statement. - * @throws SQLException - * if there is a problem accessing the database. - */ - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException; - - /** - * Creates a default {@code PreparedStatement} that can retrieve the - * auto-generated keys designated by a supplied array. If {@code sql} is an - * SQL {@code INSERT} statement, the parameter {@code columnIndexes} is expected - * to hold the index values for each column in the statement's intended - * database table containing the autogenerated-keys of interest. Otherwise - * {@code columnIndexes} is ignored. - *

- * Subject to JDBC driver support, this operation will attempt to send the - * precompiled version of the statement to the database. If - * the driver does not support precompiled statements, the statement will - * not reach the database server until it is executed. This distinction - * determines the moment when {@code SQLException}s get raised. - *

- * By default, {@code ResultSet}s from the returned object will be - * {@link ResultSet#TYPE_FORWARD_ONLY} type with a - * {@link ResultSet#CONCUR_READ_ONLY} concurrency mode. - * - * @param sql - * the SQL statement. - * @param columnIndexes - * the indexes of the columns for which auto-generated keys - * should be made available. - * @return the PreparedStatement containing the supplied SQL statement. - * @throws SQLException - * if a problem occurs accessing the database. - */ - public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException; - - /** - * Creates a {@code PreparedStatement} that generates {@code ResultSet}s - * with the specified values of {@code resultSetType} and {@code - * resultSetConcurrency}. - * - * @param sql - * the SQL statement. It can contain one or more {@code '?'} - * {@code IN} parameter placeholders. - * @param resultSetType - * one of the following type specifiers: - *

    - *
  • {@link ResultSet#TYPE_SCROLL_SENSITIVE}
  • - *
  • {@link ResultSet#TYPE_SCROLL_INSENSITIVE}
  • - *
  • {@link ResultSet#TYPE_FORWARD_ONLY}
  • - *
- * @param resultSetConcurrency - * one of the following concurrency mode specifiers: - *
    - *
  • {@link ResultSet#CONCUR_READ_ONLY}
  • - *
  • {@link ResultSet#CONCUR_UPDATABLE}
  • - *
- * @return a new instance of {@code PreparedStatement} containing the SQL - * statement {@code sql}. {@code ResultSet}s emitted from this - * {@code PreparedStatement} will satisfy the specified {@code - * resultSetType} and {@code resultSetConcurrency} values. - * @throws SQLException - * if a problem occurs accessing the database. - */ - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException; - - /** - * Creates a {@code PreparedStatement} that generates {@code ResultSet}s - * with the specified type, concurrency and holdability - * - * @param sql - * the SQL statement. It can contain one or more {@code '?' IN} - * parameter placeholders. - * @param resultSetType - * one of the following type specifiers: - *
    - *
  • {@link ResultSet#TYPE_SCROLL_SENSITIVE}
  • - *
  • {@link ResultSet#TYPE_SCROLL_INSENSITIVE}
  • - *
  • {@link ResultSet#TYPE_FORWARD_ONLY}
  • - *
- * @param resultSetConcurrency - * one of the following concurrency mode specifiers: - *
    - *
  • {@link ResultSet#CONCUR_READ_ONLY}
  • - *
  • {@link ResultSet#CONCUR_UPDATABLE}
  • - *
- * @param resultSetHoldability - * one of the following holdability mode specifiers: - *
    - *
  • {@link ResultSet#HOLD_CURSORS_OVER_COMMIT}
  • - *
  • {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}
  • - *
- * @return a new instance of {@code PreparedStatement} containing the SQL - * statement {@code sql}. {@code ResultSet}s emitted from this - * {@code PreparedStatement} will satisfy the specified {@code - * resultSetType}, {@code resultSetConcurrency} and {@code - * resultSetHoldability} values. - * @throws SQLException - * if a problem occurs accessing the database. - */ - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException; - - /** - * Creates a default {@code PreparedStatement} that can retrieve the - * auto-generated keys designated by a supplied array. If {@code sql} is an - * SQL {@code INSERT} statement, {@code columnNames} is expected to hold the - * names of each column in the statement's associated database table - * containing the autogenerated-keys of interest. Otherwise {@code - * columnNames} is ignored. - *

- * Subject to JDBC driver support, this operation will attempt to send the - * precompiled version of the statement to the database. Alternatively, if - * the driver is not capable of handling precompiled statements, the - * statement will not reach the database server until it is executed. This - * will have a bearing on precisely when {@code SQLException} - * instances get raised. - *

- * By default, ResultSets from the returned object will be - * {@link ResultSet#TYPE_FORWARD_ONLY} type with a - * {@link ResultSet#CONCUR_READ_ONLY} concurrency mode. - * - * @param sql - * the SQL statement. - * @param columnNames - * the names of the columns for which auto-generated keys should - * be made available. - * @return the PreparedStatement containing the supplied SQL statement. - * @throws SQLException - * if a problem occurs accessing the database. - */ - public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException; - - /** - * Releases the specified {@code savepoint} from the present transaction. Once removed, - * the {@code Savepoint} is considered invalid and should not be referenced - * further. - * - * @param savepoint - * the object targeted for removal. - * @throws SQLException - * if there is a problem with accessing the database or if - * {@code savepoint} is considered not valid in this - * transaction. - */ - public void releaseSavepoint(Savepoint savepoint) throws SQLException; - - /** - * Rolls back all updates made so far in this transaction and - * relinquishes all acquired database locks. It is an error to invoke this - * operation when in auto-commit mode. - * - * @throws SQLException - * if there is a problem with the database or if the method is - * called while in auto-commit mode of operation. - */ - public void rollback() throws SQLException; - - /** - * Undoes all changes made after the supplied {@code Savepoint} object was - * set. This method should only be used when auto-commit mode is disabled. - * - * @param savepoint - * the Savepoint to roll back to - * @throws SQLException - * if there is a problem accessing the database. - */ - public void rollback(Savepoint savepoint) throws SQLException; - - /** - * Sets this connection's auto-commit mode {@code on} or {@code off}. - *

- * Putting a Connection into auto-commit mode means that all associated SQL - * statements are run and committed as separate transactions. - * By contrast, setting auto-commit to {@code off} means that associated SQL - * statements get grouped into transactions that need to be completed by - * explicit calls to either the {@link #commit()} or {@link #rollback()} - * methods. - *

- * Auto-commit is the default mode for new connection instances. - *

- * When in this mode, commits will automatically occur upon successful SQL - * statement completion or upon successful completion of an execute. - * Statements are not considered successfully completed until all associated - * {@code ResultSet}s and output parameters have been obtained or closed. - *

- * Calling this operation during an uncommitted transaction will result in - * it being committed. - * - * @param autoCommit - * {@code boolean} indication of whether to put the target - * connection into auto-commit mode ({@code true}) or not ( - * {@code false}). - * @throws SQLException - * if there is a problem accessing the database. - */ - public void setAutoCommit(boolean autoCommit) throws SQLException; - - /** - * Sets the catalog name for this connection. This is used to select a - * subspace of the database for future work. If the driver does not support - * catalog names, this method is ignored. - * - * @param catalog - * the catalog name to use. - * @throws SQLException - * if there is a problem accessing the database. - */ - public void setCatalog(String catalog) throws SQLException; - - /** - * Sets the holdability of the {@code ResultSet}s created by this Connection. - * - * @param holdability - * one of the following holdability mode specifiers: - *

    - *
  • {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}
  • - *
  • {@link ResultSet#HOLD_CURSORS_OVER_COMMIT}
  • - *
  • - *
- * @throws SQLException - * if there is a problem accessing the database - */ - public void setHoldability(int holdability) throws SQLException; - - /** - * Sets this connection to read-only mode. - *

- * This serves as a hint to the driver, which can enable database - * optimizations. - * - * @param readOnly - * {@code true} to set the Connection to read only mode. {@code - * false} disables read-only mode. - * @throws SQLException - * if there is a problem accessing the database. - */ - public void setReadOnly(boolean readOnly) throws SQLException; - - /** - * Creates an unnamed {@code Savepoint} in the current transaction. - * - * @return a {@code Savepoint} object for this savepoint. - * @throws SQLException - * if there is a problem accessing the database. - */ - public Savepoint setSavepoint() throws SQLException; - - /** - * Creates a named {@code Savepoint} in the current transaction. - * - * @param name - * the name to use for the new {@code Savepoint}. - * @return a {@code Savepoint} object for this savepoint. - * @throws SQLException - * if there is a problem accessing the database. - */ - public Savepoint setSavepoint(String name) throws SQLException; - - /** - * Sets the transaction isolation level for this Connection. - *

- * If this method is called during a transaction, the results are - * implementation defined. - * - * @param level - * the new transaction isolation level to use from the following - * list of possible values: - *

    - *
  • {@link #TRANSACTION_READ_COMMITTED} - *
  • {@link #TRANSACTION_READ_UNCOMMITTED} - *
  • {@link #TRANSACTION_REPEATABLE_READ} - *
  • {@link #TRANSACTION_SERIALIZABLE} - *
- * @throws SQLException - * if there is a problem with the database or if the value of - * {@code level} is not one of the expected constant values. - */ - public void setTransactionIsolation(int level) throws SQLException; - - /** - * Sets the {@code TypeMap} for this connection. The input {@code map} - * should contain mappings between complex Java and SQL types. - * - * @param map - * the new type map. - * @throws SQLException - * if there is a problem accessing the database or if {@code - * map} is not an instance of {@link Map}. - */ - public void setTypeMap(Map> map) throws SQLException; - - /** - * Returns a new empty Clob. - * @throws SQLException if this connection is closed, or there's a problem creating a new clob. - */ - public Clob createClob() throws SQLException; - - /** - * Returns a new empty Blob. - * @throws SQLException if this connection is closed, or there's a problem creating a new blob. - */ - public Blob createBlob() throws SQLException; - - /** - * Returns a new empty NClob. - * @throws SQLException if this connection is closed, or there's a problem creating a new nclob. - */ - public NClob createNClob() throws SQLException; - - /** - * Returns a new empty SQLXML. - * @throws SQLException if this connection is closed, or there's a problem creating a new XML. - */ - public SQLXML createSQLXML() throws SQLException; - - /** - * Returns true if this connection is still open and valid, false otherwise. - * @param timeout number of seconds to wait for a response before giving up and returning false, - * 0 to wait forever - * @throws SQLException if {@code timeout < 0} - */ - public boolean isValid(int timeout) throws SQLException; - - /** - * Sets the client info property {@code name} to {@code value}. A value of null clears the - * client info property. - * @throws SQLClientInfoException if this connection is closed, or there's a problem setting - * the property. - */ - public void setClientInfo(String name, String value) throws SQLClientInfoException; - - /** - * Replaces all client info properties with the name/value pairs from {@code properties}. - * All existing properties are removed. If an exception is thrown, the resulting state of - * this connection's client info properties is undefined. - * @throws SQLClientInfoException if this connection is closed, or there's a problem setting - * a property. - */ - public void setClientInfo(Properties properties) throws SQLClientInfoException; - - /** - * Returns the value corresponding to the given client info property, or null if unset. - * @throws SQLClientInfoException if this connection is closed, or there's a problem getting - * the property. - */ - public String getClientInfo(String name) throws SQLException; - - /** - * Returns a {@link Properties} object containing all client info properties. - * @throws SQLClientInfoException if this connection is closed, or there's a problem getting - * a property. - */ - public Properties getClientInfo() throws SQLException; - - /** - * Returns a new {@link Array} containing the given {@code elements}. - * @param typeName the SQL name of the type of the array elements - * @throws SQLClientInfoException if this connection is closed, or there's a problem creating - * the array. - */ - public Array createArrayOf(String typeName, Object[] elements) throws SQLException; - - /** - * Returns a new {@link Struct} containing the given {@code attributes}. - * @param typeName the SQL name of the type of the struct attributes - * @throws SQLClientInfoException if this connection is closed, or there's a problem creating - * the array. - */ - public Struct createStruct(String typeName, Object[] attributes) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/DataTruncation.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/DataTruncation.java deleted file mode 100644 index c1bf11c0dc..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/DataTruncation.java +++ /dev/null @@ -1,163 +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 java.sql; - -import java.io.Serializable; - -/** - * An exception which is thrown when a JDBC driver unexpectedly truncates a data - * value either when reading (resulting in warning), or when writing data - * (resulting in an error). The {@code SQLState} error code for truncated data - * is {@code 01004}. - */ -public class DataTruncation extends SQLWarning implements Serializable { - - private static final long serialVersionUID = 6464298989504059473L; - - private int index = 0; - - private boolean parameter = false; - - private boolean read = false; - - private int dataSize = 0; - - private int transferSize = 0; - - private static final String THE_REASON = "Data truncation"; - - private static final String THE_SQLSTATE_READ = "01004"; - - private static final String THE_SQLSTATE_WRITE = "22001"; - - private static final int THE_ERROR_CODE = 0; - - /** - * Creates the {@code DataTruncation} object. The reason is set to {@code - * "Data truncation"}, the error code is set to the {@code - * SQLException} default value, and the other fields are set to the values - * supplied as arguments. - * - * @param index - * the Index value of the column value or parameter that was - * truncated. - * @param parameter - * {@code true} if it was a parameter value that was truncated, - * {@code false} otherwise. - * @param read - * {@code true} if the truncation occurred on a read operation, - * {@code false} otherwise. - * @param dataSize - * the original size of the truncated data. - * @param transferSize - * the size of the data after truncation. - */ - public DataTruncation(int index, boolean parameter, boolean read, - int dataSize, int transferSize) { - super(THE_REASON, THE_SQLSTATE_READ, THE_ERROR_CODE); - this.index = index; - this.parameter = parameter; - this.read = read; - this.dataSize = dataSize; - this.transferSize = transferSize; - } - - /** - * Creates a DataTruncation. The Reason is set to "Data truncation", the - * error code is set to the SQLException default value and other fields are - * set to the values supplied on this method. - * - * @param index - * the Index value of the column value or parameter that was - * truncated - * @param parameter - * true if it was a Parameter value that was truncated, false - * otherwise - * @param read - * true if the truncation occurred on a read operation, false - * otherwise - * @param dataSize - * the original size of the truncated data - * @param transferSize - * the size of the data after truncation - * @param cause - * the root reason for this DataTruncation - * - * @since 1.6 - */ - public DataTruncation(int index, boolean parameter, boolean read, - int dataSize, int transferSize, Throwable cause) { - super(THE_REASON, read ? THE_SQLSTATE_READ : THE_SQLSTATE_WRITE, - THE_ERROR_CODE, cause); - this.index = index; - this.parameter = parameter; - this.read = read; - this.dataSize = dataSize; - this.transferSize = transferSize; - } - - /** - * Gets the number of bytes of data that should have been read/written. - * - * @return the number of bytes that should have been read or written. The - * value is set to {@code -1} if the size is unknown. - */ - public int getDataSize() { - return dataSize; - } - - /** - * Gets the index of the column or of the parameter that was truncated. - * - * @return the index number of the column or of the parameter. - */ - public int getIndex() { - return index; - } - - /** - * Gets whether the value truncated was a parameter value or a column value. - * - * @return {@code true} if the value truncated was a parameter value, - * {@code false} if it was a column value. - */ - public boolean getParameter() { - return parameter; - } - - /** - * Gets whether the value was truncated on a read operation or a write - * operation - * - * @return {@code true} if the value was truncated on a read operation, - * {@code false} otherwise. - */ - public boolean getRead() { - return read; - } - - /** - * Gets the number of bytes of data that was actually read or written. - * - * @return the number of bytes actually read/written. The value may be set - * to {@code -1} if the size is unknown. - */ - public int getTransferSize() { - return transferSize; - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/DatabaseMetaData.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/DatabaseMetaData.java deleted file mode 100644 index 4db3bfdb41..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/DatabaseMetaData.java +++ /dev/null @@ -1,3237 +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 java.sql; - -/** - * An interface which provides comprehensive information about the database - * management system and its supported features. - *

- * This interface is implemented by JDBC driver vendors in order to provide - * information about the underlying database capabilities in association with - * the JDBC driver. - *

- * Some of the methods in this interface take string parameters which are - * patterns. Within these string patterns, {@code '%'} and {@code '_'} - * characters have special meanings. {@code '%'} means - * "match any substring of 0 or more characters". {@code '_'} means - * "match any character". Only metadata entries that match the pattern are - * returned. If such a search pattern string is set to {@code null}, that - * argument's criteria are dropped from the search. - */ -public interface DatabaseMetaData extends Wrapper { - - /** - * States that it may not be permitted to store {@code NULL} values. - */ - public static final short attributeNoNulls = 0; - - /** - * States that {@code NULL} values are definitely permitted. - */ - public static final short attributeNullable = 1; - - /** - * States that whether {@code NULL} values are permitted is unknown. - */ - public static final short attributeNullableUnknown = 2; - - /** - * States the best row identifier is NOT a pseudo column. - */ - public static final int bestRowNotPseudo = 1; - - /** - * States that the best row identifier is a pseudo column. - */ - public static final int bestRowPseudo = 2; - - /** - * States that the remainder of the current session is used as the scope for - * the best row identifier. - */ - public static final int bestRowSession = 2; - - /** - * States that best row identifier scope lasts only while the row is being - * used. - */ - public static final int bestRowTemporary = 0; - - /** - * States that the remainder of the current transaction is used as the scope - * for the best row identifier. - */ - public static final int bestRowTransaction = 1; - - /** - * States that the best row identifier may or may not be a pseudo column. - */ - public static final int bestRowUnknown = 0; - - /** - * States that the column must not allow {@code NULL} values. - */ - public static final int columnNoNulls = 0; - - /** - * States that the column definitely allows {@code NULL} values. - */ - public static final int columnNullable = 1; - - /** - * States that it is unknown whether the columns may be nulled. - */ - public static final int columnNullableUnknown = 2; - - /** - * For the column {@code UPDATE_RULE}, states that when the primary key is - * updated, the foreign key (imported key) is changed accordingly. - */ - public static final int importedKeyCascade = 0; - - /** - * States that the evaluation of foreign key constraints is deferred (delayed - * until commit). - */ - public static final int importedKeyInitiallyDeferred = 5; - - /** - * States that the evaluation of foreign key constraint is {@code IMMEDIATE} - * . - */ - public static final int importedKeyInitiallyImmediate = 6; - - /** - * For the columns {@code UPDATE_RULE} and {@code DELETE_RULE}, states that - * if the primary key has been imported, it cannot be updated or deleted. - */ - public static final int importedKeyNoAction = 3; - - /** - * States that the evaluation of foreign key constraint must not be {@code - * DEFERRED}. - */ - public static final int importedKeyNotDeferrable = 7; - - /** - * States that a primary key must not be updated when imported as a foreign - * key by some other table. Used for the column {@code UPDATE_RULE}. - */ - public static final int importedKeyRestrict = 1; - - /** - * States that when the primary key is modified (updated or deleted) the - * foreign (imported) key is changed to its default value. Applies to the - * {@code UPDATE_RULE} and {@code DELETE_RULE} columns. - */ - public static final int importedKeySetDefault = 4; - - /** - * States that when the primary key is modified (updated or deleted) the - * foreign (imported) key is changed to {@code NULL}. Applies to the {@code - * UPDATE_RULE} and {@code DELETE_RULE} columns. - */ - public static final int importedKeySetNull = 2; - - /** - * States that the column stores {@code IN} type parameters. - */ - public static final int procedureColumnIn = 1; - - /** - * States that this column stores {@code INOUT} type parameters. - */ - public static final int procedureColumnInOut = 2; - - /** - * States that this column stores {@code OUT} type parameters. - */ - public static final int procedureColumnOut = 4; - - /** - * States that the column stores results. - */ - public static final int procedureColumnResult = 3; - - /** - * States that the column stores return values. - */ - public static final int procedureColumnReturn = 5; - - /** - * States that type of the column is unknown. - */ - public static final int procedureColumnUnknown = 0; - - /** - * States that {@code NULL} values are not permitted. - */ - public static final int procedureNoNulls = 0; - - /** - * States that the procedure does not return a result. - */ - public static final int procedureNoResult = 1; - - /** - * States that {@code NULL} values are permitted. - */ - public static final int procedureNullable = 1; - - /** - * States that it is unknown whether {@code NULL} values are permitted. - */ - public static final int procedureNullableUnknown = 2; - - /** - * States that it is unknown whether or not the procedure returns a result. - */ - public static final int procedureResultUnknown = 0; - - /** - * States that the procedure returns a result. - */ - public static final int procedureReturnsResult = 2; - - /** - * States that the value is an SQL99 {@code SQLSTATE} value. - */ - public static final int sqlStateSQL99 = 2; - - /** - * States that the value is an SQL {@code CLI SQLSTATE} value as defined by - * the X/Open standard. - */ - public static final int sqlStateXOpen = 1; - - /** - * States that this table index is a clustered index. - */ - public static final short tableIndexClustered = 1; - - /** - * States that this table index is a hashed index. - */ - public static final short tableIndexHashed = 2; - - /** - * States this table's index is neither a clustered index, not a hashed - * index, and not a table statistics index; i.e. it is something else. - */ - public static final short tableIndexOther = 3; - - /** - * States this column has the table's statistics, and that it is returned in - * conjunction with the table's index description. - */ - public static final short tableIndexStatistic = 0; - - /** - * States that a {@code NULL} value is NOT permitted for - * this data type. - */ - public static final int typeNoNulls = 0; - - /** - * States that a {@code NULL} value is permitted for this data type. - */ - public static final int typeNullable = 1; - - /** - * States that it is unknown if a {@code NULL} value is permitted for - * this data type. - */ - public static final int typeNullableUnknown = 2; - - /** - * States that this column shall not be used for {@code WHERE} statements - * with a {@code LIKE} clause. - */ - public static final int typePredBasic = 2; - - /** - * States that this column can only be used in a {@code WHERE...LIKE} - * statement. - */ - public static final int typePredChar = 1; - - /** - * States that this column does not support searches. - */ - public static final int typePredNone = 0; - - /** - * States that the column is searchable. - */ - public static final int typeSearchable = 3; - - /** - * States that the version column is known to be not a pseudo column. - */ - public static final int versionColumnNotPseudo = 1; - - /** - * States that this version column is known to be a pseudo column. - */ - public static final int versionColumnPseudo = 2; - - /** - * States that the version column may be a pseudo column or not. - */ - public static final int versionColumnUnknown = 0; - - /** - * States that the method DatabaseMetaData.getSQLStateType may returns an - * SQLSTATE value or not. - */ - public static final int sqlStateSQL = 2; - - /** - * States that the parameter or column is an IN parameter - */ - public static final int functionColumnIn = 1; - - /** - * States that the parameter or column is an INOUT parameter - */ - public static final int functionColumnInOut = 2; - - /** - * States that the parameter or column is an OUT parameter - */ - public static final int functionColumnOut = 3; - - /** - * States that the parameter or column is a return value - */ - public static final int functionReturn = 4; - - /** - * States that the parameter of function is unknown - */ - public static final int functionColumnUnknown = 0; - - /** - * States that the parameter or column is a column in a result set - */ - public static final int functionColumnResult = 5; - - /** - * States that NULL values are not allowed - */ - public static final int functionNoNulls = 0; - - /** - * States that NULL values are allowed - */ - public static final int functionNullable = 1; - - /** - * States that whether NULL values are allowed is unknown - */ - public static final int functionNullableUnknown = 2; - - /** - * States that it is not known whether the function returns a result or a - * table - */ - public static final int functionResultUnknown = 0; - - /** - * States that the function does not return a table - */ - public static final int functionNoTable = 1; - - /** - * States that the function returns a table. - */ - public static final int functionReturnsTable = 2; - - /** - * Returns whether all procedures returned by {@link #getProcedures} can be - * called by the current user. - * - * @return {@code true} if all procedures can be called by the current user, - * {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean allProceduresAreCallable() throws SQLException; - - /** - * Returns whether all the tables returned by {@code getTables} can be used - * by the current user in a {@code SELECT} statement. - * - * @return {@code true} if all the tables can be used,{@code false} - * otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean allTablesAreSelectable() throws SQLException; - - /** - * Returns whether a data definition statement in a transaction forces a {@code - * commit} of the transaction. - * - * @return {@code true} if the statement forces a commit, {@code false} - * otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean dataDefinitionCausesTransactionCommit() throws SQLException; - - /** - * Returns whether the database ignores data definition statements within a - * transaction. - * - * @return {@code true} if the database ignores a data definition statement, - * {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean dataDefinitionIgnoredInTransactions() throws SQLException; - - /** - * Returns whether a visible row delete can be detected by calling - * {@link ResultSet#rowDeleted}. - * - * @param type - * the type of the {@code ResultSet} involved: {@code - * ResultSet.TYPE_FORWARD_ONLY}, {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} - * @return {@code true} if the visible row delete can be detected, {@code - * false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean deletesAreDetected(int type) throws SQLException; - - /** - * Returns whether the return value of {@code getMaxRowSize} includes the - * SQL data types {@code LONGVARCHAR} and {@code LONGVARBINARY}. - * - * @return {@code true} if the return value includes {@code LONGVARBINARY} - * and {@code LONGVARCHAR}, otherwise {@code false}. - * @throws SQLException - * if there is a database error. - */ - public boolean doesMaxRowSizeIncludeBlobs() throws SQLException; - - /** - * Returns a {@code ResultSet} describing a subset of the attributes of a - * specified SQL User Defined Type (UDT) for a specified schema and catalog. - * The subset is determined by restricting to those attributes whose - * name matches the {@code attributeNamePattern} and whose type name - * matches the {@code typeNamePattern}. Each row of the {@code ResultSet} - * describes one attribute, and the rows are ordered by the columns {@code TYPE_SCHEM}, - * {@code TYPE_NAME} and {@code ORDINAL_POSITION}. Inherited attributes - * are not included. - *

- * The columns of the returned {@code ResultSet} object have the following - * names and meanings: - *

    - *
  1. {@code TYPE_CAT} - String - the type catalog name (possibly {@code - * null})
  2. - *
  3. {@code TYPE_SCHEM} - String - the type schema name (possibly {@code - * null})
  4. - *
  5. {@code TYPE_NAME} - String - the type name
  6. - *
  7. {@code ATTR_NAME} - String - the attribute name
  8. - *
  9. {@code DATA_TYPE} - int - the attribute type as defined in {@code - * java.sql.Types}
  10. - *
  11. {@code ATTR_TYPE_NAME} - String - the attribute type name. This - * depends on the data source. For a {@code UDT} the name is fully - * qualified. For a {@code REF} it is both fully qualified and represents - * the target type of the reference.
  12. - *
  13. {@code ATTR_SIZE} - int - the column size. When referring to char and - * date types this value is the maximum number of characters. When referring - * to numeric types is is the precision.
  14. - *
  15. {@code DECIMAL_DIGITS} - int - how many fractional digits are - * supported
  16. - *
  17. {@code NUM_PREC_RADIX} - int - numeric values radix
  18. - *
  19. {@code NULLABLE} - int - whether {@code NULL} is permitted: - *
      - *
    • DatabaseMetaData.attributeNoNulls - {@code NULL} values not permitted
    • - *
    • DatabaseMetaData.attributeNullable - {@code NULL} values definitely - * permitted
    • - *
    • DatabaseMetaData.attributeNullableUnknown - unknown
    • - *
    - *
  20. - *
  21. {@code REMARKS} - String - a comment describing the attribute - * (possibly {@code null})
  22. - *
  23. ATTR_DEF - String - Default value for the attribute (possibly {@code - * null})
  24. - *
  25. {@code SQL_DATA_TYPE} - int - not used
  26. - *
  27. SQL_DATETIME_SUB - int - not used
  28. - *
  29. CHAR_OCTET_LENGTH - int - for {@code CHAR} types, the max number of - * bytes in the column
  30. - *
  31. ORDINAL_POSITION - int - The index of the column in the table (where - * the count starts from 1, not 0)
  32. - *
  33. IS_NULLABLE - String - {@code "NO"} = the column does not allow {@code - * NULL}s, {@code "YES"} = the column allows {@code NULL}s, "" = status unknown
  34. - *
  35. {@code SCOPE_CATALOG} - String - if the {@code DATA_TYPE} is {@code REF}, - * this gives the catalog of the table corresponding to the attribute's scope. - * NULL if the {@code DATA_TYPE} is not REF.
  36. - *
  37. {@code SCOPE_SCHEMA} - String - if the {@code DATA_TYPE} is {@code REF}, - * this gives the schema of the table corresponding to the attribute's scope. - * NULL if the {@code DATA_TYPE} is not REF.
  38. - *
  39. {@code SCOPE_TABLE} - String - if the {@code DATA_TYPE} is {@code REF}, - * this gives the name of the table corresponding to the attribute's scope. - * NULL if the {@code DATA_TYPE} is not REF.
  40. - *
  41. {@code SOURCE_DATA_TYPE} - String - The source type for a user - * generated REF type or for a Distinct type. ({@code NULL} if {@code - * DATA_TYPE} is not DISTINCT or a user generated REF)
  42. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schemaPattern - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by a schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param typeNamePattern - * a type name. This pattern must match the type name stored in - * the database. - * @param attributeNamePattern - * an Attribute name. This pattern must match the attribute name as stored in - * the database. - * @return a {@code ResultSet}, where each row is an attribute description. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getAttributes(String catalog, String schemaPattern, - String typeNamePattern, String attributeNamePattern) - throws SQLException; - - /** - * Returns a list of a table's optimal set of columns that uniquely - * identify the rows. The results are ordered by {@code SCOPE} (see below). - *

- * The results are returned as a table, with one entry for each column, as - * follows: - *

    - *
  1. {@code SCOPE} - short - the {@code SCOPE} of the result, as follows: - *
      - *
    • {@code DatabaseMetaData.bestRowTemporary} - the result is very temporary, - * only valid while on the current row
    • - *
    • {@code DatabaseMetaData.bestRowTransaction} - the result is good for remainder of - * current transaction
    • - *
    • {@code DatabaseMetaData.bestRowSession} - the result is good for remainder of - * database session
    • - *
    - *
  2. - *
  3. {@code COLUMN_NAME} - String - the column name
  4. - *
  5. {@code DATA_TYPE} - int - the Type of the data, as defined in {@code - * java.sql.Types}
  6. - *
  7. {@code TYPE_NAME} - String - the Name of the type - database dependent. - * For UDT types the name is fully qualified
  8. - *
  9. {@code COLUMN_SIZE} - int - the precision of the data in the column
  10. - *
  11. {@code BUFFER_LENGTH} - int - not used
  12. - *
  13. {@code DECIMAL_DIGITS} - short - number of fractional digits
  14. - *
  15. {@code PSEUDO_COLUMN} - short - whether this is a pseudo column (e.g. - * an Oracle {@code ROWID}): - *
      - *
    • {@code DatabaseMetaData.bestRowUnknown} - it is not known whether this is - * a pseudo column
    • - *
    • {@code DatabaseMetaData.bestRowNotPseudo} - the column is not pseudo
    • - *
    • {@code DatabaseMetaData.bestRowPseudo} - the column is a pseudo column
    • - *
    - *
  16. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schema - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param table - * the table name. This must match the name of the table as - * declared in the database. - * @param scope - * the {@code SCOPE} of interest, values as defined above. - * @param nullable - * {@code true} = include columns that are nullable, {@code - * false} = do not include nullable columns. - * @return a {@code ResultSet} where each row is a description of a column - * and the complete set of rows is the optimal set for this table. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getBestRowIdentifier(String catalog, String schema, - String table, int scope, boolean nullable) throws SQLException; - - /** - * Returns the set of catalog names available in this database. The set is - * returned ordered by catalog name. - * - * @return a {@code ResultSet} containing the catalog names, with each row - * containing one catalog name (as a {@code String}) in the - * single column named {@code TABLE_CAT}. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getCatalogs() throws SQLException; - - /** - * Returns the separator that this database uses between a catalog name and - * table name. - * - * @return a String containing the separator. - * @throws SQLException - * if there is a database error. - */ - public String getCatalogSeparator() throws SQLException; - - /** - * Returns the term that the database vendor prefers term for "catalog". - * - * @return a String with the vendor's term for "catalog". - * @throws SQLException - * if there is a database error. - */ - public String getCatalogTerm() throws SQLException; - - /** - * Returns a description of access rights for a table's columns. Only access - * rights matching the criteria for the column name are returned. - *

- * The description is returned as a {@code ResultSet} with rows of data for - * each access right, with columns as follows: - *

    - *
  1. {@code TABLE_CAT} - String - the catalog name (possibly {@code null})
  2. - *
  3. {@code TABLE_SCHEM} - String - the schema name (possibly {@code null})
  4. - *
  5. {@code TABLE_NAME} - String - the table name
  6. - *
  7. {@code COLUMN_NAME} - String - the Column name
  8. - *
  9. {@code GRANTOR} - String - the grantor of access (possibly {@code - * null})
  10. - *
  11. {@code PRIVILEGE} - String - Access right - one of SELECT, INSERT, - * UPDATE, REFERENCES,...
  12. - *
  13. {@code IS_GRANTABLE} - String - {@code "YES"} implies that the - * receiver can grant access to others, {@code "NO"} if the receiver cannot - * grant access to others, {@code null} if unknown.
  14. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schema - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param table - * the table name. This must match the name of the table as - * declared in the database. - * @param columnNamePattern - * the column name. This must match the name of a column in the - * table in the database. - * @return a {@code ResultSet} containing the access rights, one row for - * each privilege description. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getColumnPrivileges(String catalog, String schema, - String table, String columnNamePattern) throws SQLException; - - /** - * Returns a description of table columns available in a specified catalog. - * Only descriptions meeting the specified catalog, schema, table, and column - * names are returned. - *

- * The descriptions are returned as a {@code ResultSet} conforming to the - * following data layout, with one row per table column: - *

    - *
  1. {@code TABLE_CAT} - String - the catalog name (possibly {@code null})
  2. - *
  3. {@code TABLE_SCHEM} - String - the schema name (possibly {@code null})
  4. - *
  5. {@code TABLE_NAME} - String - the table name
  6. - *
  7. {@code COLUMN_NAME} - String - the column name
  8. - *
  9. {@code DATA_TYPE} - int - the SQL type as specified in {@code - * java.sql.Types}
  10. - *
  11. {@code TYPE_NAME} - String - the name of the data type, (database-dependent, - * UDT names are fully qualified)
  12. - *
  13. {@code COLUMN_SIZE} - int - the column size (the precision for numeric - * types, max characters for {@code char} and {@code date} types)
  14. - *
  15. {@code BUFFER_LENGTH} - int - Not used
  16. - *
  17. {@code DECIMAL_DIGITS} - int - maximum number of fractional digits
  18. - *
  19. {@code NUM_PREC_RADIX} - int - the radix for numerical types
  20. - *
  21. {@code NULLABLE} - int - whether the column allows {@code null}s: - *
      - *
    • DatabaseMetaData.columnNoNulls = may not allow {@code NULL}s
    • - *
    • DatabaseMetaData.columnNullable = does allow {@code NULL}s
    • - *
    • DatabaseMetaData.columnNullableUnknown = unknown {@code NULL} status
    • - *
    - *
  22. - *
  23. {@code REMARKS} - String - A description of the column (possibly - * {@code null})
  24. - *
  25. {@code COLUMN_DEF} - String - Default value for the column (possibly - * {@code null})
  26. - *
  27. {@code SQL_DATA_TYPE} - int - not used
  28. - *
  29. {@code SQL_DATETIME_SUB} - int - not used
  30. - *
  31. {@code CHAR_OCTET_LENGTH} - int - maximum number of bytes in the - * {@code char} type columns
  32. - *
  33. {@code ORDINAL_POSITION} - int - the column index in the table (1 based)
  34. - *
  35. {@code IS_NULLABLE} - String - {@code "NO"} = column does not allow - * NULLs, {@code "YES"} = column allows NULLs, "" = {@code NULL} status - * unknown
  36. - *
  37. {@code SCOPE_CATALOG} - String - if the {@code DATA_TYPE} is {@code REF}, - * this gives the catalog of the table corresponding to the attribute's scope. - * NULL if the {@code DATA_TYPE} is not REF.
  38. - *
  39. {@code SCOPE_SCHEMA} - String - if the {@code DATA_TYPE} is {@code REF}, - * this gives the schema of the table corresponding to the attribute's scope. - * NULL if the {@code DATA_TYPE} is not REF.
  40. - *
  41. {@code SCOPE_TABLE} - String - if the {@code DATA_TYPE} is {@code REF}, - * this gives the name of the table corresponding to the attribute's scope. - * NULL if the {@code DATA_TYPE} is not REF.
  42. - *
  43. {@code SOURCE_DATA_TYPE} - String - The source type for a user - * generated REF type or for a Distinct type. ({@code NULL} if {@code - * DATA_TYPE} is not DISTINCT or a user generated REF)
  44. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schemaPattern - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param tableNamePattern - * the table name. This must match the name of the table as - * declared in the database. - * @param columnNamePattern - * the column name. This must match the name of a column in the - * table in the database. - * @return the descriptions as a {@code ResultSet} with rows in the form - * defined above. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getColumns(String catalog, String schemaPattern, - String tableNamePattern, String columnNamePattern) - throws SQLException; - - /** - * Returns the database connection that created this metadata. - * - * @return the connection to the database. - * @throws SQLException - * if there is a database error. - */ - public Connection getConnection() throws SQLException; - - /** - * Returns a list of foreign key columns in a given foreign key table that - * reference the primary key columns of a supplied primary key table. This - * describes how one table imports the key of another table. It would be - * expected to return a single foreign key - primary key pair in most cases. - *

- * The descriptions are returned as a {@code ResultSet} with one row for - * each foreign key, with the following layout: - *

    - *
  1. {@code PKTABLE_CAT} - String - from the primary key table : Catalog - * (possibly {@code null})
  2. - *
  3. {@code PKTABLE_SCHEM} - String - from the primary key table : Schema - * (possibly {@code null})
  4. - *
  5. {@code PKTABLE_NAME} - String - from the primary key table : name
  6. - *
  7. {@code PKCOLUMN_NAME} - String - from the primary key column : name
  8. - *
  9. {@code FKTABLE_CAT} - String - from the foreign key table : the - * catalog name being exported (possibly {@code null})
  10. - *
  11. {@code FKTABLE_SCHEM} - String - from the foreign key table : the schema name - * being exported (possibly {@code null})
  12. - *
  13. {@code FKTABLE_NAME} - String - from the foreign key table : the name being - * exported
  14. - *
  15. {@code FKCOLUMN_NAME} - String - from the foreign key column : the name being - * exported
  16. - *
  17. {@code KEY_SEQ} - short - the sequence number (in the foreign key)
  18. - *
  19. {@code UPDATE_RULE} - short - a value giving the rule for how to treat the corresponding foreign key when a primary - * key is updated: - *
      - *
    • {@code DatabaseMetaData.importedKeyNoAction} - don't allow the - * primary key to be updated if it is imported as a foreign key
    • - *
    • {@code DatabaseMetaData.importedKeyCascade} - change the imported key to - * match the updated primary key
    • - *
    • {@code DatabaseMetaData.importedKeySetNull} - set the imported key to - * {@code null}
    • - *
    • {@code DatabaseMetaData.importedKeySetDefault} - set the imported key - * to its default value
    • - *
    • {@code DatabaseMetaData.importedKeyRestrict} - same as {@code - * importedKeyNoAction}
    • - *
    - *
  20. - *
  21. {@code DELETE_RULE} - short - a value giving the rule for how to treat the foreign key when the corresponding primary - * key is deleted: - *
      - *
    • {@code DatabaseMetaData.importedKeyNoAction} - don't allow the - * primary key to be deleted if it is imported as a foreign key
    • - *
    • {@code DatabaseMetaData.importedKeyCascade} - delete those rows that - * import a deleted key
    • - *
    • {@code DatabaseMetaData.importedKeySetNull} - set the imported key to - * {@code null}
    • - *
    • {@code DatabaseMetaData.importedKeySetDefault} - set the imported key - * to its default value
    • - *
    • {@code DatabaseMetaData.importedKeyRestrict} - same as - * importedKeyNoAction
    • - *
    - *
  22. - *
  23. {@code FK_NAME} - String - the foreign key name (possibly {@code null})
  24. - *
  25. {@code PK_NAME} - String - the primary key name (possibly {@code null})
  26. - *
  27. {@code DEFERRABILITY} - short - whether foreign key constraints can be - * deferred until commit (see the SQL92 specification for definitions): - *
      - *
    • {@code DatabaseMetaData.importedKeyInitiallyDeferred}
    • - *
    • {@code DatabaseMetaData.importedKeyInitiallyImmediate}
    • - *
    • {@code DatabaseMetaData.importedKeyNotDeferrable}
    • - *
    - *
  28. - *
- * - * @param primaryCatalog - * a catalog name for the primary key table. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param primarySchema - * a schema name for the primary key table. {@code null} is used to imply no narrowing of - * the search by schema name. Otherwise, the name must match a - * schema name in the database, with "" used to retrieve those - * without a schema name. - * @param primaryTable - * the name of the table which exports the key. It must match the - * name of the table in the database. - * @param foreignCatalog - * a catalog name for the foreign key table. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param foreignSchema - * a schema name for the foreign key table. {@code null} is used to imply no narrowing of - * the search by schema name. Otherwise, the name must match a - * schema name in the database, with "" used to retrieve those - * without a schema name. - * @param foreignTable - * the name of the table importing the key. It must match the - * name of the table in the database. - * @return a {@code ResultSet} containing rows with the descriptions of the - * foreign keys laid out according to the format defined above. - * @throws SQLException - * if there is a database error. - */ - public ResultSet getCrossReference(String primaryCatalog, - String primarySchema, String primaryTable, String foreignCatalog, - String foreignSchema, String foreignTable) throws SQLException; - - /** - * Returns the major version number of the database software. - * - * @return the major version number of the database software. - * @throws SQLException - * a database error occurred. - */ - public int getDatabaseMajorVersion() throws SQLException; - - /** - * Returns the minor version number of the database software. - * - * @return the minor version number of the database software. - * @throws SQLException - * a database error occurred. - */ - public int getDatabaseMinorVersion() throws SQLException; - - /** - * Returns the name of the database software. - * - * @return a {@code String} with the name of the database software. - * @throws SQLException - * a database error occurred. - */ - public String getDatabaseProductName() throws SQLException; - - /** - * Returns the version number of this database software. - * - * @return a {@code String} with the version number of the database - * software. - * @throws SQLException - * a database error occurred. - */ - public String getDatabaseProductVersion() throws SQLException; - - /** - * Returns the default transaction isolation level for this database. - * - * @return the default transaction isolation level. One of the following values: - *
    - *
  • {@code TRANSACTION_NONE}
  • - *
  • {@code TRANSACTION_READ_COMMITTED}
  • - *
  • {@code TRANSACTION_READ_UNCOMMITTED}
  • - *
  • {@code TRANSACTION_REPEATABLE_READ}
  • - *
  • {@code TRANSACTION_SERIALIZABLE}
  • - *
- * @throws SQLException - * a database error occurred. - */ - public int getDefaultTransactionIsolation() throws SQLException; - - /** - * Returns the JDBC driver's major version number. - * - * @return the driver's major version number. - */ - public int getDriverMajorVersion(); - - /** - * Returns the JDBC driver's minor version number. - * - * @return the driver's minor version number. - */ - public int getDriverMinorVersion(); - - /** - * Returns the name of this JDBC driver. - * - * @return a {@code String} containing the name of the JDBC driver - * @throws SQLException - * a database error occurred. - */ - public String getDriverName() throws SQLException; - - /** - * Returns the version number of this JDBC driver. - * - * @return a {@code String} containing the complete version number of the - * JDBC driver. - * @throws SQLException - * a database error occurred. - */ - public String getDriverVersion() throws SQLException; - - /** - * Returns a list of the foreign key columns that reference the primary key - * columns of a specified table (the foreign keys exported by a table). - *

- * The list is returned as a {@code ResultSet} with a row for each of the - * foreign key columns, ordered by {@code FKTABLE_CAT}, {@code - * FKTABLE_SCHEM}, {@code FKTABLE_NAME}, and {@code KEY_SEQ}, with the - * format for each row being: - *

    - *
  1. {@code PKTABLE_CAT} - String - from the primary key table : the catalog (possibly - * {@code null})
  2. - *
  3. {@code PKTABLE_SCHEM} - String - from the primary key table : the schema (possibly - * {@code null})
  4. - *
  5. {@code PKTABLE_NAME} - String - from the primary key table : the name
  6. - *
  7. {@code PKCOLUMN_NAME} - String - from the primary key column : the name
  8. - *
  9. {@code FKTABLE_CAT} - String - from the foreign key table : the catalog name being - * exported (possibly {@code null})
  10. - *
  11. {@code FKTABLE_SCHEM} - String - from the foreign key table : the schema name - * being exported (possibly {@code null})
  12. - *
  13. {@code FKTABLE_NAME} - String - from the foreign key table : the name being - * exported
  14. - *
  15. {@code FKCOLUMN_NAME} - String - from the foreign key column : the name being - * exported
  16. - *
  17. {@code KEY_SEQ} - short - the sequence number (in the foreign key)
  18. - *
  19. {@code UPDATE_RULE} - short - a value giving the rule for how to treat the foreign key when the corresponding primary - * key is updated: - *
      - *
    • {@code DatabaseMetaData.importedKeyNoAction} - don't allow the - * primary key to be updated if it is imported as a foreign key
    • - *
    • {@code DatabaseMetaData.importedKeyCascade} - change the imported key to - * match the primary key update
    • - *
    • {@code DatabaseMetaData.importedKeySetNull} - set the imported key to - * {@code null}
    • - *
    • {@code DatabaseMetaData.importedKeySetDefault} - set the imported key - * to its default value
    • - *
    • {@code DatabaseMetaData.importedKeyRestrict} - same as - * importedKeyNoAction
    • - *
    - *
  20. - *
  21. {@code DELETE_RULE} - short - how to treat the foreign key when the corresponding primary - * key is deleted: - *
      - *
    • {@code DatabaseMetaData.importedKeyNoAction} - don't allow the - * primary key to be deleted if it is imported as a foreign key
    • - *
    • {@code DatabaseMetaData.importedKeyCascade} - the deletion should - * also delete rows that import a deleted key
    • - *
    • {@code DatabaseMetaData.importedKeySetNull} - the deletion sets the - * imported key to {@code null}
    • - *
    • {@code DatabaseMetaData.importedKeySetDefault} - the deletion sets the - * imported key to its default value
    • - *
    • {@code DatabaseMetaData.importedKeyRestrict} - same as - * importedKeyNoAction
    • - *
    - *
  22. - *
  23. {@code FK_NAME} - String - the foreign key name (possibly {@code null})
  24. - *
  25. {@code PK_NAME} - String - the primary key name (possibly {@code null})
  26. - *
  27. {@code DEFERRABILITY} - short - defines whether the foreign key - * constraints can be deferred until commit (see the SQL92 specification for - * definitions): - *
      - *
    • {@code DatabaseMetaData.importedKeyInitiallyDeferred}
    • - *
    • {@code DatabaseMetaData.importedKeyInitiallyImmediate}
    • - *
    • {@code DatabaseMetaData.importedKeyNotDeferrable}
    • - *
    - *
  28. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schema - * a schema name. {@code null} is used to imply no narrowing of - * the search by schema name. Otherwise, the name must match a - * schema name in the database, with "" used to retrieve those - * without a schema name. - * @param table - * a table name, which must match the name of a table in the - * database - * @return a {@code ResultSet} containing a row for each of the foreign key - * columns, as defined above - * @throws SQLException - * a database error occurred - */ - public ResultSet getExportedKeys(String catalog, String schema, String table) - throws SQLException; - - /** - * Returns a string of characters that may be used in unquoted identifier - * names. The characters {@code a-z}, {@code A-Z}, {@code 0-9} and {@code _} - * are always permitted. - * - * @return a String containing all the additional permitted characters. - * @throws SQLException - * a database error occurred. - */ - public String getExtraNameCharacters() throws SQLException; - - /** - * Returns the string used to quote SQL identifiers. Returns " " (space) if - * identifier quoting not supported. - * - * @return the String used to quote SQL identifiers. - * @throws SQLException - * a database error occurred. - */ - public String getIdentifierQuoteString() throws SQLException; - - /** - * Returns a list columns in a table that are both primary keys and - * referenced by the table's foreign key columns (that is, the primary keys - * imported by a table). - *

- * The list returned is a {@code ResultSet} with a row entry for each - * primary key column, ordered by {@code PKTABLE_CAT}, {@code PKTABLE_SCHEM}, - * {@code PKTABLE_NAME}, and {@code KEY_SEQ}, with the following format: - *

    - *
  1. {@code PKTABLE_CAT} - String - primary key catalog name being - * imported (possibly {@code null})
  2. - *
  3. {@code PKTABLE_SCHEM} - String - primary key schema name being - * imported (possibly {@code null})
  4. - *
  5. {@code PKTABLE_NAME} - String - primary key table name being imported - *
  6. - *
  7. {@code PKCOLUMN_NAME} - String - primary key column name being - * imported
  8. - *
  9. {@code FKTABLE_CAT} - String - foreign key table catalog name - * (possibly {@code null})
  10. - *
  11. {@code FKTABLE_SCHEM} - String - foreign key table schema name - * (possibly {@code null})
  12. - *
  13. {@code FKTABLE_NAME} - String - foreign key table name
  14. - *
  15. {@code FKCOLUMN_NAME} - String - foreign key column name
  16. - *
  17. {@code KEY_SEQ} - short - sequence number (in the foreign key)
  18. - *
  19. {@code UPDATE_RULE} - short - how to treat the foreign key when the corresponding primary - * key is updated: - *
      - *
    • {@code DatabaseMetaData.importedKeyNoAction} - don't allow any update of - * the primary key if it is imported as a foreign key
    • - *
    • {@code DatabaseMetaData.importedKeyCascade} - change imported key to - * match the primary key update
    • - *
    • {@code DatabaseMetaData.importedKeySetNull} - set the imported key to - * {@code null}
    • - *
    • {@code DatabaseMetaData.importedKeySetDefault} - set the imported key - * to its default value
    • - *
    • {@code DatabaseMetaData.importedKeyRestrict} - same as - * importedKeyNoAction
    • - *
    - *
  20. - *
  21. {@code DELETE_RULE} - short - how to treat the foreign key when the corresponding primary - * key is deleted: - *
      - *
    • {@code DatabaseMetaData.importedKeyNoAction} - don't allow the primary key to be deleted - * if it is imported as a foreign key
    • - *
    • {@code DatabaseMetaData.importedKeyCascade} - delete those rows that - * import a deleted key
    • - *
    • {@code DatabaseMetaData.importedKeySetNull} - set the imported key to - * {@code null}
    • - *
    • {@code DatabaseMetaData.importedKeySetDefault} - set the imported key - * to its default value
    • - *
    • {@code DatabaseMetaData.importedKeyRestrict} - same as {@code - * importedKeyNoAction}
    • - *
    - *
  22. - *
  23. {@code FK_NAME} - String - foreign key name (possibly {@code null})
  24. - *
  25. {@code PK_NAME} - String - primary key name (possibly {@code null})
  26. - *
  27. {@code DEFERRABILITY} - short - defines whether foreign key - * constraints can be deferred until commit (see SQL92 specification for - * definitions): - *
      - *
    • {@code DatabaseMetaData.importedKeyInitiallyDeferred}
    • - *
    • {@code DatabaseMetaData.importedKeyInitiallyImmediate}
    • - *
    • {@code DatabaseMetaData.importedKeyNotDeferrable}
    • - *
    - *
  28. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schema - * a schema name. {@code null} is used to imply no narrowing of - * the search by schema name. Otherwise, the name must match a - * schema name in the database, with "" used to retrieve those - * without a schema name. - * @param table - * a table name, which must match the name of a table in the - * database. - * @return a {@code ResultSet} containing the list of primary key columns as - * rows in the format defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getImportedKeys(String catalog, String schema, String table) - throws SQLException; - - /** - * Returns a list of indices and statistics for a specified table. - *

- * The list is returned as a {@code ResultSet}, with one row for each index - * or statistic. The list is ordered by {@code NON_UNIQUE}, {@code TYPE}, - * {@code INDEX_NAME}, and {@code ORDINAL_POSITION}. Each row has the - * following format: - *

    - *
  1. {@code TABLE_CAT} - String - table catalog name (possibly {@code - * null})
  2. - *
  3. {@code TABLE_SCHEM} - String - table schema name (possibly {@code - * null})
  4. - *
  5. {@code TABLE_NAME} - String - The table name
  6. - *
  7. {@code NON_UNIQUE} - boolean - {@code true} when index values can be - * non-unique. Must be {@code false} when the TYPE is tableIndexStatistic
  8. - *
  9. {@code INDEX_QUALIFIER} - String : index catalog name. {@code null} - * when the TYPE is 'tableIndexStatistic'
  10. - *
  11. {@code INDEX_NAME} - String : index name. {@code null} when TYPE is - * 'tableIndexStatistic'
  12. - *
  13. {@code TYPE} - short - the index type. One of: - *
      - *
    • {@code DatabaseMetaData.tableIndexStatistic} - table statistics - * returned with Index descriptions
    • - *
    • {@code DatabaseMetaData.tableIndexClustered} - a clustered Index
    • - *
    • {@code DatabaseMetaData.tableIndexHashed} - a hashed Index
    • - *
    • {@code DatabaseMetaData.tableIndexOther} - other style of Index
    • - *
    - *
  14. - *
  15. {@code ORDINAL_POSITION} - short - column sequence within Index. 0 - * when TYPE is tableIndexStatistic
  16. - *
  17. {@code COLUMN_NAME} - String - the column name. {@code null} when - * TYPE is tableIndexStatistic
  18. - *
  19. {@code ASC_OR_DESC} - String - column sort sequence. {@code null} if - * sequencing not supported or TYPE is tableIndexStatistic; otherwise "A" - * means sort ascending and "D" means sort descending.
  20. - *
  21. {@code CARDINALITY} - int - Number of unique values in the Index. If - * TYPE is tableIndexStatistic, this is number of rows in the table.
  22. - *
  23. {@code PAGES} - int - Number of pages for current Index. If TYPE is - * tableIndexStatistic, this is number of pages used for the table.
  24. - *
  25. {@code FILTER_CONDITION} - String - Filter condition. (possibly null) - *
  26. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schema - * a schema name. {@code null} is used to imply no narrowing of - * the search by schema name. Otherwise, the name must match a - * schema name in the database, with "" used to retrieve those - * without a schema name. - * @param table - * a table name, which must match the name of a table in the - * database. - * @param unique - * {@code true} means only return indices for unique values, - * {@code false} implies that they can be returned even if not - * unique. - * @param approximate - * {@code true} implies that the list can contain approximate or - * "out of data" values, {@code false} implies that all values - * must be precisely accurate - * @return a {@code ResultSet} containing the list of indices and statistics - * for the table, in the format defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getIndexInfo(String catalog, String schema, String table, - boolean unique, boolean approximate) throws SQLException; - - /** - * Returns this driver's major JDBC version number. - * - * @return the major JDBC version number. - * @throws SQLException - * a database error occurred. - */ - public int getJDBCMajorVersion() throws SQLException; - - /** - * Returns the minor JDBC version number for this driver. - * - * @return the Minor JDBC Version Number. - * @throws SQLException - * a database error occurred. - */ - public int getJDBCMinorVersion() throws SQLException; - - /** - * Get the maximum number of hex characters in an in-line binary literal for - * this database. - * - * @return the maximum number of hex characters in an in-line binary - * literal. If the number is unlimited then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxBinaryLiteralLength() throws SQLException; - - /** - * Returns the maximum size of a catalog name in this database. - * - * @return the maximum size in characters for a catalog name. If the limit - * is unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxCatalogNameLength() throws SQLException; - - /** - * Returns the maximum size for a character literal in this database. - * - * @return the maximum size in characters for a character literal. If the - * limit is unknown, or the value is unlimited, then the result is - * zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxCharLiteralLength() throws SQLException; - - /** - * Returns the maximum size for a Column name for this database. - * - * @return the maximum number of characters for a Column name. If the limit - * is unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxColumnNameLength() throws SQLException; - - /** - * Get the maximum number of columns in a {@code GROUP BY} clause for this - * database. - * - * @return the maximum number of columns in a {@code GROUP BY} clause. If - * the limit is unknown, or the value is unlimited, then the result - * is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxColumnsInGroupBy() throws SQLException; - - /** - * Returns the maximum number of columns in an Index for this database. - * - * @return the maximum number of columns in an Index. If the limit is - * unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxColumnsInIndex() throws SQLException; - - /** - * Returns the maximum number of columns in an {@code ORDER BY} clause for - * this database. - * - * @return the maximum number of columns in an {@code ORDER BY} clause. If - * the limit is unknown, or the value is unlimited, then the result - * is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxColumnsInOrderBy() throws SQLException; - - /** - * Returns the maximum number of columns in a {@code SELECT} list for this - * database. - * - * @return the maximum number of columns in a {@code SELECT} list. If the - * limit is unknown, or the value is unlimited, then the result is - * zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxColumnsInSelect() throws SQLException; - - /** - * Returns the maximum number of columns in a table for this database. - * - * @return the maximum number of columns in a table. If the limit is - * unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxColumnsInTable() throws SQLException; - - /** - * Returns the database's maximum number of concurrent connections. - * - * @return the maximum number of connections. If the limit is unknown, or - * the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxConnections() throws SQLException; - - /** - * Returns the maximum length of a cursor name for this database. - * - * @return the maximum number of characters in a cursor name. If the limit - * is unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxCursorNameLength() throws SQLException; - - /** - * Returns the maximum length in bytes for an Index for this database. This - * covers all the parts of a composite index. - * - * @return the maximum length in bytes for an Index. If the limit is - * unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxIndexLength() throws SQLException; - - /** - * Returns the maximum number of characters for a procedure name in this - * database. - * - * @return the maximum number of character for a procedure name. If the - * limit is unknown, or the value is unlimited, then the result is - * zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxProcedureNameLength() throws SQLException; - - /** - * Returns the maximum number of bytes within a single row for this - * database. - * - * @return the maximum number of bytes for a single row. If the limit is - * unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxRowSize() throws SQLException; - - /** - * Returns the maximum number of characters in a schema name for this - * database. - * - * @return the maximum number of characters in a schema name. If the limit - * is unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxSchemaNameLength() throws SQLException; - - /** - * Returns the maximum number of characters in an SQL statement for this - * database. - * - * @return the maximum number of characters in an SQL statement. If the - * limit is unknown, or the value is unlimited, then the result is - * zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxStatementLength() throws SQLException; - - /** - * Get the maximum number of simultaneously open active statements for this - * database. - * - * @return the maximum number of open active statements. If the limit is - * unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxStatements() throws SQLException; - - /** - * Returns the maximum size for a table name in the database. - * - * @return the maximum size in characters for a table name. If the limit is - * unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxTableNameLength() throws SQLException; - - /** - * Returns the maximum number of tables permitted in a {@code SELECT} - * statement for the database. - * - * @return the maximum number of tables permitted in a {@code SELECT} - * statement. If the limit is unknown, or the value is unlimited, - * then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxTablesInSelect() throws SQLException; - - /** - * Returns the maximum number of characters in a user name for the database. - * - * @return the maximum number of characters in a user name. If the limit is - * unknown, or the value is unlimited, then the result is zero. - * @throws SQLException - * a database error occurred. - */ - public int getMaxUserNameLength() throws SQLException; - - /** - * Returns a list of the math functions available with this database. These - * are used in the JDBC function escape clause and are the Open Group CLI - * math function names. - * - * @return a String which contains the list of math functions as a comma - * separated list. - * @throws SQLException - * a database error occurred. - */ - public String getNumericFunctions() throws SQLException; - - /** - * Returns a list of the primary key columns of a specified table. - *

- * The list is returned as a {@code ResultSet} with one row for each primary - * key column, ordered by {@code COLUMN_NAME}, with each row having the - * structure as follows: - *

    - *
  1. {@code TABLE_CAT} - String - table catalog name (possibly null)
  2. - *
  3. {@code TABLE_SCHEM} - String - table schema name (possibly null)
  4. - *
  5. {@code TABLE_NAME} - String - The table name
  6. - *
  7. {@code COLUMN_NAME} - String - The column name
  8. - *
  9. {@code KEY_SEQ} - short - the sequence number for this column in the - * primary key
  10. - *
  11. {@code PK_NAME} - String - the primary key name (possibly null)
  12. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with the empty string used - * to retrieve those without a catalog name. - * @param schema - * a schema name. {@code null} is used to imply no narrowing of - * the search by schema name. Otherwise, the name must match a - * schema name in the database, with the empty string used to - * retrieve those without a schema name. - * @param table - * the name of a table, which must match the name of a table in - * the database. - * @return a {@code ResultSet} containing the list of keys in the format - * defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getPrimaryKeys(String catalog, String schema, String table) - throws SQLException; - - /** - * Returns a list of parameter and result columns for the stored procedures - * belonging to a specified catalog. - *

- * The list is returned as a {@code ResultSet} with one row for each - * parameter or result column. The data is ordered by {@code - * PROCEDURE_SCHEM} and {@code PROCEDURE_NAME}, while for each procedure, - * the return value (if any) is first, followed by the parameters in the - * order they appear in the stored procedure call, followed by {@code - * ResultSet} columns in column number order. Each row has the following - * structure: - *

    - *
  1. {@code PROCEDURE_CAT} - String - the procedure catalog name
  2. - *
  3. {@code PROCEDURE_SCHEM} - String - the procedure schema name - * (possibly null)
  4. - *
  5. {@code PROCEDURE_NAME} - String - the procedure name
  6. - *
  7. {@code COLUMN_NAME} - String - the name of the column
  8. - *
  9. {@code COLUMN_TYPE} - short - the kind of column or parameter, as - * follows: - *
      - *
    • {@code DatabaseMetaData.procedureColumnUnknown} - type unknown
    • - *
    • {@code DatabaseMetaData.procedureColumnIn} - an {@code IN} parameter
    • - *
    • {@code DatabaseMetaData.procedureColumnInOut} - an {@code INOUT} - * parameter
    • - *
    • {@code DatabaseMetaData.procedureColumnOut} - an {@code OUT} - * parameter
    • - *
    • {@code DatabaseMetaData.procedureColumnReturn} - a return value
    • - *
    • {@code DatabaseMetaData.procedureReturnsResult} - a result column in - * a result set
    • - *
    - *
  10. - *
  11. {@code DATA_TYPE} - int - the SQL type of the data, as in {@code - * java.sql.Types}
  12. - *
  13. {@code TYPE_NAME} - String - the SQL type name, for a UDT it is fully - * qualified
  14. - *
  15. {@code PRECISION} - int - the precision
  16. - *
  17. {@code LENGTH} - int - the length of the data in bytes
  18. - *
  19. {@code SCALE} - short - the scale for numeric types
  20. - *
  21. {@code RADIX} - short - the Radix for numeric data (typically 2 or - * 10)
  22. - *
  23. {@code NULLABLE} - short - can the data contain {@code null}: - *
      - *
    • {@code DatabaseMetaData.procedureNoNulls} - {@code NULL}s not - * permitted
    • - *
    • {@code DatabaseMetaData.procedureNullable} - {@code NULL}s are - * permitted
    • - *
    • {@code DatabaseMetaData.procedureNullableUnknown} - {@code NULL} - * status unknown
    • - *
    - *
  24. - *
  25. {@code REMARKS} - String - an explanatory comment about the data item - *
  26. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schemaPattern - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param procedureNamePattern - * a pattern that must match the name of the procedure stored in - * the database. - * @param columnNamePattern - * a column name pattern. The name must match the column name - * stored in the database. - * @return a {@code ResultSet} with the list of parameter and result columns - * in the format defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getProcedureColumns(String catalog, String schemaPattern, - String procedureNamePattern, String columnNamePattern) - throws SQLException; - - /** - * Returns a list of the stored procedures available in a specified catalog. - *

- * The list is returned as a {@code ResultSet} with one row for each stored - * procedure, ordered by PROCEDURE_SCHEM and PROCEDURE_NAME, with the data - * in each row as follows: - *

    - *
  1. {@code PROCEDURE_CAT} - String : the procedure catalog name
  2. - *
  3. {@code PROCEDURE_SCHEM} - String : the procedure schema name - * (possibly {@code null})
  4. - *
  5. {@code PROCEDURE_NAME} - String : the procedure name
  6. - *
  7. {@code Reserved}
  8. - *
  9. {@code Reserved}
  10. - *
  11. {@code Reserved}
  12. - *
  13. {@code REMARKS} - String - information about the procedure
  14. - *
  15. {@code PROCEDURE_TYPE} - short : one of: - *
      - *
    • {@code DatabaseMetaData.procedureResultUnknown} - procedure may - * return a result
    • - *
    • {@code DatabaseMetaData.procedureNoResult} - procedure does not - * return a result
    • - *
    • {@code DatabaseMetaData.procedureReturnsResult} - procedure - * definitely returns a result
    • - *
    - *
  16. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schemaPattern - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param procedureNamePattern - * a procedure name pattern, which must match the procedure name - * stored in the database. - * @return a {@code ResultSet} where each row is a description of a stored - * procedure in the format defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getProcedures(String catalog, String schemaPattern, - String procedureNamePattern) throws SQLException; - - /** - * Returns the database vendor's preferred name for "procedure". - * - * @return a String with the vendor's preferred name for "procedure". - * @throws SQLException - * a database error occurred. - */ - public String getProcedureTerm() throws SQLException; - - /** - * Returns the result set's default holdability. - * - * @return one of {@code ResultSet.HOLD_CURSORS_OVER_COMMIT} or {@code - * ResultSet.CLOSE_CURSORS_AT_COMMIT}. - * @throws SQLException - * a database error occurred. - */ - public int getResultSetHoldability() throws SQLException; - - /** - * Returns a list of the schema names in the database. The list is returned - * as a {@code ResultSet}, ordered by the schema name, with one row per - * schema in the following format: - *
    - *
  1. {@code TABLE_SCHEM} - String - the schema name
  2. {@code - * TABLE_CATALOG} - String - the catalog name (possibly {@code null})
  3. - *
- * - * @return a {@code ResultSet} with one row for each schema in the format - * defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getSchemas() throws SQLException; - - /** - * Returns the database vendor's preferred term for "schema". - * - * @return a String which is the vendor's preferred term for schema. - * @throws SQLException - * a database error occurred. - */ - public String getSchemaTerm() throws SQLException; - - /** - * Returns the string that is used to escape wildcard characters. This - * string is used to escape the {@code '_'} and {@code '%'} wildcard - * characters in catalog search pattern strings. {@code '_'} is used to represent any single - * character while {@code '%'} is used for a sequence of zero or more - * characters. - * - * @return a String used to escape the wildcard characters. - * @throws SQLException - * a database error occurred. - */ - public String getSearchStringEscape() throws SQLException; - - /** - * Returns a list of all the SQL keywords that are NOT also SQL92 keywords - * for the database. - * - * @return a String containing the list of SQL keywords in a comma separated - * format. - * @throws SQLException - * a database error occurred. - */ - public String getSQLKeywords() throws SQLException; - - /** - * States the type of {@code SQLState} value returned by {@code - * SQLException.getSQLState}. This can either be the X/Open (now known as - * Open Group) SQL CLI form or the SQL99 form. - * - * @return an integer, which is either {@code - * DatabaseMetaData.sqlStateSQL99} or {@code - * DatabaseMetaData.sqlStateXOpen}. - * @throws SQLException - * a database error occurred. - */ - public int getSQLStateType() throws SQLException; - - /** - * Returns a list of string functions available with the database. These - * functions are used in JDBC function escape clause and follow the Open - * Group CLI string function names definition. - * - * @return a String containing the list of string functions in comma - * separated format. - * @throws SQLException - * a database error occurred. - */ - public String getStringFunctions() throws SQLException; - - /** - * Returns a listing of the hierarchies of tables in a specified schema in - * the database. - *

- * The listing only contains entries for tables that have a super table. - * Super tables and corresponding subtables must be defined in the same catalog and schema. The - * list is returned as a {@code ResultSet}, with one row for each table that - * has a super table, in the following format: - *

    - *
  1. {@code TABLE_CAT} - String - table catalog name (possibly {@code - * null})
  2. - *
  3. {@code TABLE_SCHEM} - String - Table schema name (possibly {@code - * null})
  4. - *
  5. {@code TABLE_NAME} - String - The table name
  6. - *
  7. SUPER{@code TABLE_NAME} - String - The super table name
  8. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schemaPattern - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param tableNamePattern - * a table name, which should match the table name as stored in - * the database. it may be a fully qualified name. If it is fully - * qualified the catalog name and schema name parameters are - * ignored. - * @return a {@code ResultSet} with one row for each table which has a super - * table, in the format defined above. An empty {@code ResultSet} is - * returned if the database does not support table hierarchies. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getSuperTables(String catalog, String schemaPattern, - String tableNamePattern) throws SQLException; - - /** - * Returns the User Defined Type (UDT) hierarchies for a given schema. Only - * the immediate parent/child relationship is described. If a UDT does not - * have a direct supertype, it is not listed. - *

- * The listing is returned as a {@code ResultSet} where there is one row for - * a specific UDT which describes its supertype, with the data organized in - * columns as follows: - *

    - *
  1. {@code TYPE_CAT} - String - the UDT catalog name (possibly {@code - * null})
  2. - *
  3. {@code TYPE_SCHEM} - String - the UDT schema name (possibly {@code - * null})
  4. - *
  5. {@code TYPE_NAME} - String - the UDT type name
  6. - *
  7. SUPER{@code TYPE_CAT} - String - direct supertype's catalog name - * (possibly {@code null})
  8. - *
  9. SUPER{@code TYPE_SCHEM} - String - direct supertype's schema name - * (possibly {@code null})
  10. - *
  11. SUPER{@code TYPE_NAME} - String - direct supertype's name
  12. - *
- * - * @param catalog - * the catalog name. "" means get the UDTs without a catalog. - * {@code null} means don't use the catalog name to restrict the - * search. - * @param schemaPattern - * the Schema pattern name. "" means get the UDT's without a - * schema. - * @param typeNamePattern - * the UDT name pattern. This may be a fully qualified name. When - * a fully qualified name is specified, the catalog name and - * schema name parameters are ignored. - * @return a {@code ResultSet} in which each row gives information about a - * particular UDT in the format defined above. An empty ResultSet is - * returned for a database that does not support type hierarchies. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getSuperTypes(String catalog, String schemaPattern, - String typeNamePattern) throws SQLException; - - /** - * Returns a list of system functions available with the database. These are - * names used in the JDBC function escape clause and are Open Group CLI - * function names. - * - * @return a String containing the list of system functions in a comma - * separated format. - * @throws SQLException - * a database error occurred. - */ - public String getSystemFunctions() throws SQLException; - - /** - * Returns a description of access rights for each table present in a - * catalog. Table privileges can apply to one or more columns in the table - - * but are not guaranteed to apply to all columns. - *

- * The privileges are returned as a {@code ResultSet}, with one row for each - * privilege, ordered by {@code TABLE_SCHEM}, {@code TABLE_NAME}, {@code - * PRIVILEGE}, and each row has data as defined in the following column - * definitions: - *

    - *
  1. {@code TABLE_CAT} - String - table catalog name (possibly {@code - * null})
  2. - *
  3. {@code TABLE_SCHEM} - String - Table schema name (possibly {@code - * null})
  4. - *
  5. {@code TABLE_NAME} - String - The table name
  6. - *
  7. GRANTOR - String - who granted the access
  8. - *
  9. GRANTEE - String - who received the access grant
  10. - *
  11. PRIVILEGE - String - the type of access granted - one of SELECT, - * INSERT, UPDATE, REFERENCES,...
  12. - *
  13. IS_GRANTABLE - String - {@code "YES"} implies the grantee can grant - * access to others, {@code "NO"} implies guarantee cannot grant access to - * others, {@code null} means this status is unknown
  14. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schemaPattern - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param tableNamePattern - * a Table Name, which should match the table name as stored in - * the database. - * @return a {@code ResultSet} containing a list with one row for each table - * in the format defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getTablePrivileges(String catalog, String schemaPattern, - String tableNamePattern) throws SQLException; - - /** - * Returns a description of the tables in a specified catalog. - *

- * The descriptions are returned as rows in a {@code ResultSet}, one row for - * each Table. The ResultSet is ordered by {@code TABLE_TYPE}, {@code - * TABLE_SCHEM} and {@code TABLE_NAME}. Each row in the ResultSet consists - * of a series of columns as follows: - *

    - *
  1. {@code TABLE_CAT} - String - table catalog name (possibly {@code - * null})
  2. - *
  3. {@code TABLE_SCHEM} - String - Table schema name (possibly {@code - * null})
  4. - *
  5. {@code TABLE_NAME} - String - The table name
  6. - *
  7. {@code TABLE_TYPE} - String - Typical names include "TABLE", "VIEW", - * "SYSTEM TABLE", "ALIAS", "SYNONYM", "GLOBAL TEMPORARY"
  8. - *
  9. {@code REMARKS} - String - A comment describing the table
  10. - *
  11. {@code TYPE_CAT} - String - the 'Types' catalog(possibly {@code null} - * )
  12. - *
  13. {@code TYPE_SCHEM} - String - the 'Types' schema(possibly {@code - * null})
  14. - *
  15. {@code TYPE_NAME} - String - the 'Types' name (possibly {@code null}) - *
  16. - *
  17. {@code SELF_REFERENCING_COL_NAME} - String - the name of a designated - * identifier column in a typed table (possibly {@code null})
  18. - *
  19. REF_GENERATION - String - one of the following values : "SYSTEM" | - * "USER" | "DERIVED" - specifies how values in the {@code - * SELF_REFERENCING_COL_NAME} are created (possibly {@code null})
  20. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schemaPattern - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search by schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param tableNamePattern - * a table name, which should match the table name as stored in - * the database. - * @param types - * a list of table types to include in the list. {@code null} - * implies list all types. - * @return a {@code ResultSet} with one row per table in the format defined - * above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getTables(String catalog, String schemaPattern, - String tableNamePattern, String[] types) throws SQLException; - - /** - * Returns a list of table types supported by the database. - *

- * The list is returned as a {@code ResultSet} with one row per table type, - * ordered by the table type. The information in the {@code ResultSet} is - * structured into a single column per row, as follows: - *

    - *
  1. {@code TABLE_TYPE} - String - the table type. Typical names include - * {@code "TABLE"}, {@code "VIEW"}, "{@code SYSTEM TABLE"}, {@code "ALIAS"}, - * {@code "SYNONYM"}, {@code "GLOBAL TEMPORARY"}
  2. - *
- * - * @return a {@code ResultSet} with one row per table type in the format - * defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getTableTypes() throws SQLException; - - /** - * Returns a list of time and date functions available for the database. - * - * @return a string containing a comma separated list of the time and date - * functions. - * @throws SQLException - * a database error occurred. - */ - public String getTimeDateFunctions() throws SQLException; - - /** - * Get a list of the standard SQL types supported by this database. The list - * is returned as a {@code ResultSet}, with one row for each type, ordered - * by the {@code DATA_TYPE} value, where the data in each row is structured - * into the following columns: - *
    - *
  1. {@code TYPE_NAME} - String : the type name
  2. - *
  3. {@code DATA_TYPE} - int : the SQL data type value as defined in - * {@code java.sql.Types}
  4. - *
  5. {@code PRECISION} - int - the maximum precision of the type
  6. - *
  7. {@code LITERAL_PREFIX} - String : the prefix to be used when quoting - * a literal value (possibly {@code null})
  8. - *
  9. {@code LITERAL_SUFFIX} - String : the suffix to be used when quoting - * a literal value (possibly {@code null})
  10. - *
  11. {@code CREATE_PARAMS} - String : params used when creating the type - * (possibly {@code null})
  12. - *
  13. {@code NULLABLE} - short : shows if the value is nullable: - *
      - *
    • {@code DatabaseMetaData.typeNoNulls} : {@code NULL}s not permitted
    • - *
    • {@code DatabaseMetaData.typeNullable} : {@code NULL}s are permitted
    • - *
    • {@code DatabaseMetaData.typeNullableUnknown} : {@code NULL} status - * unknown
    • - *
    - *
  14. - *
  15. {@code CASE_SENSITIVE} - boolean : true if the type is case sensitive - *
  16. - *
  17. {@code SEARCHABLE} - short : how this type can be used with {@code WHERE} - * clauses: - *
      - *
    • {@code DatabaseMetaData.typePredNone} - {@code WHERE} clauses cannot be used
    • - *
    • {@code DatabaseMetaData.typePredChar} - support for {@code - * WHERE...LIKE} only
    • - *
    • {@code DatabaseMetaData.typePredBasic} - support except for {@code - * WHERE...LIKE}
    • - *
    • {@code DatabaseMetaData.typeSearchable} - support for all {@code - * WHERE} clauses
    • - *
    - *
  18. - *
  19. {@code UNSIGNED_ATTRIBUTE} - boolean - the type is unsigned or not
  20. - *
  21. {@code FIXED_PREC_SCALE} - boolean - fixed precision = it can be used - * as a money value
  22. - *
  23. {@code AUTO_INCREMENT} - boolean - can be used as an auto-increment - * value
  24. - *
  25. {@code LOCAL_TYPE_NAME} - String - a localized version of the type - * name (possibly {@code null})
  26. - *
  27. {@code MINIMUM_SCALE} - short - the minimum scale supported
  28. - *
  29. {@code MAXIMUM_SCALE} - short - the maximum scale supported
  30. - *
  31. {@code SQL_DATA_TYPE} - int - not used
  32. - *
  33. {@code SQL_DATETIME_SUB} - int - not used
  34. - *
  35. {@code NUM_PREC_RADIX} - int - number radix (typically 2 or 10)
  36. - *
- * - * @return a {@code ResultSet} which is structured as described above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getTypeInfo() throws SQLException; - - /** - * Returns a description of the User Defined Types (UDTs) defined in a given - * schema, which includes the types {@code DISTINCT}, {@code STRUCT} and - * {@code JAVA_OBJECT}. - *

- * The types matching the supplied the specified catalog, schema, type name - * and type are returned as rows in a {@code ResultSet} with columns of - * information as follows: - *

    - *
  1. {@code TABLE_CAT} - String - catalog name (possibly {@code null})
  2. - *
  3. {@code TABLE_SCHEM} - String - schema name (possibly {@code null})
  4. - *
  5. {@code TABLE_NAME} - String - The table name
  6. - *
  7. {@code CLASS_NAME} - String - The Java class name
  8. - *
  9. {@code DATA_TYPE} - int - The SQL type as specified in {@code - * java.sql.Types}. One of DISTINCT, STRUCT, and JAVA_OBJECT
  10. - *
  11. {@code REMARKS} - String - A comment which describes the type
  12. - *
  13. {@code BASE_TYPE} - short - A type code. For a DISTINCT type, the - * source type. For a structured type this is the type that implements the - * user generated reference type of the {@code SELF_REFERENCING_COLUMN}. - * This is defined in {@code java.sql.Types}, and will be {@code null} if - * the {@code DATA_TYPE} does not match these criteria.
  14. - *
- *

- * If the driver does not support UDTs, the {@code ResultSet} is empty. - * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search by catalog name. Otherwise, the name must match a - * catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schemaPattern - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search using schema name. Otherwise, the name - * must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param typeNamePattern - * a type name pattern, which should match a type name as stored in the - * database. It may be fully qualified. - * @param types - * a list of the UDT types to include in the list - one of - * {@code DISTINCT}, {@code STRUCT} or {@code JAVA_OBJECT}. - * @return a {@code ResultSet} in the format described above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getUDTs(String catalog, String schemaPattern, - String typeNamePattern, int[] types) throws SQLException; - - /** - * Returns the URL for this database. - * - * @return the URL for the database. {@code null} if it cannot be generated. - * @throws SQLException - * a database error occurred. - */ - public String getURL() throws SQLException; - - /** - * Determine the user name as known by the database. - * - * @return the user name. - * @throws SQLException - * a database error occurred. - */ - public String getUserName() throws SQLException; - - /** - * Returns which of a table's columns are automatically updated when any - * value in a row is updated. - *

- * The result is laid-out in the following columns: - *

    - *
  1. {@code SCOPE} - short - not used
  2. - *
  3. {@code COLUMN_NAME} - String - Column name
  4. - *
  5. {@code DATA_TYPE} - int - The SQL data type, as defined in {@code - * java.sql.Types}
  6. - *
  7. {@code TYPE_NAME} - String - The SQL type name, data source dependent - *
  8. - *
  9. {@code COLUMN_SIZE} - int - Precision for numeric types
  10. - *
  11. {@code BUFFER_LENGTH} - int - Length of a column value in bytes
  12. - *
  13. {@code DECIMAL_DIGITS} - short - Number of digits after the decimal - * point
  14. - *
  15. {@code PSEUDO_COLUMN} - short - If this is a pseudo-column (for - * example, an Oracle {@code ROWID}): - *
      - *
    • {@code DatabaseMetaData.bestRowUnknown} - don't know whether this is - * a pseudo column
    • - *
    • {@code DatabaseMetaData.bestRowNotPseudo} - column is not pseudo
    • - *
    • {@code DatabaseMetaData.bestRowPseudo} - column is a pseudo column
    • - *
    - *
  16. - *
- * - * @param catalog - * a catalog name. {@code null} is used to imply no narrowing of - * the search using catalog name. Otherwise, the name must match - * a catalog name held in the database, with "" used to retrieve - * those without a catalog name. - * @param schema - * a schema name pattern. {@code null} is used to imply no - * narrowing of the search using schema names. Otherwise, the - * name must match a schema name in the database, with "" used to - * retrieve those without a schema name. - * @param table - * a table name. It must match the name of a table in the - * database. - * @return a {@code ResultSet} containing the descriptions, one row for each - * column, in the format defined above. - * @throws SQLException - * a database error occurred. - */ - public ResultSet getVersionColumns(String catalog, String schema, - String table) throws SQLException; - - /** - * Determines whether a visible row insert can be detected by calling {@code - * ResultSet.rowInserted}. - * - * @param type - * the {@code ResultSet} type. This may be one of {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} or {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE} or {@code - * ResultSet.TYPE_FORWARD_ONLY}, - * @return {@code true} if {@code ResultSet.rowInserted} detects a visible - * row insert otherwise {@code false}. - * @throws SQLException - * a database error occurred. - * @see ResultSet#rowInserted() - */ - public boolean insertsAreDetected(int type) throws SQLException; - - /** - * Determine whether a fully qualified table name is prefixed or suffixed to - * a fully qualified table name. - * - * @return {@code true} if the catalog appears at the start of a fully - * qualified table name, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean isCatalogAtStart() throws SQLException; - - /** - * Determines whether the database is in read-only mode. - * - * @return {@code true} if the database is in read-only mode, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean isReadOnly() throws SQLException; - - /** - * Determines whether updates are made to a copy of, or directly on, Large Objects - * ({@code LOB}s). - * - * @return {@code true} if updates are made to a copy of the Large Object, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean locatorsUpdateCopy() throws SQLException; - - /** - * Determines whether the database handles concatenations between {@code NULL} and - * non-{@code NULL} values by producing a {@code NULL} output. - * - * @return {@code true} if {@code NULL} to non-{@code NULL} concatenations - * produce a {@code NULL} result, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean nullPlusNonNullIsNull() throws SQLException; - - /** - * Determines whether {@code NULL} values are always sorted to the end of sorted - * results regardless of requested sort order. This means that they will - * appear at the end of sorted lists whatever other non-{@code NULL} values - * may be present. - * - * @return {@code true} if {@code NULL} values are sorted at the end, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean nullsAreSortedAtEnd() throws SQLException; - - /** - * Determines whether {@code NULL} values are always sorted at the start of the - * sorted list, irrespective of the sort order. This means that they appear - * at the start of sorted lists, whatever other values may be present. - * - * @return {@code true} if {@code NULL} values are sorted at the start, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean nullsAreSortedAtStart() throws SQLException; - - /** - * Determines whether {@code NULL} values are sorted high - i.e. they are sorted - * as if they are higher than any other values. - * - * @return {@code true} if {@code NULL} values are sorted high, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean nullsAreSortedHigh() throws SQLException; - - /** - * Determines whether {@code NULL} values are sorted low - i.e. they are sorted as - * if they are lower than any other values. - * - * @return {@code true} if {@code NULL} values are sorted low, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean nullsAreSortedLow() throws SQLException; - - /** - * Determines whether deletes made by others are visible, for a specified {@code - * ResultSet} type. - * - * @param type - * the type of the {@code ResultSet}. It may be either {@code - * ResultSet.TYPE_FORWARD_ONLY} or {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE}) - * @return {@code true} if others' deletes are visible, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean othersDeletesAreVisible(int type) throws SQLException; - - /** - * Determines whether inserts made by others are visible, for a specified {@code - * ResultSet} type. - * - * @param type - * the type of the {@code ResultSet}. May be {@code - * ResultSet.TYPE_FORWARD_ONLY}, or {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} - * @return {@code true} if others' inserts are visible, otherwise {@code - * false}. - * @throws SQLException - * a database error occurred. - */ - public boolean othersInsertsAreVisible(int type) throws SQLException; - - /** - * Determines whether updates made by others are visible, for a specified {@code - * ResultSet} type. - * - * @param type - * the type of the {@code ResultSet}. May be {@code - * ResultSet.TYPE_FORWARD_ONLY}, or {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} - * @return {@code true} if others' inserts are visible, otherwise {@code - * false}. - * @throws SQLException - * a database error occurred. - */ - public boolean othersUpdatesAreVisible(int type) throws SQLException; - - /** - * Determines whether a {@code ResultSet} can see its own deletes, for a - * specified {@code ResultSet} type. - * - * @param type - * the type of the {@code ResultSet}: {@code - * ResultSet.TYPE_FORWARD_ONLY}, {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} - * @return {@code true} if the deletes are seen by the {@code - * ResultSet} itself, otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean ownDeletesAreVisible(int type) throws SQLException; - - /** - * Determines whether a {@code ResultSet} can see its own inserts, for a - * specified {@code ResultSet} type. - * - * @param type - * the type of the {@code ResultSet}: {@code - * ResultSet.TYPE_FORWARD_ONLY}, {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} - * @return {@code true} if the inserts are seen by the {@code - * ResultSet} itself, otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean ownInsertsAreVisible(int type) throws SQLException; - - /** - * Determines whether a {@code ResultSet} can see its own updates, for a - * specified {@code ResultSet} type. - * - * @param type - * the type of the {@code ResultSet}: {@code - * ResultSet.TYPE_FORWARD_ONLY}, {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} - * @return {@code true} if the updates are seen by the {@code - * ResultSet} itself, otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean ownUpdatesAreVisible(int type) throws SQLException; - - /** - * Determines whether the database treats SQL identifiers that are in mixed - * case (and unquoted) as case insensitive. If {@code true} then the - * database stores them in lower case. - * - * @return {@code true} if unquoted SQL identifiers are stored in lower - * case, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean storesLowerCaseIdentifiers() throws SQLException; - - /** - * Determines whether the database considers mixed case quoted SQL - * identifiers as case insensitive and stores them in lower case. - * - * @return {@code true} if quoted SQL identifiers are stored in lower case, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean storesLowerCaseQuotedIdentifiers() throws SQLException; - - /** - * Determines whether the database considers mixed case unquoted SQL - * identifiers as case insensitive and stores them in mixed case. - * - * @return {@code true} if unquoted SQL identifiers as stored in mixed case, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean storesMixedCaseIdentifiers() throws SQLException; - - /** - * Determines whether the database considers identifiers as case insensitive - * if they are mixed case quoted SQL. The database stores them in mixed - * case. - * - * @return {@code true} if quoted SQL identifiers are stored in mixed case, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean storesMixedCaseQuotedIdentifiers() throws SQLException; - - /** - * Determines whether the database considers mixed case unquoted SQL - * identifiers as case insensitive and stores them in upper case. - * - * @return {@code true} if unquoted SQL identifiers are stored in upper - * case, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean storesUpperCaseIdentifiers() throws SQLException; - - /** - * Determines whether the database considers mixed case quoted SQL - * identifiers as case insensitive and stores them in upper case. - * - * @return {@code true} if quoted SQL identifiers are stored in upper case, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean storesUpperCaseQuotedIdentifiers() throws SQLException; - - /** - * Determines whether the database supports {@code ALTER TABLE} operation with - * {@code ADD COLUMN}. - * - * @return {@code true} if {@code ALTER TABLE} with {@code ADD COLUMN} is - * supported, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsAlterTableWithAddColumn() throws SQLException; - - /** - * Determines whether the database supports {@code ALTER TABLE} operation with - * {@code DROP COLUMN}. - * - * @return {@code true} if {@code ALTER TABLE} with {@code DROP COLUMN} is - * supported, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsAlterTableWithDropColumn() throws SQLException; - - /** - * Determines whether the database supports the ANSI92 entry level SQL grammar. - * - * @return {@code true} if the ANSI92 entry level SQL grammar is supported, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsANSI92EntryLevelSQL() throws SQLException; - - /** - * Determines whether the database supports the ANSI92 full SQL grammar. - * - * @return {@code true} if the ANSI92 full SQL grammar is supported, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsANSI92FullSQL() throws SQLException; - - /** - * Determines whether the database supports the ANSI92 intermediate SQL Grammar. - * - * @return {@code true} if the ANSI92 intermediate SQL grammar is supported, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsANSI92IntermediateSQL() throws SQLException; - - /** - * Determines whether the database supports batch updates. - * - * @return {@code true} if batch updates are supported, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsBatchUpdates() throws SQLException; - - /** - * Determines whether catalog names may be used in data manipulation - * statements. - * - * @return {@code true} if catalog names can be used in data manipulation - * statements, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsCatalogsInDataManipulation() throws SQLException; - - /** - * Determines whether catalog names can be used in index definition statements. - * - * @return {@code true} if catalog names can be used in index definition - * statements, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsCatalogsInIndexDefinitions() throws SQLException; - - /** - * Determines whether catalog names can be used in privilege definition - * statements. - * - * @return {@code true} if catalog names can be used in privilege definition - * statements, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException; - - /** - * Determines whether catalog names can be used in procedure call statements. - * - * @return {@code true} if catalog names can be used in procedure call - * statements. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsCatalogsInProcedureCalls() throws SQLException; - - /** - * Determines whether catalog names may be used in table definition statements. - * - * @return {@code true} if catalog names can be used in definition - * statements, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsCatalogsInTableDefinitions() throws SQLException; - - /** - * Determines whether the database supports column aliasing. - *

- * If aliasing is supported, then the SQL AS clause is used to provide names - * for computed columns and provide alias names for columns. - * - * @return {@code true} if column aliasing is supported, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsColumnAliasing() throws SQLException; - - /** - * Determines whether the database supports the {@code CONVERT} operation between - * SQL types. - * - * @return {@code true} if the {@code CONVERT} operation is supported, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsConvert() throws SQLException; - - /** - * Determines whether the database supports {@code CONVERT} operation for two - * supplied SQL types. - * - * @param fromType - * the Type to convert from, as defined by {@code java.sql.Types} - * @param toType - * the Type to convert to, as defined by {@code java.sql.Types} - * @return {@code true} if the {@code CONVERT} operation is supported for - * these types, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsConvert(int fromType, int toType) - throws SQLException; - - /** - * Determines whether the database supports the Core SQL Grammar for ODBC. - * - * @return {@code true} if the Core SQL Grammar is supported, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsCoreSQLGrammar() throws SQLException; - - /** - * Determines whether the database supports correlated sub-queries. - * - * @return {@code true} if the database does support correlated sub-queries - * and {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsCorrelatedSubqueries() throws SQLException; - - /** - * Determines whether the database allows both data definition and data - * manipulation statements inside a transaction. - * - * @return {@code true} if both types of statement are permitted, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsDataDefinitionAndDataManipulationTransactions() - throws SQLException; - - /** - * Determines whether the database only allows data manipulation statements inside - * a transaction. - * - * @return {@code true} if data manipulation statements are permitted only within a transaction, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsDataManipulationTransactionsOnly() - throws SQLException; - - /** - * Determines whether table correlation names are required to be different from - * the names of the tables, when they are supported. - * - * @return {@code true} if correlation names must be different from table - * names, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsDifferentTableCorrelationNames() throws SQLException; - - /** - * Determines whether expressions in {@code ORDER BY} lists are supported. - * - * @return {@code true} if expressions in {@code ORDER BY} lists are - * supported. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsExpressionsInOrderBy() throws SQLException; - - /** - * Determines whether the Extended SQL Grammar for ODBC is supported. - * - * @return {@code true} if the Extended SQL Grammar is supported, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsExtendedSQLGrammar() throws SQLException; - - /** - * Determines whether the database supports full nested outer joins. - * - * @return {@code true} if full nested outer joins are supported, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsFullOuterJoins() throws SQLException; - - /** - * Determines whether auto generated keys can be returned when a statement - * executes. - * - * @return {@code true} if auto generated keys can be returned, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsGetGeneratedKeys() throws SQLException; - - /** - * Determines whether the database supports {@code GROUP BY} clauses. - * - * @return {@code true} if the {@code GROUP BY} clause is supported, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsGroupBy() throws SQLException; - - /** - * Determines whether the database supports using a column name in a {@code GROUP - * BY} clause not included in the {@code SELECT} statement as long as all of - * the columns in the {@code SELECT} statement are used in the {@code GROUP - * BY} clause. - * - * @return {@code true} if {@code GROUP BY} clauses can use column names in - * this way, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsGroupByBeyondSelect() throws SQLException; - - /** - * Determines whether the database supports using a column name in a {@code GROUP - * BY} clause that is not in the {@code SELECT} statement. - * - * @return {@code true} if {@code GROUP BY} clause can use a column name not - * in the {@code SELECT} statement, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsGroupByUnrelated() throws SQLException; - - /** - * Determines whether the database supports SQL Integrity Enhancement - * Facility. - * - * @return {@code true} if the Integrity Enhancement Facility is supported, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsIntegrityEnhancementFacility() throws SQLException; - - /** - * Determines whether the database supports a {@code LIKE} escape clause. - * - * @return {@code true} if LIKE escape clause is supported, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsLikeEscapeClause() throws SQLException; - - /** - * Determines whether the database provides limited support for outer join - * operations. - * - * @return {@code true} if there is limited support for outer join - * operations, {@code false} otherwise. This will be {@code true} if - * {@code supportsFullOuterJoins} returns {@code true}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsLimitedOuterJoins() throws SQLException; - - /** - * Determines whether the database supports Minimum SQL Grammar for ODBC. - * - * @return {@code true} if the Minimum SQL Grammar is supported, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsMinimumSQLGrammar() throws SQLException; - - /** - * Determines whether the database treats mixed case unquoted SQL identifiers as - * case sensitive storing them in mixed case. - * - * @return {@code true} if unquoted SQL identifiers are stored in mixed - * case, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsMixedCaseIdentifiers() throws SQLException; - - /** - * Determines whether the database considers mixed case quoted SQL - * identifiers as case sensitive, storing them in mixed case. - * - * @return {@code true} if quoted SQL identifiers are stored in mixed case, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException; - - /** - * Determines whether it is possible for a single {@code CallableStatement} to - * return multiple {@code ResultSet}s simultaneously. - * - * @return {@code true} if a single {@code CallableStatement} can return - * multiple {@code ResultSet}s simultaneously, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsMultipleOpenResults() throws SQLException; - - /** - * Determines whether retrieving multiple {@code ResultSet}s from a single - * call to the {@code execute} method is supported. - * - * @return {@code true} if multiple {@code ResultSet}s can be retrieved, - * {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsMultipleResultSets() throws SQLException; - - /** - * Determines whether multiple simultaneous transactions on - * different connections are supported. - * - * @return {@code true} if multiple open transactions are supported, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsMultipleTransactions() throws SQLException; - - /** - * Determines whether callable statements with named parameters is supported. - * - * @return {@code true} if named parameters can be used with callable - * statements, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsNamedParameters() throws SQLException; - - /** - * Determines whether columns in the database can be defined as non-nullable. - * - * @return {@code true} if columns can be defined non-nullable, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsNonNullableColumns() throws SQLException; - - /** - * Determines whether keeping cursors open across commit operations is - * supported. - * - * @return {@code true} if cursors can be kept open across commit - * operations, {@code false} if they might get closed. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsOpenCursorsAcrossCommit() throws SQLException; - - /** - * Determines whether the database can keep cursors open across rollback - * operations. - * - * @return {@code true} if cursors can be kept open across rollback - * operations, {@code false} if they might get closed. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsOpenCursorsAcrossRollback() throws SQLException; - - /** - * Determines whether keeping statements open across commit operations is - * supported. - * - * @return {@code true} if statements can be kept open, {@code false} if - * they might not. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsOpenStatementsAcrossCommit() throws SQLException; - - /** - * Determines whether keeping statements open across rollback operations is - * supported. - * - * @return {@code true} if statements can be kept open, {@code false} if - * they might not. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsOpenStatementsAcrossRollback() throws SQLException; - - /** - * Determines whether using a column in an {@code ORDER BY} clause that is - * not in the {@code SELECT} statement is supported. - * - * @return {@code true} if it is possible to {@code ORDER} using a column - * not in the {@code SELECT}, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsOrderByUnrelated() throws SQLException; - - /** - * Determines whether outer join operations are supported. - * - * @return {@code true} if outer join operations are supported, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsOuterJoins() throws SQLException; - - /** - * Determines whether positioned {@code DELETE} statements are supported. - * - * @return {@code true} if the database supports positioned {@code DELETE} - * statements. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsPositionedDelete() throws SQLException; - - /** - * Determines whether positioned {@code UPDATE} statements are supported. - * - * @return {@code true} if the database supports positioned {@code UPDATE} - * statements, {@code false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsPositionedUpdate() throws SQLException; - - /** - * Determines whether there is support for a given concurrency style for the - * given {@code ResultSet}. - * - * @param type - * the {@code ResultSet} type, as defined in {@code - * java.sql.ResultSet}: - *

    - *
  • {@code ResultSet.TYPE_FORWARD_ONLY}
  • - *
  • {@code ResultSet.TYPE_SCROLL_INSENSITIVE}
  • - *
  • {@code ResultSet.TYPE_SCROLL_SENSITIVE}
  • - *
- * @param concurrency - * a concurrency type, which may be one of {@code - * ResultSet.CONCUR_READ_ONLY} or {@code - * ResultSet.CONCUR_UPDATABLE}. - * @return {@code true} if that concurrency and {@code ResultSet} type - * pairing is supported otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsResultSetConcurrency(int type, int concurrency) - throws SQLException; - - /** - * Determines whether the supplied {@code ResultSet} holdability mode is - * supported. - * - * @param holdability - * as specified in {@code java.sql.ResultSet}: {@code - * ResultSet.HOLD_CURSORS_OVER_COMMIT} or {@code - * ResultSet.CLOSE_CURSORS_AT_COMMIT} - * @return {@code true} if the given ResultSet holdability is supported and - * if it isn't then {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsResultSetHoldability(int holdability) - throws SQLException; - - /** - * Determines whether the supplied {@code ResultSet} type is supported. - * - * @param type - * the {@code ResultSet} type as defined in {@code - * java.sql.ResultSet}: {@code ResultSet.TYPE_FORWARD_ONLY}, - * {@code ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} - * @return {@code true} if the {@code ResultSet} type is supported, {@code - * false} otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsResultSetType(int type) throws SQLException; - - /** - * Determines whether savepoints for transactions are supported. - * - * @return {@code true} if savepoints are supported, {@code false} - * otherwise. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSavepoints() throws SQLException; - - /** - * Determines whether a schema name may be used in a data manipulation - * statement. - * - * @return {@code true} if a schema name can be used in a data manipulation, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSchemasInDataManipulation() throws SQLException; - - /** - * Determines whether a schema name may be used in an index definition - * statement. - * - * @return {@code true} if a schema name can be used in an index definition, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSchemasInIndexDefinitions() throws SQLException; - - /** - * Determines whether a database schema name can be used in a privilege - * definition statement. - * - * @return {@code true} if a database schema name may be used in a privilege - * definition, otherwise {@code false} - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException; - - /** - * Determines whether a procedure call statement may be contain in a schema name. - * - * @return {@code true} if a schema name can be used in a procedure call, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSchemasInProcedureCalls() throws SQLException; - - /** - * Determines whether a schema name can be used in a table definition statement. - * - * @return {@code true} if a schema name can be used in a table definition, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSchemasInTableDefinitions() throws SQLException; - - /** - * Determines whether the {@code SELECT FOR UPDATE} statement is supported. - * - * @return {@code true} if {@code SELECT FOR UPDATE} statements are - * supported, otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSelectForUpdate() throws SQLException; - - /** - * Determines whether statement pooling is supported. - * - * @return {@code true} of the database does support statement pooling, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsStatementPooling() throws SQLException; - - /** - * Determines whether stored procedure calls using the stored procedure - * escape syntax is supported. - * - * @return {@code true} if stored procedure calls using the stored procedure - * escape syntax are supported, otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsStoredProcedures() throws SQLException; - - /** - * Determines whether subqueries in comparison expressions are supported. - * - * @return {@code true} if subqueries are supported in comparison - * expressions. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSubqueriesInComparisons() throws SQLException; - - /** - * Determines whether subqueries in {@code EXISTS} expressions are supported. - * - * @return {@code true} if subqueries are supported in {@code EXISTS} - * expressions, otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSubqueriesInExists() throws SQLException; - - /** - * Determines whether subqueries in {@code IN} statements are supported. - * - * @return {@code true} if subqueries are supported in {@code IN} statements, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSubqueriesInIns() throws SQLException; - - /** - * Determines whether subqueries in quantified expressions are supported. - * - * @return {@code true} if subqueries are supported, otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsSubqueriesInQuantifieds() throws SQLException; - - /** - * Determines whether the database has table correlation names support. - * - * @return {@code true} if table correlation names are supported, otherwise - * {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsTableCorrelationNames() throws SQLException; - - /** - * Determines whether a specified transaction isolation level is supported. - * - * @param level - * the transaction isolation level, as specified in {@code - * java.sql.Connection}: {@code TRANSACTION_NONE}, {@code - * TRANSACTION_READ_COMMITTED}, {@code - * TRANSACTION_READ_UNCOMMITTED}, {@code - * TRANSACTION_REPEATABLE_READ}, {@code TRANSACTION_SERIALIZABLE} - * @return {@code true} if the specific isolation level is supported, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsTransactionIsolationLevel(int level) - throws SQLException; - - /** - * Determines whether transactions are supported. - *

- * If transactions are not supported, then the {@code commit} method does - * nothing and the transaction isolation level is always {@code - * TRANSACTION_NONE}. - * - * @return {@code true} if transactions are supported, otherwise {@code - * false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsTransactions() throws SQLException; - - /** - * Determines whether the {@code SQL UNION} operation is supported. - * - * @return {@code true} of the database does support {@code UNION}, otherwise - * {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsUnion() throws SQLException; - - /** - * Determines whether the {@code SQL UNION ALL} operation is supported. - * - * @return {@code true} if the database does support {@code UNION ALL}, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean supportsUnionAll() throws SQLException; - - /** - * Determines whether the method {@code ResultSet.rowUpdated} can detect a visible - * row update for the specified {@code ResultSet} type. - * - * @param type - * {@code ResultSet} type: {@code ResultSet.TYPE_FORWARD_ONLY}, - * {@code ResultSet.TYPE_SCROLL_INSENSITIVE}, or {@code - * ResultSet.TYPE_SCROLL_SENSITIVE} - * @return {@code true} detecting changes is possible, otherwise {@code - * false}. - * @throws SQLException - * a database error occurred. - */ - public boolean updatesAreDetected(int type) throws SQLException; - - /** - * Determines whether this database uses a file for each table. - * - * @return {@code true} if the database uses one file for each table, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean usesLocalFilePerTable() throws SQLException; - - /** - * Determines whether this database uses a local file to store tables. - * - * @return {@code true} if the database stores tables in a local file, - * otherwise {@code false}. - * @throws SQLException - * a database error occurred. - */ - public boolean usesLocalFiles() throws SQLException; - - /** - * Determine if a SQLException while autoCommit is true indicates that all - * open ResultSets are closed, even ones that are holdable - * - * @return true if all open ResultSets are closed - * @throws SQLException - * if any error occurs - */ - boolean autoCommitFailureClosesAllResultSets() throws SQLException; - - /** - * Returns a list of the client info properties of the driver. - * - * @return a list of the client info - * @throws SQLException - * if any error occurs - */ - ResultSet getClientInfoProperties() throws SQLException; - - /** - * Returns a description according to the given catalog's system or user - * function parameters and return type. - * - * @param catalog - * the given catalong - * @param schemaPattern - * the schema pattern - * @param functionNamePattern - * the function name pattern - * @param columnNamePattern - * the column name pattern - * @return a description of user functions - * @throws SQLException - * if any error occurs - */ - ResultSet getFunctionColumns(String catalog, String schemaPattern, - String functionNamePattern, String columnNamePattern) - throws SQLException; - - /** - * Returns a description of the system and user functions available - * according to the given catalog. - * - * @param catalog - * the given catalog - * @param schemaPattern - * the schema pattern - * @param functionNamePattern - * the function name pattern - * @return user functions - * @throws SQLException - * if any error occurs - */ - ResultSet getFunctions(String catalog, String schemaPattern, - String functionNamePattern) throws SQLException; - - /** - * Returns the lifetime for which a RowId object remains valid if this data - * source supports the SQL ROWID type - * - * @return the time of a RowId object that remains valid. - * @throws SQLException - * if any error occurs - */ - RowIdLifetime getRowIdLifetime() throws SQLException; - - /** - * Returns the schema names ordered by TABLE_CATALOG and TABLE_SCHEMA. - * - * @param catalog - * the catalog - * @param schemaPattern - * the schema pattern - * @return the schema names - * @throws SQLException - * if any error occurs - */ - ResultSet getSchemas(String catalog, String schemaPattern) - throws SQLException; - - /** - * Determine if this database supports invoking user-defined or vendor - * functions using the stored procedure escape syntax. - * - * @return true if this database supports invoking user-defined or vendor - * functions using the stored procedure escape syntax. - * @throws SQLException - * if any error occurs - */ - boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Date.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Date.java deleted file mode 100644 index eae1ea8c5c..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Date.java +++ /dev/null @@ -1,246 +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 java.sql; - -/** - * A class which can consume and produce dates in SQL {@code Date} format. - *

- * Dates are represented in SQL as {@code yyyy-MM-dd}. Note that this date - * format only deals with year, month and day values. There are no values for - * hours, minutes, seconds. - *

- * This is unlike the familiar {@code java.util.Date} object, which also includes - * values for hours, minutes, seconds, and milliseconds. - *

- * Time points are handled as millisecond values - milliseconds since the Epoch, - * January 1st 1970, 00:00:00.000 GMT. Time values passed to the {@code - * java.sql.Date} class are "normalized" to the time 00:00:00.000 GMT on the - * date implied by the time value. - */ -//@FindBugsSuppressWarnings("NM_SAME_SIMPLE_NAME_AS_SUPERCLASS") -public class Date extends java.util.Date { - - private static final long serialVersionUID = 1511598038487230103L; - - /** - * Constructs a {@code Date} object corresponding to the supplied year, - * month and day. - * - * @deprecated Use the constructor {@link #Date(long)} instead. - * @param theYear - * the year, specified as the year minus 1900. Must be in the - * range {@code [0,8099]}. - * @param theMonth - * the month, specified as a number with 0 = January. Must be in - * the range {@code [0,11]}. - * @param theDay - * the day in the month. Must be in the range {@code [1,31]}. - */ - @Deprecated - public Date(int theYear, int theMonth, int theDay) { - super(theYear, theMonth, theDay); - } - - /** - * Creates a date which corresponds to the day determined by the supplied - * milliseconds time value {@code theDate}. - * - * @param theDate - * a time value in milliseconds since the epoch - January 1 1970 - * 00:00:00 GMT. The time value (hours, minutes, seconds, - * milliseconds) stored in the {@code Date} object is adjusted to - * correspond to 00:00:00 GMT on the day determined by the supplied - * time value. - */ - public Date(long theDate) { - super(normalizeTime(theDate)); - } - - /** - * @deprecated This method is deprecated and must not be used. SQL {@code - * Date} values do not have an hours component. - * @return does not return anything. - * @throws IllegalArgumentException - * if this method is called. - */ - @Deprecated - @Override - public int getHours() { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. SQL {@code - * Date} values do not have a minutes component. - * @return does not return anything. - * @throws IllegalArgumentException - * if this method is called. - */ - @Deprecated - @Override - public int getMinutes() { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. SQL {@code - * Date} values do not have a seconds component. - * @return does not return anything. - * @throws IllegalArgumentException - * if this method is called. - */ - @Deprecated - @Override - public int getSeconds() { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. SQL {@code - * Date} values do not have an hours component. - * @param theHours - * the number of hours to set. - * @throws IllegalArgumentException - * if this method is called. - */ - @Deprecated - @Override - public void setHours(int theHours) { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. SQL {@code - * Date} values do not have a minutes component. - * @param theMinutes - * the number of minutes to set. - * @throws IllegalArgumentException - * if this method is called. - */ - @Deprecated - @Override - public void setMinutes(int theMinutes) { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. SQL {@code - * Date} values do not have a seconds component. - * @param theSeconds - * the number of seconds to set. - * @throws IllegalArgumentException - * if this method is called. - */ - @Deprecated - @Override - public void setSeconds(int theSeconds) { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * Sets this date to a date supplied as a milliseconds value. The date is - * set based on the supplied time value and rounded to zero GMT for that day. - * - * @param theTime - * the time in milliseconds since the Epoch. - */ - @Override - public void setTime(long theTime) { - /* - * Store the Date based on the supplied time after removing any time - * elements finer than the day based on zero GMT - */ - super.setTime(normalizeTime(theTime)); - } - - /** - * Produces a string representation of the date in SQL format - * - * @return a string representation of the date in SQL format - {@code "yyyy-MM-dd"}. - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(10); - - format((getYear() + 1900), 4, sb); - sb.append('-'); - format((getMonth() + 1), 2, sb); - sb.append('-'); - format(getDate(), 2, sb); - - return sb.toString(); - } - - private static final String PADDING = "0000"; - - /* - * Private method to format the time - */ - private void format(int date, int digits, StringBuilder sb) { - String str = String.valueOf(date); - if (digits - str.length() > 0) { - sb.append(PADDING.substring(0, digits - str.length())); - } - sb.append(str); - } - - /** - * Creates a {@code Date} from a string representation of a date in SQL - * format. - * - * @param dateString - * the string representation of a date in SQL format - " {@code yyyy-MM-dd}". - * @return the {@code Date} object. - * @throws IllegalArgumentException - * if the format of the supplied string does not match the SQL - * format. - */ - public static Date valueOf(String dateString) { - if (dateString == null) { - throw new IllegalArgumentException("dateString == null"); - } - int firstIndex = dateString.indexOf('-'); - int secondIndex = dateString.indexOf('-', firstIndex + 1); - // secondIndex == -1 means none or only one separator '-' has been - // found. - // The string is separated into three parts by two separator characters, - // if the first or the third part is null string, we should throw - // IllegalArgumentException to follow RI - if (secondIndex == -1 || firstIndex == 0 - || secondIndex + 1 == dateString.length()) { - throw new IllegalArgumentException(); - } - // parse each part of the string - int year = Integer.parseInt(dateString.substring(0, firstIndex)); - int month = Integer.parseInt(dateString.substring(firstIndex + 1, - secondIndex)); - int day = Integer.parseInt(dateString.substring(secondIndex + 1, - dateString.length())); - return new Date(year - 1900, month - 1, day); - } - - /* - * Private method which normalizes a Time value, removing all low - * significance digits corresponding to milliseconds, seconds, minutes and - * hours, so that the returned Time value corresponds to 00:00:00 GMT on a - * particular day. - */ - private static long normalizeTime(long theTime) { - return theTime; - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Driver.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Driver.java deleted file mode 100644 index fc35a30f53..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Driver.java +++ /dev/null @@ -1,121 +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 java.sql; - -import java.util.Properties; - -/** - * An interface to a JDBC driver. Instances are returned by {@link DriverManager}. - * - *

The JDBC driver uses URLs to specify the location of specific data. URL - * format typically takes the form " {@code xxxx:yyyy:SpecificData}", where " - * {@code xxxx:yyyy}" is referred to as the subprotocol and is normally - * the same for all of a particular driver. " {@code SpecificData}" is a string - * which identifies the particular data source that the driver should use. - * - * @see DriverManager - */ -public interface Driver { - - /** - * Returns whether the driver thinks that it can open a connection to the - * given URL. - * - * @param url - * the URL to connect to. - * @return {@code true} if the driver thinks that is can open a connection - * to the supplied URL, {@code false} otherwise. Typically, the - * driver will respond {@code true} if it thinks that it can handle - * the subprotocol specified by the driver. - * @throws SQLException - * if a database error occurs. - */ - public boolean acceptsURL(String url) throws SQLException; - - /** - * Attempts to make a database connection to a data source specified by a - * supplied URL. - * - * @param url - * the URL to connect. - * @param info - * some properties that should be used in establishing the - * connection. The properties consist of name/value pairs of - * strings. Normally, a connection to a database requires at - * least two properties - for {@code "user"} and {@code - * "password"} in order to pass authentication to the database. - * @return the connection to the database. - * @throws SQLException - * if a database error occurs. - */ - public Connection connect(String url, Properties info) throws SQLException; - - /** - * Gets the driver's major version number. - * - * @return the major version number of the driver - typically starts at 1. - */ - public int getMajorVersion(); - - /** - * Gets the driver's minor version number. - * - * @return the minor version number of the driver - typically starts at 0. - */ - public int getMinorVersion(); - - /** - * Gets information about possible properties for this driver. - *

- * This method is intended to provide a listing of possible properties that - * the client of the driver must supply in order to establish a connection - * to a database. Note that the returned array of properties may change - * depending on the supplied list of property values. - * - * @param url - * the URL of the database. An application may call this method - * iteratively as the property list is built up - for example, - * when displaying a dialog to an end-user as part of the - * database login process. - * @param info - * a set of tag/value pairs giving data that a user may be - * prompted to provide in order to connect to the database. - * @return an array of {@code DriverPropertyInfo} records which provide - * details on which additional properties are required (in addition - * to those supplied in the {@code info} parameter) in order to - * connect to the database. - * @throws SQLException - * if a database error occurs. - */ - public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) - throws SQLException; - - /** - * Reports whether this driver is a genuine JDBC CompliantTM driver. The - * driver may only return {@code true} if it passes all the JDBC compliance - * tests. - *

- * A driver may not be fully compliant if the underlying database has - * limited functionality. - * - * @return {@code true} if the driver is fully JDBC compliant, {@code false} - * otherwise. - */ - public boolean jdbcCompliant(); - -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/DriverManager.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/DriverManager.java deleted file mode 100644 index e2e944eed1..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/DriverManager.java +++ /dev/null @@ -1,397 +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 java.sql; - -import java.io.PrintStream; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; - -/** - * Provides facilities for managing JDBC drivers. The android.database and - * android.database.sqlite packages offer a higher-performance alternative for new - * code. - * - *

Note that Android does not include any JDBC drivers by default; you must provide your own. - * - *

The {@code DriverManager} class loads JDBC drivers during its initialization, - * from the list of drivers referenced by the system property {@code - * "jdbc.drivers"}. - */ -public class DriverManager { - - /* - * Facilities for logging. The Print Stream is deprecated but is maintained - * here for compatibility. - */ - private static PrintStream thePrintStream; - - private static PrintWriter thePrintWriter; - - // Login timeout value - by default set to 0 -> "wait forever" - private static int loginTimeout = 0; - - /* - * Set to hold Registered Drivers - initial capacity 10 drivers (will expand - * automatically if necessary. - */ - private static final List theDrivers = new ArrayList(10); - - // Permission for setting log - private static final SQLPermission logPermission = new SQLPermission("setLog"); - - /* - * Load drivers on initialization - */ - static { - loadInitialDrivers(); - } - - /* - * Loads the set of JDBC drivers defined by the Property "jdbc.drivers" if - * it is defined. - */ - private static void loadInitialDrivers() { - String theDriverList = System.getProperty("jdbc.drivers", null); - if (theDriverList == null) { - return; - } - - /* - * Get the names of the drivers as an array of Strings from the system - * property by splitting the property at the separator character ':' - */ - String[] theDriverNames = theDriverList.split(":"); - - for (String element : theDriverNames) { - try { - // Load the driver class - Class - .forName(element, true, ClassLoader - .getSystemClassLoader()); - } catch (Throwable t) { - // Ignored - } - } - } - - /* - * A private constructor to prevent allocation - */ - private DriverManager() { - } - - /** - * Removes a driver from the {@code DriverManager}'s registered driver list. - * This will only succeed when the caller's class loader loaded the driver - * that is to be removed. If the driver was loaded by a different class - * loader, the removal of the driver fails silently. - *

- * If the removal succeeds, the {@code DriverManager} will not use this - * driver in the future when asked to get a {@code Connection}. - * - * @param driver - * the JDBC driver to remove. - * @throws SQLException - * if there is a problem interfering with accessing the - * database. - */ - public static void deregisterDriver(Driver driver) throws SQLException { - if (driver == null) { - return; - } - synchronized (theDrivers) { - theDrivers.remove(driver); - } - } - - /** - * Attempts to establish a connection to the given database URL. - * - * @param url - * a URL string representing the database target to connect with. - * @return a {@code Connection} to the database identified by the URL. - * {@code null} if no connection can be established. - * @throws SQLException - * if there is an error while attempting to connect to the - * database identified by the URL. - */ - public static Connection getConnection(String url) throws SQLException { - return getConnection(url, new Properties()); - } - - /** - * Attempts to establish a connection to the given database URL. - * - * @param url - * a URL string representing the database target to connect with - * @param info - * a set of properties to use as arguments to set up the - * connection. Properties are arbitrary string/value pairs. - * Normally, at least the properties {@code "user"} and {@code - * "password"} should be passed, with appropriate settings for - * the user ID and its corresponding password to get access to - * the corresponding database. - * @return a {@code Connection} to the database identified by the URL. - * {@code null} if no connection can be established. - * @throws SQLException - * if there is an error while attempting to connect to the - * database identified by the URL. - */ - public static Connection getConnection(String url, Properties info) throws SQLException { - // 08 - connection exception - // 001 - SQL-client unable to establish SQL-connection - String sqlState = "08001"; - if (url == null) { - throw new SQLException("The url cannot be null", sqlState); - } - synchronized (theDrivers) { - /* - * Loop over the drivers in the DriverSet checking to see if one can - * open a connection to the supplied URL - return the first - * connection which is returned - */ - for (Driver theDriver : theDrivers) { - Connection theConnection = theDriver.connect(url, info); - if (theConnection != null) { - return theConnection; - } - } - } - // If we get here, none of the drivers are able to resolve the URL - throw new SQLException("No suitable driver", sqlState); - } - - /** - * Attempts to establish a connection to the given database URL. - * - * @param url - * a URL string representing the database target to connect with. - * @param user - * a user ID used to login to the database. - * @param password - * a password for the user ID to login to the database. - * @return a {@code Connection} to the database identified by the URL. - * {@code null} if no connection can be established. - * @throws SQLException - * if there is an error while attempting to connect to the - * database identified by the URL. - */ - public static Connection getConnection(String url, String user, String password) - throws SQLException { - Properties theProperties = new Properties(); - if (user != null) { - theProperties.setProperty("user", user); - } - if (password != null) { - theProperties.setProperty("password", password); - } - return getConnection(url, theProperties); - } - - /** - * Tries to find a driver that can interpret the supplied URL. - * - * @param url - * the URL of a database. - * @return a {@code Driver} that matches the provided URL. {@code null} if - * no {@code Driver} understands the URL - * @throws SQLException - * if there is any kind of problem accessing the database. - */ - public static Driver getDriver(String url) throws SQLException { - synchronized (theDrivers) { - /* - * Loop over the drivers in the DriverSet checking to see if one - * does understand the supplied URL - return the first driver which - * does understand the URL - */ - for (Driver driver : theDrivers) { - if (driver.acceptsURL(url)) { - return driver; - } - } - } - // If no drivers understand the URL, throw an SQLException - // SQLState: 08 - connection exception - // 001 - SQL-client unable to establish SQL-connection - throw new SQLException("No suitable driver", "08001"); - } - - /** - * Returns an {@code Enumeration} that contains all of the loaded JDBC - * drivers that the current caller can access. - * - * @return An {@code Enumeration} containing all the currently loaded JDBC - * {@code Drivers}. - */ - public static Enumeration getDrivers() { - /* - * Synchronize to avoid clashes with additions and removals of drivers - * in the DriverSet - */ - synchronized (theDrivers) { - ArrayList result = new ArrayList(); - for (Driver driver : theDrivers) { - result.add(driver); - } - return Collections.enumeration(result); - } - } - - /** - * Returns the login timeout when connecting to a database in seconds. - * - * @return the login timeout in seconds. - */ - public static int getLoginTimeout() { - return loginTimeout; - } - - /** - * Gets the log {@code PrintStream} used by the {@code DriverManager} and - * all the JDBC Drivers. - * - * @deprecated Use {@link #getLogWriter()} instead. - * @return the {@code PrintStream} used for logging activities. - */ - @Deprecated - public static PrintStream getLogStream() { - return thePrintStream; - } - - /** - * Retrieves the log writer. - * - * @return A {@code PrintWriter} object used as the log writer. {@code null} - * if no log writer is set. - */ - public static PrintWriter getLogWriter() { - return thePrintWriter; - } - - /** - * Prints a message to the current JDBC log stream. This is either the - * {@code PrintWriter} or (deprecated) the {@code PrintStream}, if set. - * - * @param message - * the message to print to the JDBC log stream. - */ - public static void println(String message) { - if (thePrintWriter != null) { - thePrintWriter.println(message); - thePrintWriter.flush(); - } else if (thePrintStream != null) { - thePrintStream.println(message); - thePrintStream.flush(); - } - /* - * If neither the PrintWriter not the PrintStream are set, then silently - * do nothing the message is not recorded and no exception is generated. - */ - } - - /** - * Registers a given JDBC driver with the {@code DriverManager}. - *

- * A newly loaded JDBC driver class should register itself with the - * {@code DriverManager} by calling this method. - * - * @param driver - * the {@code Driver} to register with the {@code DriverManager}. - * @throws SQLException - * if a database access error occurs. - */ - public static void registerDriver(Driver driver) throws SQLException { - if (driver == null) { - throw new NullPointerException("driver == null"); - } - synchronized (theDrivers) { - theDrivers.add(driver); - } - } - - /** - * Sets the login timeout when connecting to a database in seconds. - * - * @param seconds - * seconds until timeout. 0 indicates wait forever. - */ - public static void setLoginTimeout(int seconds) { - loginTimeout = seconds; - } - - /** - * Sets the print stream to use for logging data from the {@code - * DriverManager} and the JDBC drivers. - * - * @deprecated Use {@link #setLogWriter} instead. - * @param out - * the {@code PrintStream} to use for logging. - */ - @Deprecated - public static void setLogStream(PrintStream out) { - thePrintStream = out; - } - - /** - * Sets the {@code PrintWriter} that is used by all loaded drivers, and also - * the {@code DriverManager}. - * - * @param out - * the {@code PrintWriter} to be used. - */ - public static void setLogWriter(PrintWriter out) { - thePrintWriter = out; - } - - /** - * Determines whether the supplied object was loaded by the given {@code ClassLoader}. - * - * @param theObject - * the object to check. - * @param theClassLoader - * the {@code ClassLoader}. - * @return {@code true} if the Object does belong to the {@code ClassLoader} - * , {@code false} otherwise - */ - private static boolean isClassFromClassLoader(Object theObject, - ClassLoader theClassLoader) { - - if ((theObject == null) || (theClassLoader == null)) { - return false; - } - - Class objectClass = theObject.getClass(); - - try { - Class checkClass = Class.forName(objectClass.getName(), true, - theClassLoader); - if (checkClass == objectClass) { - return true; - } - } catch (Throwable t) { - // Empty - } - return false; - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/DriverPropertyInfo.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/DriverPropertyInfo.java deleted file mode 100644 index 9a62f073c6..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/DriverPropertyInfo.java +++ /dev/null @@ -1,73 +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 java.sql; - -/** - * A class holding information about driver properties of a database connection. - * This class is returned by the - * {@link Driver#getPropertyInfo(String, java.util.Properties)} method and - * allows for the advanced connection handling. - */ -public class DriverPropertyInfo { - - /** - * If the value member can be chosen from a set of possible values, they are - * contained here. Otherwise choices is {@code null}. - */ - public String[] choices; - - /** - * A description of the property. May be {@code null}. - */ - public String description; - - /** - * The name of the property. - */ - public String name; - - /** - * {@code true} when the value member must be provided during {@code - * Driver.connect}. {@code false} otherwise. - */ - public boolean required; - - /** - * The current value associated with this property. It is depending on the - * data gathered by the {@code getPropertyInfo} method, the general Java - * environment and the driver's default values. - */ - public String value; - - /** - * Creates a {@code DriverPropertyInfo} instance with the supplied name and - * value. Other class members take their default values. - * - * @param name - * The property name. - * @param value - * The property value. - */ - public DriverPropertyInfo(String name, String value) { - this.name = name; - this.value = value; - this.choices = null; - this.description = null; - this.required = false; - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/NClob.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/NClob.java deleted file mode 100644 index a10b50dff8..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/NClob.java +++ /dev/null @@ -1,21 +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 java.sql; - -public interface NClob extends Clob { -} \ No newline at end of file diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/ParameterMetaData.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/ParameterMetaData.java deleted file mode 100644 index 02e89fe12c..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/ParameterMetaData.java +++ /dev/null @@ -1,189 +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 java.sql; - -/** - * An interface used to get information about the types and properties of - * parameters in a {@code PreparedStatement}. - */ -public interface ParameterMetaData extends Wrapper { - - /** - * Indicates that the parameter mode is {@code IN}. - */ - public static final int parameterModeIn = 1; - - /** - * Indicates that the parameter mode is {@code INOUT}. - */ - public static final int parameterModeInOut = 2; - - /** - * Indicates that the parameter mode is {@code OUT}. - */ - public static final int parameterModeOut = 4; - - /** - * Indicates that the parameter mode is not known. - */ - public static final int parameterModeUnknown = 0; - - /** - * Indicates that a parameter is not permitted to be {@code NULL}. - */ - public static final int parameterNoNulls = 0; - - /** - * Indicates that a parameter is permitted to be {@code NULL}. - */ - public static final int parameterNullable = 1; - - /** - * Indicates that whether a parameter is allowed to be {@code null} or not - * is not known. - */ - public static final int parameterNullableUnknown = 2; - - /** - * Gets the fully-qualified name of the Java class which should be passed as - * a parameter to the method {@code PreparedStatement.setObject}. - * - * @param paramIndex - * the index number of the parameter, where the first parameter - * has index 1. - * @return the fully qualified Java class name of the parameter with the - * specified index. This class name is used for custom mapping - * between SQL types and Java objects. - * @throws SQLException - * if a database error happens. - */ - public String getParameterClassName(int paramIndex) throws SQLException; - - /** - * Gets the number of parameters in the {@code PreparedStatement} for which - * this {@code ParameterMetaData} contains information. - * - * @return the number of parameters. - * @throws SQLException - * if a database error happens. - */ - public int getParameterCount() throws SQLException; - - /** - * Gets the mode of the specified parameter. Can be one of: - *

    - *
  • ParameterMetaData.parameterModeIn
  • - *
  • ParameterMetaData.parameterModeOut
  • - *
  • ParameterMetaData.parameterModeInOut
  • - *
  • ParameterMetaData.parameterModeUnknown
  • - *
- * - * @param paramIndex - * the index number of the parameter, where the first parameter - * has index 1. - * @return the parameter's mode. - * @throws SQLException - * if a database error happens. - */ - public int getParameterMode(int paramIndex) throws SQLException; - - /** - * Gets the SQL type of a specified parameter. - * - * @param paramIndex - * the index number of the parameter, where the first parameter - * has index 1. - * @return the SQL type of the parameter as defined in {@code - * java.sql.Types}. - * @throws SQLException - * if a database error happens. - */ - public int getParameterType(int paramIndex) throws SQLException; - - /** - * Gets the database-specific type name of a specified parameter. - * - * @param paramIndex - * the index number of the parameter, where the first parameter - * has index 1. - * @return the type name for the parameter as used by the database. A - * fully-qualified name is returned if the parameter is a User - * Defined Type (UDT). - * @throws SQLException - * if a database error happens. - */ - public String getParameterTypeName(int paramIndex) throws SQLException; - - /** - * Gets the number of decimal digits for a specified parameter. - * - * @param paramIndex - * the index number of the parameter, where the first parameter - * has index 1. - * @return the number of decimal digits ("the precision") for the parameter. - * {@code 0} if the parameter is not a numeric type. - * @throws SQLException - * if a database error happens. - */ - public int getPrecision(int paramIndex) throws SQLException; - - /** - * Gets the number of digits after the decimal point for a specified - * parameter. - * - * @param paramIndex - * the index number of the parameter, where the first parameter - * has index 1. - * @return the number of digits after the decimal point ("the scale") for - * the parameter. {@code 0} if the parameter is not a numeric type. - * @throws SQLException - * if a database error happens. - */ - public int getScale(int paramIndex) throws SQLException; - - /** - * Gets whether {@code null} values are allowed for the specified parameter. - * The returned value is one of: - *
    - *
  • ParameterMetaData.parameterNoNulls
  • - *
  • ParameterMetaData.parameterNullable
  • - *
  • ParameterMetaData.parameterNullableUnknown
  • - *
- * - * @param paramIndex - * the index number of the parameter, where the first parameter - * has index 1. - * @return the int code indicating the nullability of the parameter. - * @throws SQLException - * if a database error is encountered. - */ - public int isNullable(int paramIndex) throws SQLException; - - /** - * Gets whether values for the specified parameter can be signed numbers. - * - * @param paramIndex - * the index number of the parameter, where the first parameter - * has index 1. - * @return {@code true} if values can be signed numbers for this parameter, - * {@code false} otherwise. - * @throws SQLException - * if a database error happens. - */ - public boolean isSigned(int paramIndex) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/PreparedStatement.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/PreparedStatement.java deleted file mode 100644 index 01f375de78..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/PreparedStatement.java +++ /dev/null @@ -1,918 +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 java.sql; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.util.Calendar; - -/** - * An interface for a precompiled SQL Statement. - *

- * An SQL Statement is put into a {@code PreparedStatement} and is precompiled - * so that it can be executed efficiently multiple times. - *

- * Setter methods are supplied in the {@code PreparedStatement} interface for - * the setting of {@code IN} parameters for the statement. The setter method - * used for each {@code IN} parameter must match the parameter's type. - */ -public interface PreparedStatement extends Statement { - - /** - * Add a set of parameters to the {@code PreparedStatement}'s command batch. - * - * @throws SQLException - * if a database error happens. - */ - public void addBatch() throws SQLException; - - /** - * Clear the current parameter values. - *

- * Typically, parameter values are retained for multiple executions of the - * {@code Statement}. Setting a parameter value replaces the previous value. This - * method clears the values for all parameters, releasing all resources used - * by those parameters. - * - * @throws SQLException - * if a database error happens. - */ - public void clearParameters() throws SQLException; - - /** - * Executes the SQL statement in this {@code PreparedStatement}. - *

- * A {@code PreparedStatement} may return multiple results. The execute - * method executes the {@code PreparedStatement} and returns a flag - * indicating the kind of result produced by the action. The methods - * {@code getResultSet} or {@code getUpdateCount} are used to retrieve - * the first result, and the second and subsequent results are - * retrieved with {@code getMoreResults}. - * - * @return {@code true} if the result of the execution is a {@code - * ResultSet}, {@code false} if there is no result or if the result - * is an update count. - * @throws SQLException - * if a database error happens. - */ - public boolean execute() throws SQLException; - - /** - * Executes the SQL query in the {@code PreparedStatement} and returns the - * {@code ResultSet} generated by the query. - * - * @return the {@code ResultSet} generated by the query, never {@code null}. - * @throws SQLException - * if a database error happens or if the SQL statement does not - * produce a {@code ResultSet}. - */ - public ResultSet executeQuery() throws SQLException; - - /** - * Invokes the SQL command contained within the prepared statement. This - * must be {@code INSERT}, {@code UPDATE}, {@code DELETE}, or a command that - * returns nothing. - * - * @return the number of affected rows for {@code INSERT}, {@code UPDATE} or {@code - * DELETE} statements, {@code 0} for statements that return nothing. - * @throws SQLException - * if a database error happens or if the SQL statement returns a - * {@code ResultSet}. - */ - public int executeUpdate() throws SQLException; - - /** - * Returns a {@code ResultSetMetaData} describing the {@code - * ResultSet} that would be produced by execution of the {@code PreparedStatement}. - *

- * It is possible to know the metadata for the {@code ResultSet} without - * executing the {@code PreparedStatement}, because the {@code - * PreparedStatement} is precompiled. As a result the metadata can be - * queried ahead of time without actually executing the statement. - * - * @return a {@code ResultSetMetaData} object with the information about the - * columns of the {@code ResultSet}, if the driver can return a - * {@code ResultSetMetaData}. {@code null} otherwise. - * @throws SQLException - * if there is a database error. - */ - public ResultSetMetaData getMetaData() throws SQLException; - - /** - * Gets information about the parameters of the {@code PreparedStatement}. - * - * @return a {@code ParameterMetaData} object which holds information about - * the number, type, and properties of the parameters of this {@code - * PreparedStatement}. - * @throws SQLException - * if a database error happens. - */ - public ParameterMetaData getParameterMetaData() throws SQLException; - - /** - * Sets the value of a specified parameter to the supplied {@code Array}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theArray - * a {@code java.sql.Array} giving the new value of the parameter at {@code - * parameterIndex}. - * @throws SQLException - * if a database error happens. - * @see Array - */ - public void setArray(int parameterIndex, Array theArray) - throws SQLException; - - /** - * Sets the value of a specified parameter to the content of a supplied - * {@code InputStream}, which has a specified number of bytes. - *

- * This is a good method for setting an SQL {@code LONGVARCHAR} parameter - * where the length of the data is large. Data is read from the {@code - * InputStream} until end-of-file is reached or the specified number of - * bytes is copied. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theInputStream - * the ASCII {@code InputStream} carrying the data to which the - * parameter at {@code parameterIndex} is set. - * @param length - * the number of bytes in the {@code InputStream} to copy to the - * parameter. - * @throws SQLException - * if a database error happens. - */ - public void setAsciiStream(int parameterIndex, InputStream theInputStream, - int length) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.math.BigDecimal} value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theBigDecimal - * the value to which the parameter at {@code parameterIndex} is - * set. - * @throws SQLException - * if a database error happens. - * @see java.math.BigDecimal - */ - public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal) - throws SQLException; - - /** - * Sets the value of a specified parameter to the content of a supplied - * binary {@code InputStream}, which has a specified number of bytes. - *

- * Use this method when a large amount of data needs to be set into a - * {@code LONGVARBINARY} parameter. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theInputStream - * the binary {@code InputStream} carrying the data to update the - * parameter. - * @param length - * the number of bytes in the {@code InputStream} to copy to the - * parameter. - * @throws SQLException - * if a database error happens. - */ - public void setBinaryStream(int parameterIndex, InputStream theInputStream, - int length) throws SQLException; - - /** - * Sets the value of a specified parameter to the given {@code Blob} object. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theBlob - * the {@code java.sql.Blob} to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - * @see Blob - */ - public void setBlob(int parameterIndex, Blob theBlob) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code boolean} - * value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theBoolean - * the boolean value to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setBoolean(int parameterIndex, boolean theBoolean) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code byte} value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theByte - * the byte value to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setByte(int parameterIndex, byte theByte) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied array of bytes. The - * array is mapped to a {@code VARBINARY} or {@code LONGVARBINARY} in the - * database. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theBytes - * the array of bytes to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setBytes(int parameterIndex, byte[] theBytes) - throws SQLException; - - /** - * Sets the value of a specified parameter to the character content of a - * {@code Reader} object, with the specified length of character data. - *

- * Data is read from the {@code - * Reader} until end-of-file is reached or the specified number of - * characters are copied. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1 - * @param reader - * the {@code java.io.Reader} containing the character data. - * @param length - * the number of characters to be read. - * @throws SQLException - * if a database error happens. - */ - public void setCharacterStream(int parameterIndex, Reader reader, int length) - throws SQLException; - - /** - * Sets the value of a specified parameter to the given {@code Clob} object. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theClob - * a {@code java.sql.Clob} holding the data to which the - * parameter at {@code parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setClob(int parameterIndex, Clob theClob) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Date} value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theDate - * a {@code java.sql.Date} to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setDate(int parameterIndex, Date theDate) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Date} value, using a supplied {@code Calendar} to map the Date. - * The {@code Calendar} allows the application to control the timezone used - * to compute the SQL {@code DATE} in the database - without the supplied - * {@code Calendar}, the driver uses the VM defaults. - * See "Be wary of the default locale". - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theDate - * a {@code java.sql.Date} to which the parameter at {@code - * parameterIndex} is set. - * @param cal - * a {@code Calendar} to use to construct the SQL {@code DATE} - * value. - * @throws SQLException - * if a database error happens. - * @see Date - * @see java.util.Calendar - */ - public void setDate(int parameterIndex, Date theDate, Calendar cal) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code double} - * value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theDouble - * the {@code double} value to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setDouble(int parameterIndex, double theDouble) - throws SQLException; - - /** - * Sets the value of a specified parameter to to a supplied {@code float} - * value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theFloat - * the {@code float} value to update the parameter. - * @throws SQLException - * if a database error happens. - */ - public void setFloat(int parameterIndex, float theFloat) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code int} value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theInt - * the {@code int} value to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setInt(int parameterIndex, int theInt) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code long} value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theLong - * the {@code long} value to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setLong(int parameterIndex, long theLong) throws SQLException; - - /** - * Sets the value of a specified parameter to SQL {@code NULL}. Don't use - * this version of {@code setNull} for User Defined Types (UDT) or - * for REF type parameters. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param sqlType - * the SQL type of the parameter, as defined in {@code - * java.sql.Types}. - * @throws SQLException - * if a database error happens. - */ - public void setNull(int parameterIndex, int sqlType) throws SQLException; - - /** - * Sets the value of a specified parameter to SQL {@code NULL}. This version - * of {@code setNull} should be used for User Defined Types (UDTs) - * and also REF types. UDTs can be {@code STRUCT}, {@code DISTINCT}, {@code - * JAVA_OBJECT} and named array types. - *

- * Applications must provide the SQL type code and also a fully qualified - * SQL type name when supplying a {@code NULL} UDT or REF. For a UDT, the - * type name is the type name of the parameter itself, but for a REF - * parameter the type name is the type name of the referenced type. - * - * @param paramIndex - * the parameter number index, where the first parameter has - * index 1. - * @param sqlType - * the SQL type of the parameter, as defined in {@code - * java.sql.Types}. - * @param typeName - * the fully qualified name of a UDT or REF type - ignored if the - * parameter is not a UDT. - * @throws SQLException - * if a database error happens. - * @see Types - */ - public void setNull(int paramIndex, int sqlType, String typeName) - throws SQLException; - - /** - * Sets the value of a specified parameter using a supplied object. - *

- * There is a standard mapping from Java types to SQL types, defined in the - * JDBC specification. The passed object is then transformed into the - * appropriate SQL type, and then transferred to the database. {@code - * setObject} can be used to pass abstract data types unique to the - * database, by using a JDBC driver specific Java type. If the object's - * class implements the interface {@code SQLData}, the JDBC driver calls - * {@code SQLData.writeSQL} to write it to the SQL data stream. If the - * object's class implements {@code Ref}, {@code Blob}, {@code Clob}, - * {@code Struct}, or {@code Array}, the driver passes it to the database as - * a value of the corresponding SQL type. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theObject - * the object containing the value to which the parameter at - * {@code parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setObject(int parameterIndex, Object theObject) - throws SQLException; - - /** - * Sets the value of a specified parameter using a supplied object. - *

- * The object is converted to the given {@code targetSqlType} before it is - * sent to the database. If the object has a custom mapping (its class - * implements the interface {@code SQLData}), the JDBC driver will call the method - * {@code SQLData.writeSQL} to write it to the SQL data stream. If the - * object's class implements {@code Ref}, {@code Blob}, {@code Clob}, - * {@code Struct}, or {@code Array}, the driver will pass it to the database - * in the form of the relevant SQL type. - * - * @param parameterIndex - * the parameter index, where the first parameter has index 1. - * @param theObject - * the Object containing the value to which the parameter at - * {@code parameterIndex} is set. - * @param targetSqlType - * the SQL type to send to the database, as defined in {@code - * java.sql.Types}. - * @throws SQLException - * if a database error happens. - */ - public void setObject(int parameterIndex, Object theObject, - int targetSqlType) throws SQLException; - - /** - * Sets the value of a specified parameter using a supplied object. - *

- * The object is converted to the given {@code targetSqlType} before it is - * sent to the database. If the object has a custom mapping (its class - * implements the interface {@code SQLData}), the JDBC driver will call the method - * {@code SQLData.writeSQL} to write it to the SQL data stream. If the - * object's class implements {@code Ref}, {@code Blob}, {@code Clob}, - * {@code Struct}, or {@code Array}, the driver will pass it to the database - * in the form of the relevant SQL type. - * - * @param parameterIndex - * the parameter index, where the first parameter has index 1. - * @param theObject - * the Object containing the value to which the parameter at - * {@code parameterIndex} is set. - * @param targetSqlType - * the SQL type to send to the database, as defined in {@code - * java.sql.Types}. - * @param scale - * the number of digits after the decimal point - only applies to - * the types {@code java.sql.Types.DECIMAL} and {@code - * java.sql.Types.NUMERIC} - ignored for all other types. - * @throws SQLException - * if a database error happens. - */ - public void setObject(int parameterIndex, Object theObject, - int targetSqlType, int scale) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * REF()} value. This is stored as an SQL {@code REF}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theRef - * a {@code java.sql.Ref} value to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - * @see Ref - */ - public void setRef(int parameterIndex, Ref theRef) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code short} - * value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theShort - * a {@code short} value to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setShort(int parameterIndex, short theShort) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied string. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theString - * the value to which the parameter at {@code parameterIndex} is - * set. - * @throws SQLException - * if a database error happens. - */ - public void setString(int parameterIndex, String theString) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Time} value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theTime - * a {@code java.sql.Time} value to which the parameter at - * {@code parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setTime(int parameterIndex, Time theTime) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Time} value, using a supplied {@code Calendar}. - *

- * The driver uses the supplied {@code Calendar} to create the SQL {@code - * TIME} value, which allows it to use a custom timezone - otherwise the - * driver uses the VM defaults. - * See "Be wary of the default locale". - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theTime - * a {@code java.sql.Time} value to which the parameter at - * {@code parameterIndex} is set. - * @param cal - * a {@code Calendar} to use to construct the SQL {@code TIME} - * value. - * @throws SQLException - * if a database error happens. - * @see Time - * @see java.util.Calendar - */ - public void setTime(int parameterIndex, Time theTime, Calendar cal) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied java.sql.Timestamp - * value. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theTimestamp - * the java.sql.Timestamp value to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - */ - public void setTimestamp(int parameterIndex, Timestamp theTimestamp) - throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.Timestamp} value, using the supplied {@code Calendar}. - *

- * The driver uses the supplied {@code Calendar} to create the SQL {@code - * TIMESTAMP} value, which allows it to use a custom timezone - otherwise - * the driver uses the VM defaults. - * See "Be wary of the default locale". - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theTimestamp - * the {@code java.sql.Timestamp} value to which the parameter at - * {@code parameterIndex} is set. - * @param cal - * a {@code Calendar} to use to construct the SQL {@code - * TIMESTAMP} value - * @throws SQLException - * if a database error happens. - * @see Timestamp - * @see java.util.Calendar - */ - public void setTimestamp(int parameterIndex, Timestamp theTimestamp, - Calendar cal) throws SQLException; - - /** - * Sets the value of a specified parameter to the characters from a supplied - * {@code InputStream}, with a specified number of bytes. - * - * @deprecated Use {@link #setCharacterStream(int, Reader, int)} - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theInputStream - * the {@code InputStream} with the character data to which the - * parameter at {@code parameterIndex} is set. - * @param length - * the number of bytes to read from the {@code InputStream}. - * @throws SQLException - * if a database error happens. - */ - @Deprecated - public void setUnicodeStream(int parameterIndex, - InputStream theInputStream, int length) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.net.URL}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theURL - * the {@code URL} to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException - * if a database error happens. - * @see URL - */ - public void setURL(int parameterIndex, URL theURL) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied {@code - * java.sql.RowId}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theRowId - * the {@code RowId} to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException if a database error happens. - */ - public void setRowId(int parameterIndex, RowId theRowId) throws SQLException; - - /** - * Sets the value of a specified parameter to a supplied string. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param theString - * the {@code String} to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException if a database error happens. - */ - public void setNString(int parameterIndex, String theString) throws SQLException; - - /** - * Sets the value of the specified parameter to the next {@code length} characters - * from {@code reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param reader the {@code Reader} - * @param length character count - * @throws SQLException if a database error happens. - */ - public void setNCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException; - - /** - * Sets the value of the specified parameter to {@code value}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param value - * the {@code NClob} to which the parameter at {@code - * parameterIndex} is set. - * @throws SQLException if a database error happens. - */ - public void setNClob(int parameterIndex, NClob value) throws SQLException; - - /** - * Sets the value of the specified parameter to the next {@code length} characters - * from {@code reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param reader the {@code Reader} - * @param length character count - * @throws SQLException if a database error happens. - */ - public void setClob(int parameterIndex, Reader reader, long length) throws SQLException; - - /** - * Sets the value of the specified parameter to the next {@code length} bytes - * from {@code inputStream}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param inputStream the {@code InputStream} - * @param length character count - * @throws SQLException if a database error happens. - */ - public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException; - - /** - * Sets the value of the specified parameter to the next {@code length} characters - * from {@code reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param reader the {@code Reader} - * @param length character count - * @throws SQLException if a database error happens. - */ - public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException; - - /** - * Sets the value of the specified parameter to the value of {@code xmlObject}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param xmlObject the {@code SQLXML} - * @throws SQLException if a database error happens. - */ - public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException; - - /** - * Sets the value of the specified parameter to the next {@code length} bytes - * from {@code inputStream}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param inputStream the {@code InputStream} - * @param length character count - * @throws SQLException if a database error happens. - */ - public void setAsciiStream(int parameterIndex, InputStream inputStream, long length) throws SQLException; - - /** - * Sets the value of the specified parameter to the next {@code length} bytes - * from {@code inputStream}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param inputStream the {@code InputStream} - * @param length character count - * @throws SQLException if a database error happens. - */ - public void setBinaryStream(int parameterIndex, InputStream inputStream, long length) throws SQLException; - - /** - * Sets the value of the specified parameter to the next {@code length} characters - * from {@code reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param reader the {@code Reader} - * @param length character count - * @throws SQLException if a database error happens. - */ - public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException; - - /** - * Sets the value of the specified parameter to the bytes - * from {@code inputStream}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param inputStream the {@code InputStream} - * @throws SQLException if a database error happens. - */ - public void setAsciiStream(int parameterIndex, InputStream inputStream) throws SQLException; - - /** - * Sets the value of the specified parameter to the bytes - * from {@code inputStream}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param inputStream the {@code InputStream} - * @throws SQLException if a database error happens. - */ - public void setBinaryStream(int parameterIndex, InputStream inputStream) throws SQLException; - - /** - * Sets the value of the specified parameter to the characters - * from {@code reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param reader the {@code Reader} - * @throws SQLException if a database error happens. - */ - public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException; - - /** - * Sets the value of the specified parameter to the characters - * from {@code reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param reader the {@code Reader} - * @throws SQLException if a database error happens. - */ - public void setNCharacterStream(int parameterIndex, Reader reader) throws SQLException; - - /** - * Sets the value of the specified parameter to the characters - * from {@code reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param reader the {@code Reader} - * @throws SQLException if a database error happens. - */ - public void setClob(int parameterIndex, Reader reader) throws SQLException; - - /** - * Sets the value of the specified parameter to the bytes - * from {@code inputStream}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param inputStream the {@code InputStream} - * @throws SQLException if a database error happens. - */ - public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException; - - /** - * Sets the value of the specified parameter to the characters - * from {@code reader}. - * - * @param parameterIndex - * the parameter number index, where the first parameter has - * index 1. - * @param reader the {@code Reader} - * @throws SQLException if a database error happens. - */ - public void setNClob(int parameterIndex, Reader reader) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Ref.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Ref.java deleted file mode 100644 index ca4ab8b37b..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Ref.java +++ /dev/null @@ -1,82 +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 java.sql; - -import java.util.Map; - -/** - * This interface represents an SQL Ref - a data object containing a cursor - * or pointer to a result table. - *

- * The data structure identified by an instance of Ref is held in the - * database, so the data is not necessarily read and converted - * into a Java object until {@code getObject} is called. However, if - * the database supports the {@code Ref} type, it is not typically - * necessary to get the underlying object before using it in a method call - - * the {@code Ref} object can be used in place of the data structure. - *

- * A {@code Ref} object is stored into the database using the - * {@link PreparedStatement#setRef(int, Ref)} method. - */ -public interface Ref { - - /** - * Gets the fully-qualified SQL name of the SQL structured type that this - * {@code Ref} references. - * - * @return the fully qualified name of the SQL structured type. - * @throws SQLException - * if there is a database error. - */ - public String getBaseTypeName() throws SQLException; - - /** - * Gets the SQL structured type instance referenced by this {@code Ref}. - * - * @return a Java object whose type is defined by the mapping for the SQL - * structured type. - * @throws SQLException - * if there is a database error. - */ - public Object getObject() throws SQLException; - - /** - * Returns the associated object and uses the relevant mapping to convert it - * to a Java type. - * - * @param map - * the mapping for type conversion. - * @return a Java object whose type is defined by the mapping for the SQL - * structured type. - * @throws SQLException - * if there is a database error. - */ - public Object getObject(Map> map) throws SQLException; - - /** - * Sets the value of the structured type that this {@code Ref} references to - * a supplied object. - * - * @param value - * the {@code Object} representing the new SQL structured type - * that this {@code Ref} references. - * @throws SQLException - * if there is a database error. - */ - public void setObject(Object value) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/ResultSet.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/ResultSet.java deleted file mode 100644 index 12b681aa73..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/ResultSet.java +++ /dev/null @@ -1,2269 +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 java.sql; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.util.Calendar; -import java.util.Map; - -/** - * An interface for an object which represents a database table entry, returned - * as the result of the query to the database. - *

- * {@code ResultSet}s have a cursor which points to the current data table row. - * When the {@code ResultSet} is created, the cursor's location is one position - * ahead of the first row. To move the cursor to the first and consecutive rows, - * use the {@code next} method. The {@code next} method returns {@code true} as - * long as there are more rows in the {@code ResultSet}, otherwise it returns - * {@code false}. - *

- * The default type of {@code ResultSet} can not be updated and its cursor can - * only advance forward through the rows of data. This means that it is only - * possible to read through it once. However, other kinds of {@code ResultSet} - * are implemented: an updatable type and also types where the cursor can - * be scrolled forward and backward through the rows of data. How such a - * {@code ResultSet} is created is demonstrated in the following example: - *

    - *
    - * {@code Connection con;}
    - *
    {@code Statement aStatement = con.createStatement( - * ResultSet.TYPE_SCROLL_SENSITIVE,}{@code ResultSet.CONCUR_UPDATABLE );}
    - *
    {@code ResultSet theResultSet = - * theStatement.executeQuery("SELECT price, quantity FROM STOCKTABLE");}
    - *
    {@code // theResultSet is both scrollable and updatable}
- *

- * The {@code ResultSet} interface provides a series of methods for retrieving - * data from columns in the current row, such as {@code getDate} and {@code - * getFloat}. The columns are retrieved either by their index number (starting - * at 1) or by their name - there are separate methods for both techniques of - * column addressing. The column names are case insensitive. If several columns - * have the same name, then the getter methods use the first matching column. - * This means that if column names are used, it is not possible to guarantee - * that the name will retrieve data from the intended column - for certainty it - * is better to use column indexes. Ideally the columns should be read - * left-to-right and read once only, since not all databases are optimized to - * handle other techniques of reading the data. - *

- * When reading data via the appropriate getter methods, the JDBC driver maps - * the SQL data retrieved from the database to the Java type implied by the - * method invoked by the application. The JDBC specification has a table for the - * mappings from SQL types to Java types. - *

- * There are also methods for writing data into the {@code ResultSet}, such as - * {@code updateInt} and {@code updateString}. The update methods can be used - * either to modify the data of an existing row or to insert new data rows into - * the {@code ResultSet} . Modification of existing data involves moving the - * cursor to the row which needs modification and then using the update methods - * to modify the data, followed by calling the {@code ResultSet.updateRow} - * method. For insertion of new rows, the cursor is first moved to a special row - * called the Insert Row, data is added using the update methods, - * followed by calling the {@code ResultSet.insertRow} method. - *

- * A {@code ResultSet} is closed if the statement which generated it closes, the - * statement is executed again, or the same statement's next {@code ResultSet} - * is retrieved (if the statement returned of multiple results). - */ -public interface ResultSet extends Wrapper, AutoCloseable { - - /** - * A constant used to indicate that a {@code ResultSet} object must be - * closed when the method {@code Connection.commit} is invoked. - */ - public static final int CLOSE_CURSORS_AT_COMMIT = 2; - - /** - * A constant used to indicate that a {@code ResultSet} object must not be - * closed when the method {@code Connection.commit} is invoked. - */ - public static final int HOLD_CURSORS_OVER_COMMIT = 1; - - /** - * A constant used to indicate the concurrency mode for a {@code ResultSet} - * object that cannot be updated. - */ - public static final int CONCUR_READ_ONLY = 1007; - - /** - * A constant used to indicate the concurrency mode for a {@code ResultSet} - * object that can be updated. - */ - public static final int CONCUR_UPDATABLE = 1008; - - /** - * A constant used to indicate processing of the rows of a {@code ResultSet} - * in the forward direction, first to last. - */ - public static final int FETCH_FORWARD = 1000; - - /** - * A constant used to indicate processing of the rows of a {@code ResultSet} - * in the reverse direction, last to first. - */ - public static final int FETCH_REVERSE = 1001; - - /** - * A constant used to indicate that the order of processing of the rows of a - * {@code ResultSet} is unknown. - */ - public static final int FETCH_UNKNOWN = 1002; - - /** - * A constant used to indicate a {@code ResultSet} object whose cursor can - * only move forward. - */ - public static final int TYPE_FORWARD_ONLY = 1003; - - /** - * A constant used to indicate a {@code ResultSet} object which is - * scrollable but is insensitive to changes made by others. - */ - public static final int TYPE_SCROLL_INSENSITIVE = 1004; - - /** - * A constant used to indicate a {@code ResultSet} object which is - * scrollable and sensitive to changes made by others. - */ - public static final int TYPE_SCROLL_SENSITIVE = 1005; - - /** - * Moves the cursor to a specified row number in the {@code ResultSet}. - * - * @param row - * the index of the row starting at index 1. Index {@code -1} - * returns the last row. - * @return {@code true} if the new cursor position is on the {@code - * ResultSet}, {@code false} otherwise. - * @throws SQLException - * if a database error happens. - */ - public boolean absolute(int row) throws SQLException; - - /** - * Moves the cursor to the end of the {@code ResultSet}, after the last row. - * - * @throws SQLException - * if a database error happens. - */ - public void afterLast() throws SQLException; - - /** - * Moves the cursor to the start of the {@code ResultSet}, before the first - * row. - * - * @throws SQLException - * if a database error happens. - */ - public void beforeFirst() throws SQLException; - - /** - * Cancels any updates made to the current row in the {@code ResultSet}. - * - * @throws SQLException - * if a database error happens. - */ - public void cancelRowUpdates() throws SQLException; - - /** - * Clears all warnings related to this {@code ResultSet}. - * - * @throws SQLException - * if a database error happens. - */ - public void clearWarnings() throws SQLException; - - /** - * Releases this {@code ResultSet}'s database and JDBC resources. You are - * strongly advised to use this method rather than relying on the release - * being done when the {@code ResultSet}'s finalize method is called during - * garbage collection process. Note that the {@code close()} method might - * take some time to complete since it is dependent on the behavior of the - * connection to the database and the database itself. - * - * @throws SQLException - * if a database error happens. - */ - public void close() throws SQLException; - - /** - * Deletes the current row from the {@code ResultSet} and from the - * underlying database. - * - * @throws SQLException - * if a database error happens. - */ - public void deleteRow() throws SQLException; - - /** - * Gets the index number for a column in the {@code ResultSet} from the - * provided column name. - * - * @param columnName - * the column name. - * @return the column's index in the {@code ResultSet} identified by column - * name. - * @throws SQLException - * if a database error happens. - */ - public int findColumn(String columnName) throws SQLException; - - /** - * Shifts the cursor position to the first row in the {@code ResultSet}. - * - * @return {@code true} if the position is in a legitimate row, {@code - * false} if the {@code ResultSet} contains no rows. - * @throws SQLException - * if a database error happens. - */ - public boolean first() throws SQLException; - - /** - * Gets the content of a column specified by column index in the current row - * of this {@code ResultSet} as a {@code java.sql.Array}. - * - * @param columnIndex - * the index of the column to read - * @return a {@code java.sql.Array} with the data from the column. - * @throws SQLException - * if a database error happens. - */ - public Array getArray(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a {@code - * java.sql.Array}. - * - * @param colName - * the name of the column to read. - * @return a {@code java.sql.Array} with the data from the specified column. - * @throws SQLException - * if a database error happens. - */ - public Array getArray(String colName) throws SQLException; - - /** - * Gets the value of a column specified by column index as an ASCII - * character stream. - * - * @param columnIndex - * the index of the column to read. - * @return an {@code InputStream} with the data from the column. - * @throws SQLException - * if a database error happens. - */ - public InputStream getAsciiStream(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as an ASCII character - * stream. - * - * @param columnName - * the name of the column to read - * @return an {@code InputStream} with the data from the column. - * @throws SQLException - * if a database error happens. - */ - public InputStream getAsciiStream(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.math.BigDecimal}. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code BigDecimal} with the value of the column. - * @throws SQLException - * if a database error happens. - */ - public BigDecimal getBigDecimal(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.math.BigDecimal}. - * - * @deprecated Use {@link #getBigDecimal(int)} or {@link #getBigDecimal(String)} instead. - * @param columnIndex - * the index of the column to read. - * @param scale - * the number of digits after the decimal point - * @return a {@code BigDecimal} with the value of the column. - * @throws SQLException - * if a database error happens. - */ - @Deprecated - public BigDecimal getBigDecimal(int columnIndex, int scale) - throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code - * java.math.BigDecimal}. - * - * @param columnName - * the name of the column to read. - * @return a BigDecimal with value of the column. - * @throws SQLException - * if a database error happens. - */ - public BigDecimal getBigDecimal(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code - * java.math.BigDecimal}. - * - * @deprecated Use {@link #getBigDecimal(int)} or {@link #getBigDecimal(String)} instead. - * @param columnName - * the name of the column to read. - * @param scale - * the number of digits after the decimal point - * @return a BigDecimal with value of the column. - * @throws SQLException - * if a database error happens. - */ - @Deprecated - public BigDecimal getBigDecimal(String columnName, int scale) - throws SQLException; - - /** - * Gets the value of a column specified by column index as a binary - * stream. - *

- * This method can be used to read {@code LONGVARBINARY} values. All of the - * data in the {@code InputStream} should be read before getting data from - * any other column. A further call to a getter method will implicitly close - * the {@code InputStream}. - * - * @param columnIndex - * the index of the column to read. - * @return an {@code InputStream} with the data from the column. If the - * column value is SQL {@code NULL}, {@code null} is returned. - * @throws SQLException - * if a database error happens. - */ - public InputStream getBinaryStream(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a binary stream. - *

- * This method can be used to read {@code LONGVARBINARY} values. All of the - * data in the {@code InputStream} should be read before getting data from - * any other column. A further call to a getter method will implicitly close - * the {@code InputStream}. - * - * @param columnName - * the name of the column to read. - * @return an {@code InputStream} with the data from the column if the - * column value is SQL {@code NULL}, {@code null} is returned. - * @throws SQLException - * if a database error happens. - */ - public InputStream getBinaryStream(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.sql.Blob} object. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code java.sql.Blob} with the value of the column. - * @throws SQLException - * if a database error happens. - */ - public Blob getBlob(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code - * java.sql.Blob} object. - * - * @param columnName - * the name of the column to read. - * @return a {@code java.sql.Blob} with the value of the column. - * @throws SQLException - * if a database error happens. - */ - public Blob getBlob(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code boolean} - * . - * - * @param columnIndex - * the index of the column to read. - * @return a {@code boolean} value from the column. If the column is SQL - * {@code NULL}, {@code false} is returned. - * @throws SQLException - * if a database error happens. - */ - public boolean getBoolean(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code boolean} - * . - * - * @param columnName - * the name of the column to read. - * @return a {@code boolean} value from the column. If the column is SQL - * {@code NULL}, {@code false} is returned. - * @throws SQLException - * if a database error happens. - */ - public boolean getBoolean(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code byte}. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code byte} equal to the value of the column. 0 if the value - * is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public byte getByte(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a {@code byte}. - * - * @param columnName - * the name of the column to read. - * @return a {@code byte} equal to the value of the column. 0 if the value - * is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public byte getByte(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a byte array. - * - * @param columnIndex - * the index of the column to read. - * @return a byte array containing the value of the column. {@code null} if - * the column contains SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public byte[] getBytes(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a byte array. - * - * @param columnName - * the name of the column to read. - * @return a byte array containing the value of the column. {@code null} if - * the column contains SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public byte[] getBytes(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.io.Reader} object. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code Reader} holding the value of the column. {@code null} if - * the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - * @see java.io.Reader - */ - public Reader getCharacterStream(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a {@code - * java.io.Reader} object. - * - * @param columnName - * the name of the column to read. - * @return a {@code Reader} holding the value of the column. {@code null} if - * the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Reader getCharacterStream(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.sql.Clob}. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code Clob} object representing the value in the column. - * {@code null} if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Clob getClob(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a {@code - * java.sql.Clob}. - * - * @param colName - * the name of the column to read. - * @return a {@code Clob} object representing the value in the column. - * {@code null} if the value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Clob getClob(String colName) throws SQLException; - - /** - * Gets the concurrency mode of this {@code ResultSet}. - * - * @return the concurrency mode - one of: {@code ResultSet.CONCUR_READ_ONLY} - * , {@code ResultSet.CONCUR_UPDATABLE}. - * @throws SQLException - * if a database error happens. - */ - public int getConcurrency() throws SQLException; - - /** - * Gets the name of the SQL cursor of this {@code ResultSet}. - * - * @return the SQL cursor name. - * @throws SQLException - * if a database error happens. - */ - public String getCursorName() throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.sql.Date}. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code java.sql.Date} matching the column value. {@code null} - * if the column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Date getDate(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.sql.Date}. This method uses a supplied calendar to compute the Date. - * - * @param columnIndex - * the index of the column to read. - * @param cal - * a {@code java.util.Calendar} to use in constructing the Date. - * @return a {@code java.sql.Date} matching the column value. {@code null} - * if the column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Date getDate(int columnIndex, Calendar cal) throws SQLException; - - /** - * Gets the value of a column specified by column name as a {@code - * java.sql.Date}. - * - * @param columnName - * the name of the column to read. - * @return a {@code java.sql.Date} matching the column value. {@code null} - * if the column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Date getDate(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code - * java.sql.Date} object. - * - * @param columnName - * the name of the column to read. - * @param cal - * {@code java.util.Calendar} to use in constructing the Date. - * @return a {@code java.sql.Date} matching the column value. {@code null} - * if the column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Date getDate(String columnName, Calendar cal) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code double} - * value. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code double} equal to the column value. {@code 0.0} if the - * column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public double getDouble(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a {@code double} - * value. - * - * @param columnName - * the name of the column to read. - * @return a {@code double} equal to the column value. {@code 0.0} if the - * column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public double getDouble(String columnName) throws SQLException; - - /** - * Gets the direction in which rows are fetched for this {@code ResultSet} - * object. - * - * @return the fetch direction. Will be one of: - *

    - *
  • ResultSet.FETCH_FORWARD
  • ResultSet.FETCH_REVERSE
  • - *
  • ResultSet.FETCH_UNKNOWN
  • - *
- * @throws SQLException - * if a database error happens. - */ - public int getFetchDirection() throws SQLException; - - /** - * Gets the fetch size (in number of rows) for this {@code ResultSet}. - * - * @return the fetch size as an int - * @throws SQLException - * if a database error happens. - */ - public int getFetchSize() throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code float} - * value. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code float} equal to the column value. {@code 0.0} if the - * column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public float getFloat(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a {@code float} - * value. - * - * @param columnName - * the name of the column to read. - * @return a {@code float} equal to the column value. {@code 0.0} if the - * column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public float getFloat(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as an {@code int} - * value. - * - * @param columnIndex - * the index of the column to read. - * @return an {@code int} equal to the column value. {@code 0} if the - * column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public int getInt(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name, as an {@code int} - * value. - * - * @param columnName - * the name of the column to read. - * @return an {@code int} equal to the column value. {@code 0} if the - * column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public int getInt(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code long} - * value. - * - * @param columnIndex - * the index of the column to read. - * @return a {@code long} equal to the column value. {@code 0} if the - * column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public long getLong(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code long} - * value. - * - * @param columnName - * the name of the column to read. - * @return a {@code long} equal to the column value. {@code 0} if the - * column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public long getLong(String columnName) throws SQLException; - - /** - * Gets the metadata for this {@code ResultSet}. This defines the number, - * types and properties of the columns in the {@code ResultSet}. - * - * @return a {@code ResultSetMetaData} object with information about this - * {@code ResultSet}. - * @throws SQLException - * if a database error happens. - */ - public ResultSetMetaData getMetaData() throws SQLException; - - /** - * Gets the value of a specified column as a Java {@code Object}. The type - * of the returned object will be the default according to the column's SQL - * type, following the JDBC specification for built-in types. - *

- * For SQL User Defined Types, if a column value is Structured or Distinct, - * this method behaves the same as a call to: {@code - * getObject(columnIndex,this.getStatement().getConnection().getTypeMap())} - * - * @param columnIndex - * the index of the column to read. - * @return an {@code Object} containing the value of the column. {@code - * null} if the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Object getObject(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column index as a Java {@code - * Object}. - *

- * The type of the Java object will be determined by the supplied Map to - * perform the mapping of SQL {@code Struct} or Distinct types into Java - * objects. - * - * @param columnIndex - * the index of the column to read. - * @param map - * a {@code java.util.Map} containing a mapping from SQL Type - * names to Java classes. - * @return an {@code Object} containing the value of the column. {@code - * null} if the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Object getObject(int columnIndex, Map> map) - throws SQLException; - - /** - * Gets the value of a specified column as a Java {@code Object}. The type - * of the returned object will be the default according to the column's SQL - * type, following the JDBC specification for built-in types. - *

- * For SQL User Defined Types, if a column value is structured or distinct, - * this method behaves the same as a call to: {@code - * getObject(columnIndex,this.getStatement().getConnection().getTypeMap())} - * - * @param columnName - * the name of the column to read. - * @return an {@code Object} containing the value of the column. {@code - * null} if the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Object getObject(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column name as a Java {@code - * Object}. - *

- * The type of the Java object will be determined by the supplied Map to - * perform the mapping of SQL Struct or Distinct types into Java objects. - * - * @param columnName - * the name of the column to read. - * @param map - * a {@code java.util.Map} containing a mapping from SQL Type names to - * Java classes. - * @return an {@code Object} containing the value of the column. {@code - * null} if the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Object getObject(String columnName, Map> map) - throws SQLException; - - /** - * Gets the value of a column specified by column index as a Java {@code - * java.sql.Ref}. - * - * @param columnIndex - * the index of the column to read. - * @return a Ref representing the value of the SQL REF in the column - * @throws SQLException - * if a database error happens. - */ - public Ref getRef(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a Java {@code - * java.sql.Ref}. - * - * @param colName - * the name of the column to read. - * @return a Ref representing the value of the SQL {@code REF} in the column - * @throws SQLException - * if a database error happens. - */ - public Ref getRef(String colName) throws SQLException; - - /** - * Gets the number of the current row in the {@code ResultSet}. Row numbers - * start at 1 for the first row. - * - * @return the index number of the current row. {@code 0} is returned if - * there is no current row. - * @throws SQLException - * if a database error happens. - */ - public int getRow() throws SQLException; - - /** - * Gets the value of a column specified by column index as a short value. - * - * @param columnIndex - * the index of the column to read. - * @return a short value equal to the value of the column. {@code 0} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public short getShort(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a short value. - * - * @param columnName - * the name of the column to read. - * @return a short value equal to the value of the column. {@code 0} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public short getShort(String columnName) throws SQLException; - - /** - * Gets the statement that produced this {@code ResultSet}. If the {@code - * ResultSet} was not created by a statement (i.e. because it was returned - * from one of the {@link DatabaseMetaData} methods), {@code null} is - * returned. - * - * @return the Statement which produced this {@code ResultSet}, or {@code - * null} if the {@code ResultSet} was not created by a Statement. - * @throws SQLException - * if a database error happens. - */ - public Statement getStatement() throws SQLException; - - /** - * Gets the value of a column specified by column index as a String. - * - * @param columnIndex - * the index of the column to read. - * @return the String representing the value of the column, {@code null} if - * the column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public String getString(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a String. - * - * @param columnName - * the name of the column to read. - * @return the String representing the value of the column, {@code null} if - * the column is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public String getString(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.sql.Time} value. - * - * @param columnIndex - * the index of the column to read. - * @return a Time representing the column value, {@code null} if the column - * value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Time getTime(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.sql.Time} value. The supplied {@code Calendar} is used to - * map the SQL {@code Time} value to a Java Time value. - * - * @param columnIndex - * the index of the column to read. - * @param cal - * a {@code Calendar} to use in creating the Java Time value. - * @return a Time representing the column value, {@code null} if the column - * value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Time getTime(int columnIndex, Calendar cal) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code - * java.sql.Time} value. - * - * @param columnName - * the name of the column to read. - * @return the column value, {@code null} if the column value is SQL {@code - * NULL}. - * @throws SQLException - * if a database error happens. - */ - public Time getTime(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index, as a {@code - * java.sql.Time} value. The supplied {@code Calendar} is used to - * map the SQL {@code Time} value to a Java Time value. - * - * @param columnName - * the name of the column to read. - * @param cal - * a {@code Calendar} to use in creating the Java time value. - * @return a Time representing the column value, {@code null} if the column - * value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Time getTime(String columnName, Calendar cal) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.sql.Timestamp} value. - * - * @param columnIndex - * the index of the column to read. - * @return a timestamp representing the column value, {@code null} if the - * column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Timestamp getTimestamp(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column index, as a {@code - * java.sql.Timestamp} value. The supplied Calendar is used when mapping - * the SQL {@code Timestamp} value to a Java {@code Timestamp} value. - * - * @param columnIndex - * the index of the column to read. - * @param cal - * Calendar to use in creating the Java timestamp value. - * @return a timestamp representing the column value, {@code null} if the - * column value is SQL NULL. - * @throws SQLException - * if a database error happens. - */ - public Timestamp getTimestamp(int columnIndex, Calendar cal) - throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code - * java.sql.Timestamp} value. - * - * @param columnName - * the name of the column to read. - * @return a timestamp representing the column value, {@code null} if the - * column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Timestamp getTimestamp(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column name, as a {@code - * java.sql.Timestamp} value. The supplied Calendar is used when mapping - * the SQL {@code Timestamp} value to a Java {@code Timestamp} value. - * - * @param columnName - * the name of the column to read. - * @param cal - * Calendar to use in creating the Java {@code Timestamp} value. - * @return a timestamp representing the column value, {@code null} if the - * column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public Timestamp getTimestamp(String columnName, Calendar cal) - throws SQLException; - - /** - * Gets the type of the {@code ResultSet}. - * - * @return The {@code ResultSet} type, one of: - *

    - *
  • {@code ResultSet.TYPE_FORWARD_ONLY}
  • {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE}
  • {@code - * ResultSet.TYPE_SCROLL_SENSITIVE}
  • - *
- * @throws SQLException - * if there is a database error. - */ - public int getType() throws SQLException; - - /** - * Gets the value of the column as an {@code InputStream} of unicode - * characters. - * - * @deprecated Use {@link #getCharacterStream} instead. - * @param columnIndex - * the index of the column to read. - * @return an {@code InputStream} holding the value of the column. {@code - * null} if the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - @Deprecated - public InputStream getUnicodeStream(int columnIndex) throws SQLException; - - /** - * Gets the value of the column as an {@code InputStream} of Unicode - * characters. - * - * @deprecated Use {@link #getCharacterStream} instead. - * @param columnName - * the name of the column to read. - * @return an {@code InputStream} holding the value of the column. {@code - * null} if the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - @Deprecated - public InputStream getUnicodeStream(String columnName) throws SQLException; - - /** - * Gets the value of a column specified by column index as a {@code - * java.net.URL}. - * - * @param columnIndex - * the index of the column to read. - * @return a URL. {@code null} if the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public URL getURL(int columnIndex) throws SQLException; - - /** - * Gets the value of a column specified by column name as a {@code - * java.net.URL} object. - * - * @param columnName - * the name of the column to read. - * @return the column vaule as a URL. {@code null} if the column value is SQL {@code NULL}. - * @throws SQLException - * if a database error happens. - */ - public URL getURL(String columnName) throws SQLException; - - /** - * Gets the first warning generated by calls on this {@code ResultSet}. - * Subsequent warnings on this {@code ResultSet} are chained to the first - * one. - *

- * The warnings are cleared when a new Row is read from the {@code - * ResultSet}. The warnings returned by this method are only the warnings - * generated by {@code ResultSet} method calls - warnings generated by - * Statement methods are held by the Statement. - *

- * An {@code SQLException} is generated if this method is called on a closed - * {@code ResultSet}. - * - * @return an SQLWarning which is the first warning for this {@code - * ResultSet}. {@code null} if there are no warnings. - * @throws SQLException - * if a database error happens. - */ - public SQLWarning getWarnings() throws SQLException; - - /** - * Insert the insert row into the {@code ResultSet} and into the underlying - * database. The cursor must be set to the Insert Row before this method is - * invoked. - * - * @throws SQLException - * if a database error happens. Particular cases include the - * cursor not being on the Insert Row or if any columns in the - * row do not have a value where the column is declared as - * not-nullable. - */ - public void insertRow() throws SQLException; - - /** - * Gets if the cursor is after the last row of the {@code ResultSet}. - * - * @return {@code true} if the cursor is after the last row in the {@code - * ResultSet}, {@code false} if the cursor is at any other position - * in the {@code ResultSet}. - * @throws SQLException - * if a database error happens. - */ - public boolean isAfterLast() throws SQLException; - - /** - * Gets if the cursor is before the first row of the {@code ResultSet}. - * - * @return {@code true} if the cursor is before the first row in the {@code - * ResultSet}, {@code false} if the cursor is at any other position - * in the {@code ResultSet}. - * @throws SQLException - * if a database error happens. - */ - public boolean isBeforeFirst() throws SQLException; - - /** - * Gets if the cursor is on the first row of the {@code ResultSet}. - * - * @return {@code true} if the cursor is on the first row in the {@code - * ResultSet}, {@code false} if the cursor is at any other position - * in the {@code ResultSet}. - * @throws SQLException - * if a database error happens. - */ - public boolean isFirst() throws SQLException; - - /** - * Gets if the cursor is on the last row of the {@code ResultSet} - * - * @return {@code true} if the cursor is on the last row in the {@code - * ResultSet}, {@code false} if the cursor is at any other position - * in the {@code ResultSet}. - * @throws SQLException - * if a database error happens. - */ - public boolean isLast() throws SQLException; - - /** - * Shifts the cursor position to the last row of the {@code ResultSet}. - * - * @return {@code true} if the new position is in a legitimate row, {@code - * false} if the {@code ResultSet} contains no rows. - * @throws SQLException - * if there is a database error. - */ - public boolean last() throws SQLException; - - /** - * Moves the cursor to the remembered position, namely the - * row that was the current row before a call to {@code moveToInsertRow}. - * This only applies if the cursor is on the Insert Row. - * - * @throws SQLException - * if a database error happens. - */ - public void moveToCurrentRow() throws SQLException; - - /** - * Moves the cursor position to the Insert Row. The current position is - * remembered and the cursor is positioned at the Insert Row. The columns in - * the Insert Row should be filled in with the appropriate update methods, - * before calling {@code insertRow} to insert the new row into the database. - * - * @throws SQLException - * if a database error happens. - */ - public void moveToInsertRow() throws SQLException; - - /** - * Shifts the cursor position down one row in this {@code ResultSet} object. - *

- * Any input streams associated with the current row are closed and any - * warnings are cleared. - * - * @return {@code true} if the updated cursor position is pointing to a - * valid row, {@code false} otherwise (i.e. when the cursor is after - * the last row in the {@code ResultSet}). - * @throws SQLException - * if a database error happens. - */ - public boolean next() throws SQLException; - - /** - * Relocates the cursor position to the preceding row in this {@code - * ResultSet}. - * - * @return {@code true} if the new position is in a legitimate row, {@code - * false} if the cursor is now before the first row. - * @throws SQLException - * if a database error happens. - */ - public boolean previous() throws SQLException; - - /** - * Refreshes the current row with its most up to date value in the database. - * Must not be called when the cursor is on the Insert Row. - *

- * If any columns in the current row have been updated but the {@code - * updateRow} has not been called, then the updates are lost when this - * method is called. - * - * @throws SQLException - * if a database error happens., including if the current row is - * the Insert row. - */ - public void refreshRow() throws SQLException; - - /** - * Moves the cursor position up or down by a specified number of rows. If - * the new position is beyond the start row (or end row), the cursor position is - * set before the first row (or, respectively, after the last row). - * - * @param rows - * a number of rows to move the cursor - may be positive or - * negative - * @return {@code true} if the new cursor position is on a row, {@code - * false} otherwise - * @throws SQLException - * if a database error happens. - */ - public boolean relative(int rows) throws SQLException; - - /** - * Indicates whether a row has been deleted. This method depends on whether - * the JDBC driver and database can detect deletions. - * - * @return {@code true} if a row has been deleted and if deletions are - * detected, {@code false} otherwise. - * @throws SQLException - * if a database error happens. - */ - public boolean rowDeleted() throws SQLException; - - /** - * Indicates whether the current row has had an insertion operation. This - * method depends on whether the JDBC driver and database can detect - * insertions. - * - * @return {@code true} if a row has been inserted and if insertions are - * detected, {@code false} otherwise. - * @throws SQLException - * if a database error happens. - */ - public boolean rowInserted() throws SQLException; - - /** - * Indicates whether the current row has been updated. This method depends - * on whether the JDBC driver and database can detect updates. - * - * @return {@code true} if the current row has been updated and if updates - * can be detected, {@code false} otherwise. - * @throws SQLException - * if a database error happens. - */ - public boolean rowUpdated() throws SQLException; - - /** - * Indicates which direction (forward/reverse) will be used to process the - * rows of this {@code ResultSet} object. This is treated as a hint by the - * JDBC driver. - * - * @param direction - * can be {@code ResultSet.FETCH_FORWARD}, {@code - * ResultSet.FETCH_REVERSE}, or {@code ResultSet.FETCH_UNKNOWN} - * @throws SQLException - * if there is a database error. - */ - public void setFetchDirection(int direction) throws SQLException; - - /** - * Indicates the number of rows to fetch from the database when extra rows - * are required for this {@code ResultSet}. This used as a hint to the JDBC - * driver. - * - * @param rows - * the number of rows to fetch. {@code 0} implies that the JDBC - * driver can make its own decision about the fetch size. The - * number should not be greater than the maximum number of rows - * established by the statement that generated the {@code - * ResultSet}. - * @throws SQLException - * if a database error happens. - */ - public void setFetchSize(int rows) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code - * java.sql.Array} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateArray(int columnIndex, Array x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code java.sql.Array} - * value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateArray(String columnName, Array x) throws SQLException; - - /** - * Updates a column specified by a column index with an ASCII stream value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @param length - * the length of the data to write from the stream - * @throws SQLException - * if a database error happens. - */ - public void updateAsciiStream(int columnIndex, InputStream x, int length) - throws SQLException; - - /** - * Updates a column specified by a column name with an Ascii stream value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @param length - * the length of the data to write from the stream - * @throws SQLException - * if a database error happens. - */ - public void updateAsciiStream(String columnName, InputStream x, int length) - throws SQLException; - - /** - * Updates a column specified by a column index with a {@code - * java.sql.BigDecimal} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateBigDecimal(int columnIndex, BigDecimal x) - throws SQLException; - - /** - * Updates a column specified by a column name with a {@code - * java.sql.BigDecimal} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateBigDecimal(String columnName, BigDecimal x) - throws SQLException; - - /** - * Updates a column specified by a column index with a binary stream value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @param length - * the number of bytes to be read from the the stream. - * @throws SQLException - * if a database error happens. - */ - public void updateBinaryStream(int columnIndex, InputStream x, int length) - throws SQLException; - - /** - * Updates a column specified by a column name with a binary stream value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @param length - * he number of bytes to be read from the the stream. - * @throws SQLException - * if a database error happens. - */ - public void updateBinaryStream(String columnName, InputStream x, int length) - throws SQLException; - - /** - * Updates a column specified by a column index with a {@code java.sql.Blob} - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateBlob(int columnIndex, Blob x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code java.sql.Blob} - * value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateBlob(String columnName, Blob x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code boolean} - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateBoolean(int columnIndex, boolean x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code boolean} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateBoolean(String columnName, boolean x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code byte} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateByte(int columnIndex, byte x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code byte} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateByte(String columnName, byte x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code byte} array - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateBytes(int columnIndex, byte[] x) throws SQLException; - - /** - * Updates a column specified by a column name with a byte array value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateBytes(String columnName, byte[] x) throws SQLException; - - /** - * Updates a column specified by a column index with a character stream - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @param length - * the length of data to write from the stream - * @throws SQLException - * if a database error happens. - */ - public void updateCharacterStream(int columnIndex, Reader x, int length) - throws SQLException; - - /** - * Updates a column specified by a column name with a character stream - * value. - * - * @param columnName - * the name of the column to update. - * @param reader - * the new value for the specified column. - * @param length - * the length of data to write from the Reader - * @throws SQLException - * if a database error happens. - */ - public void updateCharacterStream(String columnName, Reader reader, - int length) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code java.sql.Clob} - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateClob(int columnIndex, Clob x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code java.sql.Clob} - * value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateClob(String columnName, Clob x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code java.sql.Date} - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateDate(int columnIndex, Date x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code java.sql.Date} - * value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateDate(String columnName, Date x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code double} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateDouble(int columnIndex, double x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code double} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateDouble(String columnName, double x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code float} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateFloat(int columnIndex, float x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code float} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateFloat(String columnName, float x) throws SQLException; - - /** - * Updates a column specified by a column index with an {@code int} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateInt(int columnIndex, int x) throws SQLException; - - /** - * Updates a column specified by a column name with an {@code int} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateInt(String columnName, int x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code long} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column.. - * @throws SQLException - * if a database error happens. - */ - public void updateLong(int columnIndex, long x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code long} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateLong(String columnName, long x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code null} value. - * - * @param columnIndex - * the index of the column to update. - * @throws SQLException - * if a database error happens. - */ - public void updateNull(int columnIndex) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code null} value. - * - * @param columnName - * the name of the column to update. - * @throws SQLException - * if a database error happens. - */ - public void updateNull(String columnName) throws SQLException; - - /** - * Updates a column specified by a column index with an {@code Object} - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateObject(int columnIndex, Object x) throws SQLException; - - /** - * Updates a column specified by a column index with an {@code Object} - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @param scale - * for the types {@code java.sql.Types.DECIMAL} or {@code - * java.sql.Types.NUMERIC}, this specifies the number of digits - * after the decimal point. - * @throws SQLException - * if a database error happens. - */ - public void updateObject(int columnIndex, Object x, int scale) - throws SQLException; - - /** - * Updates a column specified by a column name with an {@code Object} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateObject(String columnName, Object x) throws SQLException; - - /** - * Updates a column specified by a column name with an {@code Object} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @param scale - * for the types {@code java.sql.Types.DECIMAL} or {@code - * java.sql.Types.NUMERIC}, this specifies the number of digits - * after the decimal point. - * @throws SQLException - * if a database error happens. - */ - public void updateObject(String columnName, Object x, int scale) - throws SQLException; - - /** - * Updates a column specified by a column index with a {@code java.sql.Ref} - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateRef(int columnIndex, Ref x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code java.sql.Ref} - * value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateRef(String columnName, Ref x) throws SQLException; - - /** - * Updates the database with the new contents of the current row of this - * {@code ResultSet} object. - * - * @throws SQLException - * if a database error happens. - */ - public void updateRow() throws SQLException; - - /** - * Updates a column specified by a column index with a {@code short} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateShort(int columnIndex, short x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code short} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateShort(String columnName, short x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code String} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateString(int columnIndex, String x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code String} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateString(String columnName, String x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code Time} value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateTime(int columnIndex, Time x) throws SQLException; - - /** - * Updates a column specified by a column name with a {@code Time} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateTime(String columnName, Time x) throws SQLException; - - /** - * Updates a column specified by a column index with a {@code Timestamp} - * value. - * - * @param columnIndex - * the index of the column to update. - * @param x - * the new timestamp value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateTimestamp(int columnIndex, Timestamp x) - throws SQLException; - - /** - * Updates a column specified by column name with a {@code Timestamp} value. - * - * @param columnName - * the name of the column to update. - * @param x - * the new timestamp value for the specified column. - * @throws SQLException - * if a database error happens. - */ - public void updateTimestamp(String columnName, Timestamp x) - throws SQLException; - - /** - * Determines whether the last column read from this {@code ResultSet} - * contained SQL {@code NULL}. - * - * @return {@code {@code true} if the last column contained SQL {@code - * NULL}, {@code false} otherwise - * @throws SQLException - * if a database error happens. - */ - public boolean wasNull() throws SQLException; - - /** - * Returns a {@code RowId} corresponding to the SQL ROWID at the 1-based {@code columnIndex}. - * @throws SQLException - */ - public RowId getRowId(int columnIndex) throws SQLException; - - /** - * Returns a {@code RowId} corresponding to the SQL ROWID at the named column. - * @throws SQLException - */ - public RowId getRowId(String columnLabel) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateRowId(int columnIndex, RowId value) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateRowId(String columnLabel, RowId value) throws SQLException; - - /** - * Returns the holdability of this result set: {@link #HOLD_CURSORS_OVER_COMMIT} or - * {@link #CLOSE_CURSORS_AT_COMMIT}. - * @throws SQLException - */ - public int getHoldability() throws SQLException; - - /** - * Returns true if this result set has been closed, false otherwise. - * @throws SQLException - */ - public boolean isClosed() throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNString(int columnIndex, String nString) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNString(String columnLabel, String nString) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNClob(int columnIndex, NClob nClob) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNClob(String columnLabel, NClob nClob) throws SQLException; - - /** - * Returns an {@code NClob} corresponding to the value at the 1-based {@code columnIndex}. - * @throws SQLException - */ - public NClob getNClob(int columnIndex) throws SQLException; - - /** - * Returns an {@code NClob} corresponding to the value in the named column. - * @throws SQLException - */ - public NClob getNClob(String columnLabel) throws SQLException; - - /** - * Returns an {@code SQLXML} corresponding to the value at the 1-based {@code columnIndex}. - * @throws SQLException - */ - public SQLXML getSQLXML(int columnIndex) throws SQLException; - - /** - * Returns an {@code SQLXML} corresponding to the value in the named column. - * @throws SQLException - */ - public SQLXML getSQLXML(String columnLabel) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException; - - /** - * Returns a {@code String} corresponding to the value at the 1-based {@code columnIndex}. - * @throws SQLException - */ - public String getNString(int columnIndex) throws SQLException; - - /** - * Returns a {@code String} corresponding to the value in the named column. - * @throws SQLException - */ - public String getNString(String columnLabel) throws SQLException; - - /** - * Returns a {@code Reader} corresponding to the value at the 1-based {@code columnIndex}. - * @throws SQLException - */ - public Reader getNCharacterStream(int columnIndex) throws SQLException; - - /** - * Returns a {@code Reader} corresponding to the value in the named column. - * @throws SQLException - */ - public Reader getNCharacterStream(String columnLabel) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateClob(int columnIndex, Reader reader, long length) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateClob(String columnLabel, Reader reader, long length) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateCharacterStream(int columnIndex, Reader x) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateClob(int columnIndex, Reader reader) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateClob(String columnLabel, Reader reader) throws SQLException; - - /** - * Updates the value at the 1-based {@code columnIndex}. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNClob(int columnIndex, Reader reader) throws SQLException; - - /** - * Updates the value in the named column. - * The underlying database isn't changed until the next row update or insert operation. - * @throws SQLException - */ - public void updateNClob(String columnLabel, Reader reader) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/ResultSetMetaData.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/ResultSetMetaData.java deleted file mode 100644 index dae773136e..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/ResultSetMetaData.java +++ /dev/null @@ -1,282 +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 java.sql; - -/** - * Provides information about the columns returned in a {@code ResultSet}. - */ -public interface ResultSetMetaData extends Wrapper { - - /** - * Indicates that a column cannot contain {@code NULL} values. - */ - public static final int columnNoNulls = 0; - - /** - * Indicates that a column can contain {@code NULL} values. - */ - public static final int columnNullable = 1; - - /** - * Indicates that it is unknown whether a column can contain {@code NULL}s or not. - */ - public static final int columnNullableUnknown = 2; - - /** - * Returns the title of an indexed column's catalog. - * - * @param column - * the column index, starting at 1. - * @return the catalog title. - * @throws SQLException - * if there is a database error. - */ - public String getCatalogName(int column) throws SQLException; - - /** - * Returns the fully-qualified type of the class that is produced when - * invoking {@code ResultSet.getObject} to recover this column's value. - * - * @param column - * the column index, starting at 1. - * @return the fully-qualified class name. - * @throws SQLException - * if there is a database error. - * @see ResultSet#getObject - */ - public String getColumnClassName(int column) throws SQLException; - - /** - * Returns number of columns contained in the associated result set. - * - * @return the column count. - * @throws SQLException - * if there is a database error. - */ - public int getColumnCount() throws SQLException; - - /** - * Returns the indexed column's standard maximum width, expressed in number - * of characters. - * - * @param column - * the column index, starting at 1. - * @return the column's max width. - * @throws SQLException - * if there is a database error. - */ - public int getColumnDisplaySize(int column) throws SQLException; - - /** - * Returns a recommended title for the indexed column, to be used when the - * title needs to be displayed. - * - * @param column - * the column index, starting at 1. - * @return the column's title. - * @throws SQLException - * if there is a database error. - */ - public String getColumnLabel(int column) throws SQLException; - - /** - * Returns the title of the indexed column. - * - * @param column - * the column index, starting at 1. - * @return the column title. - * @throws SQLException - * if there is a database error. - */ - public String getColumnName(int column) throws SQLException; - - /** - * Returns the type of the indexed column as SQL type code. - * - * @param column - * the column index, starting at 1. - * @return the column type code. - * @throws SQLException - * if there is a database error. - * @see Types - */ - public int getColumnType(int column) throws SQLException; - - /** - * Returns the type name of the indexed column. - * - * @param column - * the column index, starting at 1. - * @return the type name. - * @throws SQLException - * if there is a database error. - */ - public String getColumnTypeName(int column) throws SQLException; - - /** - * Returns the decimal precision of the indexed column. - * - * @param column - * the column index, starting at 1. - * @return the precision. - * @throws SQLException - * if there is a database error. - */ - public int getPrecision(int column) throws SQLException; - - /** - * Returns the number of digits to the right of the decimal point of the - * indexed column. - * - * @param column - * the column index, starting at 1. - * @return number of decimal places. - * @throws SQLException - * if there is a database error. - */ - public int getScale(int column) throws SQLException; - - /** - * Returns the name of the indexed columns schema. - * - * @param column - * the column index, starting at 1. - * @return the name of the columns schema. - * @throws SQLException - * if there is a database error. - */ - public String getSchemaName(int column) throws SQLException; - - /** - * Returns the title of the indexed columns table. - * - * @param column - * the column index, starting at 1. - * @return the table title. - * @throws SQLException - * if there is a database error. - */ - public String getTableName(int column) throws SQLException; - - /** - * Returns an indication of whether the indexed column is automatically - * incremented and is therefore read-only. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if it is automatically numbered, {@code false} - * otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean isAutoIncrement(int column) throws SQLException; - - /** - * Returns an indication of whether the case of the indexed column is - * important. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if case matters, {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean isCaseSensitive(int column) throws SQLException; - - /** - * Returns whether the indexed column contains a monetary amount. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if it is a monetary value, {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean isCurrency(int column) throws SQLException; - - /** - * Returns an indication of whether writing to the indexed column is - * guaranteed to be successful. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if the write is guaranteed, {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean isDefinitelyWritable(int column) throws SQLException; - - /** - * Returns whether the indexed column is nullable. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if it is nullable, {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public int isNullable(int column) throws SQLException; - - /** - * Returns an indication of whether writing to the indexed column is - * guaranteed to be unsuccessful. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if the column is read-only, {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean isReadOnly(int column) throws SQLException; - - /** - * Returns an indication of whether the indexed column is searchable. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if the indexed column is searchable, {@code false} - * otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean isSearchable(int column) throws SQLException; - - /** - * Returns an indication of whether the values contained in the indexed - * column are signed. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if they are signed, {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean isSigned(int column) throws SQLException; - - /** - * Returns an indication of whether writing to the indexed column is - * possible. - * - * @param column - * the column index, starting at 1. - * @return {@code true} if it is possible to write, {@code false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean isWritable(int column) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/RowId.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/RowId.java deleted file mode 100644 index 6457bf5852..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/RowId.java +++ /dev/null @@ -1,36 +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 java.sql; - -/** - * Maps SQL's ROWID type into Java. - * @since 1.6 - */ -public interface RowId { - - boolean equals(Object obj); - - /** - * Returns an array of bytes representing the value of the corresponding SQL ROWID. - */ - byte[] getBytes(); - - String toString(); - - int hashCode(); -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/RowIdLifetime.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/RowIdLifetime.java deleted file mode 100644 index 1e356637ee..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/RowIdLifetime.java +++ /dev/null @@ -1,28 +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 java.sql; - -/** - * An enumeration to describe the life-time of RowID. - * - * @since 1.6 - */ -public enum RowIdLifetime { - ROWID_UNSUPPORTED, ROWID_VALID_OTHER, ROWID_VALID_SESSION, ROWID_VALID_TRANSACTION, - ROWID_VALID_FOREVER, -} \ No newline at end of file diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLClientInfoException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLClientInfoException.java deleted file mode 100644 index a1ae7f7385..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLClientInfoException.java +++ /dev/null @@ -1,212 +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 java.sql; - -import java.util.HashMap; -import java.util.Map; - -/** - * An exception, which is subclass of SQLException, is thrown when one or more - * client info properties could not be set on a Connection. - */ -public class SQLClientInfoException extends SQLException { - private static final long serialVersionUID = -4319604256824655880L; - - final private Map failedProperties; - - /** - * Creates an SQLClientInfoException object. The Reason string is set to - * null, the SQLState string is set to null and the Error Code is set to 0. - */ - public SQLClientInfoException() { - this.failedProperties = null; - } - - /** - * Creates an SQLClientInfoException object. The Reason string is set to the - * given reason string, the SQLState string is set to null and the Error - * Code is set to 0, and the Map object is set to - * the failed properties. - * - * @param failedProperties - * the Map object to use as the - * property values - */ - public SQLClientInfoException(Map failedProperties) { - this.failedProperties = new HashMap(failedProperties); - } - - /** - * Creates an SQLClientInfoException object. The Reason string is set to the - * null if cause == null or cause.toString() if cause!=null, the cause - * Throwable object is set to the given cause Throwable object, and the Map - * object is set to the failed properties. - * - * @param failedProperties - * the Map object to use as the - * property values - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLClientInfoException( - Map failedProperties, Throwable cause) { - super(cause); - this.failedProperties = new HashMap(failedProperties); - } - - /** - * Creates an SQLClientInfoException object. The Reason string is set to - * reason, and the Map object is set to the failed - * properties. - * - * @param reason - * the string to use as the Reason string - * @param failedProperties - * the Map object to use as the - * property values - */ - public SQLClientInfoException(String reason, - Map failedProperties) { - super(reason); - this.failedProperties = new HashMap(failedProperties); - } - - /** - * Creates an SQLClientInfoException object. The Reason string is set to - * reason, the cause Throwable object is set to the given cause Throwable - * object, and the Map object is set to the failed - * properties. - * - * @param reason - * the string to use as the Reason string - * @param failedProperties - * the Map object to use as the - * property values - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLClientInfoException(String reason, - Map failedProperties, Throwable cause) { - super(reason, cause); - this.failedProperties = new HashMap(failedProperties); - } - - /** - * Creates an SQLClientInfoException object. The Reason string is set to - * reason, the SQLState string is set to the sqlState, the Error Code is set - * to the vendorCode and the Map object is set to - * the failed properties. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param failedProperties - * the Map object to use as the - * property values - * - */ - public SQLClientInfoException(String reason, String sqlState, - int vendorCode, Map failedProperties) { - super(reason, sqlState, vendorCode); - this.failedProperties = new HashMap(failedProperties); - } - - /** - * Creates an SQLClientInfoException object. The Reason string is set to - * reason, the SQLState string is set to the sqlState, the Error Code is set - * to the vendorCode the cause Throwable object is set to the given cause - * Throwable object, and the Map object is set to - * the failed properties. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param failedProperties - * the Map object to use as the - * property values - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLClientInfoException(String reason, String sqlState, - int vendorCode, Map failedProperties, - Throwable cause) { - super(reason, sqlState, vendorCode, cause); - this.failedProperties = new HashMap(failedProperties); - } - - /** - * Creates an SQLClientInfoException object. The Reason string is set to - * reason, the SQLState string is set to the sqlState, and the Map - * object is set to the failed properties. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param failedProperties - * the Map object to use as the - * property values - */ - public SQLClientInfoException(String reason, String sqlState, - Map failedProperties) { - super(reason, sqlState); - this.failedProperties = new HashMap(failedProperties); - } - - /** - * Creates an SQLClientInfoException object. The Reason string is set to - * reason, the SQLState string is set to the sqlState, the Error Code is set - * to the vendorCode, and the Map object is set to - * the failed properties. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param failedProperties - * the Map object to use as the - * property values - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLClientInfoException(String reason, String sqlState, - Map failedProperties, Throwable cause) { - super(reason, sqlState, cause); - this.failedProperties = new HashMap(failedProperties); - } - - /** - * returns that the client info properties which could not be set - * - * @return the list of ClientInfoStatus objects indicate client info - * properties - */ - public Map getFailedProperties() { - return failedProperties; - } -} \ No newline at end of file diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLData.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLData.java deleted file mode 100644 index a22c07c4ca..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLData.java +++ /dev/null @@ -1,114 +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 java.sql; - -/** - * An interface for the custom mapping of an SQL User Defined Type (UDT) - * to a Java class. The Java class object is added to the connection's type map - * paired with the SQL name of the corresponding UDT. - *

- * Usually within an implementation of {@code SQLData}, there is a corresponding - * field for every attribute of an SQL type, but only one field, if the type is - * SQL {@code DISTINCT}. When the UDT is returned within a {@code ResultSet}, it - * is accessed with the {@link ResultSet#getObject} method and is returned as an - * object which is an instance of the class defined by the {@code SQLData} - * mapping. The application can use this object just like any other Java object - * and can store changes back into the database using the - * {@link PreparedStatement#setObject} method which performs the reverse mapping - * into the SQL {@code UDT}. - *

- * Normally the implementation of a custom mapping is generated by - * a tool requiring the name of the SQL {@code UDT}, the name - * of the class which it is going to be mapped to, and the field names to which - * the UDT attributes are mapped. The tool can then implement the {@code - * SQLData}, {@code readSQL}, and {@code writeSQL} methods. {@code readSQL} reads - * attributes from an {@code SQLInput} object, and {@code writeSQL} writes them. - * This is done via {@code SQLInput} and {@code SQLOutput} method calls - * respectively. - *

- * Ordinarily an application would not call {@code SQLData} methods directly. - * Similarly {@code SQLInput} and {@code SQLOutput} methods are not usually - * called directly. - */ -public interface SQLData { - - /** - * Gets the SQL name of the User Defined Type (UDT) that this object - * represents. This method, usually invoked by the JDBC driver, retrieves - * the name of the UDT instance associated with this {@code SQLData} object. - * - * @return a string with UDT type name for this object mapping, passed to - * {@code readSQL} when the object was created. - * @throws SQLException - * if a database error occurs. - */ - public String getSQLTypeName() throws SQLException; - - /** - * Reads data from the database into this object. This method follows these - * steps: - *

- *

    - *
  • Utilize the passed input stream to read the attributes or entries of - * the SQL type
  • - *
  • This is carried out by reading each entry from the input stream, - * ordered as they are in the SQL definition.
  • - *
  • Assign the data to the appropriate fields or elements. This is done - * by calling the relevant reader method for the type involved (e.g. {@code - * SQLInput.readString}, {@code SQLInputreadBigDecimal}). If the type is - * distinct, then read its only data entry. For structured types, read every - * entry.
  • - *
- *

- * The supplied input stream is typically initialized by the calling JDBC - * driver with the type map before {@code readSQL} is called. - * - * @param stream - * the {@code SQLInput} stream from which the type map data is - * read for the custom mapping. - * @param typeName - * the SQL type name for the type which is being mapped. - * @throws SQLException - * if a database error occurs. - * @see SQLInput - */ - public void readSQL(SQLInput stream, String typeName) throws SQLException; - - /** - * Writes the object to a supplied {@code SQLOutput} data stream, writing it - * out as an SQL value to the data source. - *

- * This method follows the following steps: - *

    - *
  • Write each attribute of the SQL type to the output stream.
  • - *
  • Write each item by calling a method on the output stream, in the - * order they appear in the SQL definition of the type. Use the appropriate - * {@code SQLOutput} methods (e.g. {@code writeInt}, {@code writeString}). - * Write a single data element for a distinct type. For a structured type, - * write a value for each attribute of the the SQL type.
  • - *
- * - * @param stream - * the {@code SQLOutput} stream to use to write out the data for - * the custom mapping. - * @throws SQLException - * if a database error occurs. - * @see SQLOutput - */ - public void writeSQL(SQLOutput stream) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLDataException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLDataException.java deleted file mode 100644 index eafab25074..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLDataException.java +++ /dev/null @@ -1,144 +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 java.sql; - -/** - * An exception, which is subclass of SQLException, is thrown when various data - * errors arise. These errors including division by 0 and invalid arguments to - * functions - */ -public class SQLDataException extends SQLNonTransientException { - - private static final long serialVersionUID = -6889123282670549800L; - - /** - * Creates an SQLDataException object. The Reason string is set to null, the - * SQLState string is set to null and the Error Code is set to 0. - */ - public SQLDataException() { - } - - /** - * Creates an SQLDataException object. The Reason string is set to the given - * reason string, the SQLState string is set to null and the Error Code is - * set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLDataException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLDataException object. The Reason string is set to the given - * reason string, the SQLState string is set to the given SQLState string - * and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLDataException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLDataException object. The Reason string is set to the given - * reason string, the SQLState string is set to the given SQLState string - * and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLDataException(String reason, String sqlState, int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLDataException object. The Reason string is set to the null - * if cause == null or cause.toString() if cause!=null,and the cause - * Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLDataException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLDataException object. The Reason string is set to the given - * and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLDataException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLDataException object. The Reason string is set to the given - * reason string, the SQLState string is set to the given SQLState string - * and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLDataException(String reason, String sqlState, Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLDataException object. The Reason string is set to the given - * reason string, the SQLState string is set to the given SQLState string , - * the Error Code is set to the given error code value, and the cause - * Throwable object is set to the given cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLDataException(String reason, String sqlState, int vendorCode, - Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLException.java deleted file mode 100644 index 2b650da78f..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLException.java +++ /dev/null @@ -1,260 +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 java.sql; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.NoSuchElementException; - -/** - * An exception that indicates a failed JDBC operation. - * It provides the following information about problems encountered with - * database access: - *
    - *
  • A message string.
  • - *
  • A {@code SQLState} error description string following either - * SQL 99 or X/OPEN {@code SQLState} - * conventions. {@link DatabaseMetaData#getSQLStateType} exposes the specific convention in - * use.
  • - *
  • A database-specific error code.
  • - *
  • The next exception in the chain.
  • - *
- * - * @see DatabaseMetaData - */ -public class SQLException extends Exception implements Serializable, Iterable { - - private static final long serialVersionUID = 2135244094396331484L; - - private String SQLState = null; - - private int vendorCode = 0; - - private SQLException next = null; - - /** - * Creates an {@code SQLException} object. The reason string is set to - * {@code null}, the {@code SQLState} string is set to {@code null} and the - * error code is set to 0. - */ - public SQLException() { - } - - /** - * Creates an {@code SQLException} object. The reason string is set to the given - * reason string, the {@code SQLState} string is set to {@code null} and the error code is - * set to 0. - * - * @param theReason - * the string to use as the Reason string - */ - public SQLException(String theReason) { - this(theReason, null, 0); - } - - /** - * Creates an {@code SQLException} object. The reason string is set to the - * given reason string, the {@code SQLState} string is set to the given - * {@code SQLState} string and the error code is set to 0. - * - * @param theReason - * the string to use as the reason string. - * @param theSQLState - * the string to use as the {@code SQLState} string. - */ - public SQLException(String theReason, String theSQLState) { - this(theReason, theSQLState, 0); - } - - /** - * Creates an {@code SQLException} object. The reason string is set to the - * given reason string, the {@code SQLState} string is set to the given - * {@code SQLState} string and the error code is set to the given error code - * value. - * - * @param theReason - * the string to use as the reason string. - * @param theSQLState - * the string to use as the {@code SQLState} string. - * @param theErrorCode - * the integer value for the error code. - */ - public SQLException(String theReason, String theSQLState, int theErrorCode) { - super(theReason); - SQLState = theSQLState; - vendorCode = theErrorCode; - } - - /** - * Creates an SQLException object. The Reason string is set to the null if - * cause == null or cause.toString() if cause!=null,and the cause Throwable - * object is set to the given cause Throwable object. - * - * @param theCause - * the Throwable object for the underlying reason this - * SQLException - * - * @since 1.6 - */ - public SQLException(Throwable theCause) { - this(theCause == null ? null : theCause.toString(), null, 0, theCause); - } - - /** - * Creates an SQLException object. The Reason string is set to the given and - * the cause Throwable object is set to the given cause Throwable object. - * - * @param theReason - * the string to use as the Reason string - * @param theCause - * the Throwable object for the underlying reason this - * SQLException - * - * @since 1.6 - */ - public SQLException(String theReason, Throwable theCause) { - super(theReason, theCause); - } - - /** - * Creates an SQLException object. The Reason string is set to the given - * reason string, the SQLState string is set to the given SQLState string - * and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param theReason - * the string to use as the Reason string - * @param theSQLState - * the string to use as the SQLState string - * @param theCause - * the Throwable object for the underlying reason this - * SQLException - * @since 1.6 - */ - public SQLException(String theReason, String theSQLState, Throwable theCause) { - super(theReason, theCause); - SQLState = theSQLState; - } - - /** - * Creates an SQLException object. The Reason string is set to the given - * reason string, the SQLState string is set to the given SQLState string , - * the Error Code is set to the given error code value, and the cause - * Throwable object is set to the given cause Throwable object. - * - * @param theReason - * the string to use as the Reason string - * @param theSQLState - * the string to use as the SQLState string - * @param theErrorCode - * the integer value for the error code - * @param theCause - * the Throwable object for the underlying reason this - * SQLException - * @since 1.6 - */ - public SQLException(String theReason, String theSQLState, int theErrorCode, - Throwable theCause) { - this(theReason, theSQLState, theCause); - vendorCode = theErrorCode; - } - - /** - * Returns the integer error code for this {@code SQLException}. - * - * @return The integer error code for this {@code SQLException}. The meaning - * of the code is specific to the vendor of the database. - */ - public int getErrorCode() { - return vendorCode; - } - - /** - * Retrieves the {@code SQLException} chained to this {@code SQLException}, - * if any. - * - * @return The {@code SQLException} chained to this {@code SQLException}. - * {@code null} if there is no {@code SQLException} chained to this - * {@code SQLException}. - */ - public SQLException getNextException() { - return next; - } - - /** - * Retrieves the {@code SQLState} description string for this {@code - * SQLException} object. - * - * @return The {@code SQLState} string for this {@code SQLException} object. - * This is an error description string which follows either the SQL - * 99 conventions or the X/OPEN {@code SQLstate} conventions. The - * potential values of the {@code SQLState} string are described in - * each of the specifications. Which of the conventions is being - * used by the {@code SQLState} string can be discovered by using - * the {@code getSQLStateType} method of the {@code - * DatabaseMetaData} interface. - */ - public String getSQLState() { - return SQLState; - } - - /** - * Obsolete. Appends {@code ex} to the end of this chain. - */ - public void setNextException(SQLException ex) { - if (next != null) { - next.setNextException(ex); - } else { - next = ex; - } - } - - /** - * Obsolete. {@link #getCause()} should be used instead of this iterator. Returns an iterator - * over the exceptions added with {@link #setNextException}. - */ - public Iterator iterator() { - return new InternalIterator(this); - } - - private static class InternalIterator implements Iterator { - - private SQLException current; - - InternalIterator(SQLException e) { - current = e; - } - - public boolean hasNext() { - return current != null; - } - - public Throwable next() { - if (current == null) { - throw new NoSuchElementException(); - } - SQLException ret = current; - current = current.next; - return ret; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLFeatureNotSupportedException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLFeatureNotSupportedException.java deleted file mode 100644 index e5f4fe4635..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLFeatureNotSupportedException.java +++ /dev/null @@ -1,147 +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 java.sql; - -/** - * An exception, which is subclass of SQLNonTransientException, is thrown when - * various the JDBC driver does not support an optional JDBC feature. - */ -public class SQLFeatureNotSupportedException extends SQLNonTransientException { - - private static final long serialVersionUID = -1026510870282316051L; - - /** - * Creates an SQLFeatureNotSupportedException object. The Reason string is - * set to null, the SQLState string is set to null and the Error Code is set - * to 0. - */ - public SQLFeatureNotSupportedException() { - } - - /** - * Creates an SQLFeatureNotSupportedException object. The Reason string is - * set to the given reason string, the SQLState string is set to null and - * the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLFeatureNotSupportedException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLFeatureNotSupportedException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLFeatureNotSupportedException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLFeatureNotSupportedException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLFeatureNotSupportedException(String reason, String sqlState, - int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLFeatureNotSupportedException object. The Reason string is - * set to the null if cause == null or cause.toString() if cause!=null,and - * the cause Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLFeatureNotSupportedException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLFeatureNotSupportedException object. The Reason string is - * set to the given and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLFeatureNotSupportedException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLFeatureNotSupportedException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLFeatureNotSupportedException(String reason, String sqlState, - Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLFeatureNotSupportedException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string , the Error Code is set to the given error code value, - * and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLFeatureNotSupportedException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLInput.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLInput.java deleted file mode 100644 index 347b0365a7..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLInput.java +++ /dev/null @@ -1,358 +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 java.sql; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; - -/** - * The {@code SQLInput} interface defines operations which apply to a type of - * input stream which carries a series of values representing an instance of - * an SQL structured type or SQL distinct type. - *

- * This interface is used to define custom mappings of SQL User Defined - * Types (UDTs) to Java classes. It is used by JDBC drivers, therefore - * application programmers do not normally use the {@code SQLInput} methods - * directly. Reader methods such as {@code readLong} and {@code readBytes} - * provide means to read values from an {@code SQLInput} stream. - *

- * When the {@code getObject} method is called with an object which implements - * the {@code SQLData} interface, the JDBC driver determines the SQL type of the - * UDT being mapped by calling the {@code SQLData.getSQLType} method. The driver - * creates an instance of an {@code SQLInput} stream, filling the stream with - * the attributes of the UDT. The {@code SQLInput} stream is passed to the - * {@code SQLData.readSQL} method which then calls the {@code SQLInput} reader - * methods to read the attributes. - * - * @see SQLData - */ -public interface SQLInput { - - /** - * Returns the next attribute in the stream in the form of a {@code String}. - * - * @return the next attribute. {@code null} if the value is SQL {@code NULL}. - * - * @throws SQLException - * if there is a database error. - */ - public String readString() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code boolean} - * . - * - * @return the next attribute as a {@code boolean}. {@code false} if the - * value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public boolean readBoolean() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code byte}. - * - * @return the next attribute as a {@code byte}. 0 if the value is SQL - * {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public byte readByte() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code short}. - * - * @return the next attribute as a {@code short}. 0 if the value is SQL - * {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public short readShort() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of an {@code int}. - * - * @return the next attribute as an {@code int}. 0 if the value is SQL - * {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public int readInt() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code long}. - * - * @return the next attribute as a {@code long}. 0 if the value is SQL - * {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public long readLong() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code float}. - * - * @return the next attribute as a {@code float}. 0 if the value is SQL - * {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public float readFloat() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code double}. - * - * @return the next attribute as a {@code double}. 0 if the value is SQL - * {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public double readDouble() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.math.BigDecimal}. - * - * @return the attribute as a {@code java.math.BigDecimal}. {@code null} if - * the read returns SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see java.math.BigDecimal - */ - public BigDecimal readBigDecimal() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a byte array. - * - * @return the attribute as a byte array. {@code null} if the read returns - * SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public byte[] readBytes() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.Date}. - * - * @return the next attribute as a {@code java.sql.Date}. {@code null} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see Date - */ - public Date readDate() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.Time}. - * - * @return the attribute as a {@code java.sql.Time}. {@code null} if the - * read returns SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see Time - */ - public Time readTime() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.Timestamp}. - * - * @return the attribute as a {@code java.sql.Timestamp}. {@code null} if - * the read returns SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see Timestamp - */ - public Timestamp readTimestamp() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a Unicode - * character stream embodied as a {@code java.io.Reader}. - * - * @return the next attribute as a {@code java.io.Reader}. {@code null} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see java.io.Reader - */ - public Reader readCharacterStream() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of an ASCII - * character stream embodied as a {@code java.io.InputStream}. - * - * @return the next attribute as a {@code java.io.InputStream}. {@code null} - * if the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see java.io.InputStream - */ - public InputStream readAsciiStream() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a stream of bytes - * embodied as a {@code java.io.InputStream}. - * - * @return the next attribute as a {@code java.io.InputStream}. {@code null} - * if the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see java.io.InputStream - */ - public InputStream readBinaryStream() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.lang.Object}. - *

- * The type of the {@code Object} returned is determined by the type mapping - * for this JDBC driver, including any customized mappings, if present. A - * type map is given to the {@code SQLInput} by the JDBC driver before the - * {@code SQLInput} is given to the application. - *

- * If the attribute is an SQL structured or distinct type, its SQL type is - * determined. If the stream's type map contains an element for that SQL - * type, the driver creates an object for the relevant type and invokes the - * method {@code SQLData.readSQL} on it, which reads supplementary data from - * the stream using whichever protocol is defined for that method. - * - * @return the next attribute as an Object. {@code null} if the value is SQL - * {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public Object readObject() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.Ref}. - * - * @return the next attribute as a {@code java.sql.Ref}. {@code null} if the - * value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see Ref - */ - public Ref readRef() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.Blob}. - * - * @return the next attribute as a {@code java.sql.Blob}. {@code null} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public Blob readBlob() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.Clob}. - * - * @return the next attribute as a {@code java.sql.Clob}. {@code null} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see Clob - */ - public Clob readClob() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.Array}. - * - * @return the next attribute as an {@code Array}. {@code null} if the value - * is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see Array - */ - public Array readArray() throws SQLException; - - /** - * Reports whether the last value read was SQL {@code NULL}. - * - * @return {@code true} if the last value read was SQL {@code NULL}, {@code - * false} otherwise. - * @throws SQLException - * if there is a database error. - */ - public boolean wasNull() throws SQLException; - - /** - * Reads the next attribute in the stream (SQL DATALINK value) and returns - * it as a {@code java.net.URL} object. - * - * @return the next attribute as a {@code java.net.URL}. {@code null} if the - * value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - * @see java.net.URL - */ - public URL readURL() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.NClob}. - * - * @return the next attribute as a {@code java.sql.NClob}. {@code null} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public NClob readNClob() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.lang.String}. Used for the NCHAR, NVARCHAR and LONGNVARCHAR types. - * See {@link #readString} otherwise. - * - * @return the next attribute as a {@code java.lang.String}. {@code null} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public String readNString() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.SQLXML}. - * - * @return the next attribute as a {@code java.sql.SQLXML}. {@code null} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public SQLXML readSQLXML() throws SQLException; - - /** - * Returns the next attribute in the stream in the form of a {@code - * java.sql.RowId}. Used for the ROWID type. - * - * @return the next attribute as a {@code java.sql.RowId}. {@code null} if - * the value is SQL {@code NULL}. - * @throws SQLException - * if there is a database error. - */ - public RowId readRowId() throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLIntegrityConstraintViolationException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLIntegrityConstraintViolationException.java deleted file mode 100644 index 3ebdcb50a0..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLIntegrityConstraintViolationException.java +++ /dev/null @@ -1,153 +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 java.sql; - -/** - * An exception, which is subclass of SQLNonTransientException, is thrown when - * various the an integrity constraint (foreign key, primary key or unique key) - * has been violated. - */ -public class SQLIntegrityConstraintViolationException extends - SQLNonTransientException { - - private static final long serialVersionUID = 8033405298774849169L; - - /** - * Creates an SQLIntegrityConstraintViolationException object. The Reason - * string is set to null, the SQLState string is set to null and the Error - * Code is set to 0. - */ - public SQLIntegrityConstraintViolationException() { - } - - /** - * Creates an SQLIntegrityConstraintViolationException object. The Reason - * string is set to the given reason string, the SQLState string is set to - * null and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLIntegrityConstraintViolationException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLIntegrityConstraintViolationException object. The Reason - * string is set to the given reason string, the SQLState string is set to - * the given SQLState string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLIntegrityConstraintViolationException(String reason, - String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLIntegrityConstraintViolationException object. The Reason - * string is set to the given reason string, the SQLState string is set to - * the given SQLState string and the Error Code is set to the given error - * code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLIntegrityConstraintViolationException(String reason, - String sqlState, int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLIntegrityConstraintViolationException object. The Reason - * string is set to the null if cause == null or cause.toString() if - * cause!=null,and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLIntegrityConstraintViolationException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLIntegrityConstraintViolationException object. The Reason - * string is set to the given and the cause Throwable object is set to the - * given cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLIntegrityConstraintViolationException(String reason, - Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLIntegrityConstraintViolationException object. The Reason - * string is set to the given reason string, the SQLState string is set to - * the given SQLState string and the cause Throwable object is set to the - * given cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLIntegrityConstraintViolationException(String reason, - String sqlState, Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLIntegrityConstraintViolationException object. The Reason - * string is set to the given reason string, the SQLState string is set to - * the given SQLState string , the Error Code is set to the given error code - * value, and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLIntegrityConstraintViolationException(String reason, - String sqlState, int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLInvalidAuthorizationSpecException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLInvalidAuthorizationSpecException.java deleted file mode 100644 index 4de4a9da29..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLInvalidAuthorizationSpecException.java +++ /dev/null @@ -1,151 +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 java.sql; - -/** - * An exception, which is subclass of SQLNonTransientException, is thrown when - * the authorization credentials presented during connection establishment are - * not valid. - */ -public class SQLInvalidAuthorizationSpecException extends - SQLNonTransientException { - - private static final long serialVersionUID = -64105250450891498L; - - /** - * Creates an SQLInvalidAuthorizationSpecException object. The Reason string - * is set to null, the SQLState string is set to null and the Error Code is - * set to 0. - */ - public SQLInvalidAuthorizationSpecException() { - } - - /** - * Creates an SQLInvalidAuthorizationSpecException object. The Reason string - * is set to the given reason string, the SQLState string is set to null and - * the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLInvalidAuthorizationSpecException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLInvalidAuthorizationSpecException object. The Reason string - * is set to the given reason string, the SQLState string is set to the - * given SQLState string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLInvalidAuthorizationSpecException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLInvalidAuthorizationSpecException object. The Reason string - * is set to the given reason string, the SQLState string is set to the - * given SQLState string and the Error Code is set to the given error code - * value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLInvalidAuthorizationSpecException(String reason, String sqlState, - int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLInvalidAuthorizationSpecException object. The Reason string - * is set to the null if cause == null or cause.toString() if - * cause!=null,and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLInvalidAuthorizationSpecException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLInvalidAuthorizationSpecException object. The Reason string - * is set to the given and the cause Throwable object is set to the given - * cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLInvalidAuthorizationSpecException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLInvalidAuthorizationSpecException object. The Reason string - * is set to the given reason string, the SQLState string is set to the - * given SQLState string and the cause Throwable object is set to the given - * cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLInvalidAuthorizationSpecException(String reason, String sqlState, - Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLInvalidAuthorizationSpecException object. The Reason string - * is set to the given reason string, the SQLState string is set to the - * given SQLState string , the Error Code is set to the given error code - * value, and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLInvalidAuthorizationSpecException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLNonTransientConnectionException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLNonTransientConnectionException.java deleted file mode 100644 index 0797065c8b..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLNonTransientConnectionException.java +++ /dev/null @@ -1,151 +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 java.sql; - -/** - * An exception, which is subclass of SQLException, is thrown when the - * connection operation that failed will not succeed when the operation is - * retried without the cause of the failure being corrected. - */ -public class SQLNonTransientConnectionException extends - SQLNonTransientException { - - private static final long serialVersionUID = -5852318857474782892L; - - /** - * Creates an SQLNonTransientConnectionException object. The Reason string - * is set to null, the SQLState string is set to null and the Error Code is - * set to 0. - */ - public SQLNonTransientConnectionException() { - } - - /** - * Creates an SQLNonTransientConnectionException object. The Reason string - * is set to the given reason string, the SQLState string is set to null and - * the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLNonTransientConnectionException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLNonTransientConnectionException object. The Reason string - * is set to the given reason string, the SQLState string is set to the - * given SQLState string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLNonTransientConnectionException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLNonTransientConnectionException object. The Reason string - * is set to the given reason string, the SQLState string is set to the - * given SQLState string and the Error Code is set to the given error code - * value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLNonTransientConnectionException(String reason, String sqlState, - int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLNonTransientConnectionException object. The Reason string - * is set to the null if cause == null or cause.toString() if - * cause!=null,and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLNonTransientConnectionException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLNonTransientConnectionException object. The Reason string - * is set to the given and the cause Throwable object is set to the given - * cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLNonTransientConnectionException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLNonTransientConnectionException object. The Reason string - * is set to the given reason string, the SQLState string is set to the - * given SQLState string and the cause Throwable object is set to the given - * cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLNonTransientConnectionException(String reason, String sqlState, - Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLNonTransientConnectionException object. The Reason string - * is set to the given reason string, the SQLState string is set to the - * given SQLState string , the Error Code is set to the given error code - * value, and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLNonTransientConnectionException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLNonTransientException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLNonTransientException.java deleted file mode 100644 index 79dfbcb637..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLNonTransientException.java +++ /dev/null @@ -1,141 +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 java.sql; - -public class SQLNonTransientException extends SQLException { - - private static final long serialVersionUID = -9104382843534716547L; - - /** - * Creates an SQLNonTransientException object. The Reason string is set to - * null, the SQLState string is set to null and the Error Code is set to 0. - */ - public SQLNonTransientException() { - } - - /** - * Creates an SQLNonTransientException object. The Reason string is set to - * the given reason string, the SQLState string is set to null and the Error - * Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLNonTransientException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLNonTransientException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLNonTransientException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLNonTransientException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLNonTransientException(String reason, String sqlState, - int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLNonTransientException object. The Reason string is set to - * the null if cause == null or cause.toString() if cause!=null,and the - * cause Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLNonTransientException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLNonTransientException object. The Reason string is set to - * the given and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLNonTransientException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLNonTransientException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLNonTransientException(String reason, String sqlState, - Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLNonTransientException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string , the Error Code is set to the given error code value, and the - * cause Throwable object is set to the given cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLNonTransientException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLOutput.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLOutput.java deleted file mode 100644 index 1e01e74cca..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLOutput.java +++ /dev/null @@ -1,334 +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 java.sql; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; - -/** - * The interface for an output stream used to write attributes of an SQL User - * Defined Type (UDT) to the database. This interface is used for custom - * mapping of types and is called by the JDBC driver. It is not intended to be - * used by applications. - *

- * When an object which implements the {@code SQLData} interface is used as an - * argument to an SQL statement, the JDBC driver calls the method {@code - * SQLData.getSQLType} to establish the type of the SQL UDT that is being - * passed. The driver then creates an {@code SQLOutput} stream and passes it to - * the {@code SQLData.writeSQL} method, which in turn uses the appropriate - * {@code SQLOutput} writer methods to write the data from the {@code SQLData} - * object into the stream according to the defined mapping. - * - * @see SQLData - */ -public interface SQLOutput { - - /** - * Write a {@code String} value into the output stream. - * - * @param theString - * the {@code String} to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeString(String theString) throws SQLException; - - /** - * Write a {@code boolean} value into the output stream. - * - * @param theFlag - * the {@code boolean} value to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeBoolean(boolean theFlag) throws SQLException; - - /** - * Write a {@code byte} value into the output stream. - * - * @param theByte - * the {@code byte} value to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeByte(byte theByte) throws SQLException; - - /** - * Write a {@code short} value into the output stream. - * - * @param theShort - * the {@code short} value to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeShort(short theShort) throws SQLException; - - /** - * Write an {@code int} value into the output stream. - * - * @param theInt - * the {@code int} value to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeInt(int theInt) throws SQLException; - - /** - * Write a {@code long} value into the output stream. - * - * @param theLong - * the {@code long} value to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeLong(long theLong) throws SQLException; - - /** - * Write a {@code float} value into the output stream. - * - * @param theFloat - * the {@code float} value to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeFloat(float theFloat) throws SQLException; - - /** - * Write a {@code double} value into the output stream. - * - * @param theDouble - * the {@code double} value to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeDouble(double theDouble) throws SQLException; - - /** - * Write a {@code java.math.BigDecimal} value into the output stream. - * - * @param theBigDecimal - * the {@code BigDecimal} value to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeBigDecimal(BigDecimal theBigDecimal) throws SQLException; - - /** - * Write an array of bytes into the output stream. - * - * @param theBytes - * the array of bytes to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeBytes(byte[] theBytes) throws SQLException; - - /** - * Write a {@code java.sql.Date} value into the output stream. - * - * @param theDate - * the {@code Date} value to write. - * @throws SQLException - * if a database error occurs. - * @see Date - */ - public void writeDate(Date theDate) throws SQLException; - - /** - * Write a {@code java.sql.Time} value into the output stream. - * - * @param theTime - * the {@code Time} value to write. - * @throws SQLException - * if a database error occurs. - * @see Time - */ - public void writeTime(Time theTime) throws SQLException; - - /** - * Write a {@code java.sql.Timestamp} value into the output stream. - * - * @param theTimestamp - * the {@code Timestamp} value to write. - * @throws SQLException - * if a database error occurs. - * @see Timestamp - */ - public void writeTimestamp(Timestamp theTimestamp) throws SQLException; - - /** - * Write a stream of unicode characters into the output stream. - * - * @param theStream - * the stream of unicode characters to write, as a {@code - * java.io.Reader} object. - * @throws SQLException - * if a database error occurs. - */ - public void writeCharacterStream(Reader theStream) throws SQLException; - - /** - * Write a stream of ASCII characters into the output stream. - * - * @param theStream - * the stream of ASCII characters to write, as a {@code - * java.io.InputStream} object - * @throws SQLException - * if a database error occurs. - */ - public void writeAsciiStream(InputStream theStream) throws SQLException; - - /** - * Write a stream of uninterpreted bytes into the output stream. - * - * @param theStream - * the stream of bytes to write, as a {@code java.io.InputStream} - * object - * @throws SQLException - * if a database error occurs. - */ - public void writeBinaryStream(InputStream theStream) throws SQLException; - - /** - * Write an {@code SQLData} object into the output stream. - *

- * If the {@code SQLData} object is null, writes {@code NULL} to the stream. - *

- * Otherwise, calls the {@code SQLData.writeSQL} method of the object, which - * writes the object's attributes to the stream by calling the appropriate - * SQLOutput writer methods for each attribute, in order. The order of the - * attributes is the order they are listed in the SQL definition of the User - * Defined Type. - * - * @param theObject - * the {@code SQLData} object to write. - * @throws SQLException - * if a database error occurs. - * @see SQLData - */ - public void writeObject(SQLData theObject) throws SQLException; - - /** - * Write an SQL {@code Ref} value into the output stream. - * - * @param theRef - * the {@code java.sql.Ref} object to write. - * @throws SQLException - * if a database error occurs. - * @see Ref - */ - public void writeRef(Ref theRef) throws SQLException; - - /** - * Write an SQL {@code Blob} value into the output stream. - * - * @param theBlob - * the {@code java.sql.Blob} object to write. - * @throws SQLException - * if a database error occurs. - * @see Blob - */ - public void writeBlob(Blob theBlob) throws SQLException; - - /** - * Write an SQL {@code Clob} value into the output stream. - * - * @param theClob - * the {@code java.sql.Clob} object to write. - * @throws SQLException - * if a database error occurs. - * @see Clob - */ - public void writeClob(Clob theClob) throws SQLException; - - /** - * Write an SQL {@code Struct} value into the output stream. - * - * @param theStruct - * the {@code java.sql.Struct} object to write. - * @throws SQLException - * if a database error occurs. - * @see Struct - */ - public void writeStruct(Struct theStruct) throws SQLException; - - /** - * Write an SQL {@code Array} value into the output stream. - * - * @param theArray - * the {@code java.sql.Array} object to write. - * @throws SQLException - * if a database error occurs. - * @see Array - */ - public void writeArray(Array theArray) throws SQLException; - - /** - * Write a {@code URL} into the output stream as an SQL DATALINK. - * - * @param theURL - * the datalink value as a {@code java.net.URL} to write. - * @throws SQLException - * if a database error occurs. - * @see java.net.URL - */ - public void writeURL(URL theURL) throws SQLException; - - /** - * Write a {@code String} into the output stream as an SQL NCHAR, NVARCHAR, - * or LONGNVARCHAR. - * - * @param theString - * the {@code String} to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeNString(String theString) throws SQLException; - - /** - * Write a {@code Clob} into the output stream as an SQL NCLOB. - * - * @param theNClob - * the {@code java.sql.Clob} object to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeNClob(NClob theNClob) throws SQLException; - - /** - * Write a {@code RowId} into the output stream as an SQL ROWID. - * - * @param theRowId - * the {@code java.sql.RowId} object to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeRowId(RowId theRowId) throws SQLException; - - /** - * Write a {@code SQLXML} into the output stream as an SQL XML. - * - * @param theXml - * the {@code java.sql.SQLXML} object to write. - * @throws SQLException - * if a database error occurs. - */ - public void writeSQLXML(SQLXML theXml) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLPermission.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLPermission.java deleted file mode 100644 index 18065c6722..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLPermission.java +++ /dev/null @@ -1,36 +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 java.sql; - -import java.io.Serializable; -import java.security.BasicPermission; -import java.security.Guard; -import java.security.Permission; - -/** - * Legacy security code; do not use. - */ -public final class SQLPermission extends BasicPermission implements Guard, Serializable { - public SQLPermission(String name) { super(""); } - - public SQLPermission(String name, String actions) { super("", ""); } - - @Override public String getActions() { return null; } - - @Override public boolean implies(Permission permission) { return true; } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLRecoverableException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLRecoverableException.java deleted file mode 100644 index 485e3a66df..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLRecoverableException.java +++ /dev/null @@ -1,141 +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 java.sql; - -public class SQLRecoverableException extends SQLException { - - private static final long serialVersionUID = -4144386502923131579L; - - /** - * Creates an SQLRecoverableException object. The Reason string is set to - * null, the SQLState string is set to null and the Error Code is set to 0. - */ - public SQLRecoverableException() { - } - - /** - * Creates an SQLRecoverableException object. The Reason string is set to - * the given reason string, the SQLState string is set to null and the Error - * Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLRecoverableException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLRecoverableException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLRecoverableException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLRecoverableException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLRecoverableException(String reason, String sqlState, - int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLRecoverableException object. The Reason string is set to - * the null if cause == null or cause.toString() if cause!=null,and the - * cause Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLRecoverableException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLRecoverableException object. The Reason string is set to - * the given and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLRecoverableException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLRecoverableException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLRecoverableException(String reason, String sqlState, - Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLRecoverableException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string , the Error Code is set to the given error code value, and the - * cause Throwable object is set to the given cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLRecoverableException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLSyntaxErrorException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLSyntaxErrorException.java deleted file mode 100644 index 125e5215a5..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLSyntaxErrorException.java +++ /dev/null @@ -1,141 +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 java.sql; - -public class SQLSyntaxErrorException extends SQLNonTransientException { - - private static final long serialVersionUID = -1843832610477496053L; - - /** - * Creates an SQLSyntaxErrorException object. The Reason string is set to - * null, the SQLState string is set to null and the Error Code is set to 0. - */ - public SQLSyntaxErrorException() { - } - - /** - * Creates an SQLSyntaxErrorException object. The Reason string is set to - * the given reason string, the SQLState string is set to null and the Error - * Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLSyntaxErrorException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLSyntaxErrorException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLSyntaxErrorException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLSyntaxErrorException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLSyntaxErrorException(String reason, String sqlState, - int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLSyntaxErrorException object. The Reason string is set to - * the null if cause == null or cause.toString() if cause!=null,and the - * cause Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLSyntaxErrorException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLSyntaxErrorException object. The Reason string is set to - * the given and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLSyntaxErrorException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLSyntaxErrorException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLSyntaxErrorException(String reason, String sqlState, - Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLSyntaxErrorException object. The Reason string is set to - * the given reason string, the SQLState string is set to the given SQLState - * string , the Error Code is set to the given error code value, and the - * cause Throwable object is set to the given cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLSyntaxErrorException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTimeoutException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTimeoutException.java deleted file mode 100644 index a31c70e11a..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTimeoutException.java +++ /dev/null @@ -1,139 +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 java.sql; - -public class SQLTimeoutException extends SQLTransientException { - - private static final long serialVersionUID = -4487171280562520262L; - - /** - * Creates an SQLTimeoutException object. The Reason string is set to null, - * the SQLState string is set to null and the Error Code is set to 0. - */ - public SQLTimeoutException() { - } - - /** - * Creates an SQLTimeoutException object. The Reason string is set to the - * given reason string, the SQLState string is set to null and the Error - * Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLTimeoutException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLTimeoutException object. The Reason string is set to the - * given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLTimeoutException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLTimeoutException object. The Reason string is set to the - * given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLTimeoutException(String reason, String sqlState, int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLTimeoutException object. The Reason string is set to the - * null if cause == null or cause.toString() if cause!=null,and the cause - * Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTimeoutException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLTimeoutException object. The Reason string is set to the - * given and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTimeoutException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLTimeoutException object. The Reason string is set to the - * given reason string, the SQLState string is set to the given SQLState - * string and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTimeoutException(String reason, String sqlState, Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLTimeoutException object. The Reason string is set to the - * given reason string, the SQLState string is set to the given SQLState - * string , the Error Code is set to the given error code value, and the - * cause Throwable object is set to the given cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTimeoutException(String reason, String sqlState, int vendorCode, - Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransactionRollbackException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransactionRollbackException.java deleted file mode 100644 index c525cf94ca..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransactionRollbackException.java +++ /dev/null @@ -1,143 +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 java.sql; - -public class SQLTransactionRollbackException extends SQLTransientException { - - private static final long serialVersionUID = 5246680841170837229L; - - /** - * Creates an SQLTransactionRollbackException object. The Reason string is - * set to null, the SQLState string is set to null and the Error Code is set - * to 0. - */ - public SQLTransactionRollbackException() { - } - - /** - * Creates an SQLTransactionRollbackException object. The Reason string is - * set to the given reason string, the SQLState string is set to null and - * the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLTransactionRollbackException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLTransactionRollbackException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLTransactionRollbackException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLTransactionRollbackException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLTransactionRollbackException(String reason, String sqlState, - int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLTransactionRollbackException object. The Reason string is - * set to the null if cause == null or cause.toString() if cause!=null,and - * the cause Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransactionRollbackException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLTransactionRollbackException object. The Reason string is - * set to the given and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransactionRollbackException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLTransactionRollbackException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransactionRollbackException(String reason, String sqlState, - Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLTransactionRollbackException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string , the Error Code is set to the given error code value, - * and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransactionRollbackException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransientConnectionException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransientConnectionException.java deleted file mode 100644 index d818f954d6..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransientConnectionException.java +++ /dev/null @@ -1,143 +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 java.sql; - -public class SQLTransientConnectionException extends SQLTransientException { - - private static final long serialVersionUID = -2520155553543391200L; - - /** - * Creates an SQLTransientConnectionException object. The Reason string is - * set to null, the SQLState string is set to null and the Error Code is set - * to 0. - */ - public SQLTransientConnectionException() { - } - - /** - * Creates an SQLTransientConnectionException object. The Reason string is - * set to the given reason string, the SQLState string is set to null and - * the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLTransientConnectionException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLTransientConnectionException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLTransientConnectionException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLTransientConnectionException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLTransientConnectionException(String reason, String sqlState, - int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLTransientConnectionException object. The Reason string is - * set to the null if cause == null or cause.toString() if cause!=null,and - * the cause Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransientConnectionException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLTransientConnectionException object. The Reason string is - * set to the given and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransientConnectionException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLTransientConnectionException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string and the cause Throwable object is set to the given cause - * Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransientConnectionException(String reason, String sqlState, - Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLTransientConnectionException object. The Reason string is - * set to the given reason string, the SQLState string is set to the given - * SQLState string , the Error Code is set to the given error code value, - * and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransientConnectionException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransientException.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransientException.java deleted file mode 100644 index e0aec17b6c..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLTransientException.java +++ /dev/null @@ -1,139 +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 java.sql; - -public class SQLTransientException extends SQLException { - - private static final long serialVersionUID = -9042733978262274539L; - - /** - * Creates an SQLTransientException object. The Reason string is set to - * null, the SQLState string is set to null and the Error Code is set to 0. - */ - public SQLTransientException() { - } - - /** - * Creates an SQLTransientException object. The Reason string is set to the - * given reason string, the SQLState string is set to null and the Error - * Code is set to 0. - * - * @param reason - * the string to use as the Reason string - */ - public SQLTransientException(String reason) { - super(reason, null, 0); - } - - /** - * Creates an SQLTransientException object. The Reason string is set to the - * given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to 0. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - */ - public SQLTransientException(String reason, String sqlState) { - super(reason, sqlState, 0); - } - - /** - * Creates an SQLTransientException object. The Reason string is set to the - * given reason string, the SQLState string is set to the given SQLState - * string and the Error Code is set to the given error code value. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - */ - public SQLTransientException(String reason, String sqlState, int vendorCode) { - super(reason, sqlState, vendorCode); - } - - /** - * Creates an SQLTransientException object. The Reason string is set to the - * null if cause == null or cause.toString() if cause!=null,and the cause - * Throwable object is set to the given cause Throwable object. - * - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransientException(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLTransientException object. The Reason string is set to the - * given and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransientException(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLTransientException object. The Reason string is set to the - * given reason string, the SQLState string is set to the given SQLState - * string and the cause Throwable object is set to the given cause Throwable - * object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransientException(String reason, String sqlState, Throwable cause) { - super(reason, sqlState, cause); - } - - /** - * Creates an SQLTransientException object. The Reason string is set to the - * given reason string, the SQLState string is set to the given SQLState - * string , the Error Code is set to the given error code value, and the - * cause Throwable object is set to the given cause Throwable object. - * - * @param reason - * the string to use as the Reason string - * @param sqlState - * the string to use as the SQLState string - * @param vendorCode - * the integer value for the error code - * @param cause - * the Throwable object for the underlying reason this - * SQLException - */ - public SQLTransientException(String reason, String sqlState, - int vendorCode, Throwable cause) { - super(reason, sqlState, vendorCode, cause); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLWarning.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLWarning.java deleted file mode 100644 index cad5d1f2e8..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLWarning.java +++ /dev/null @@ -1,152 +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 java.sql; - -import java.io.Serializable; - -/** - * An exception class that holds information about Database access warnings. - */ -public class SQLWarning extends SQLException implements Serializable { - - private static final long serialVersionUID = 3917336774604784856L; - - /** - * Creates an {@code SQLWarning} object. The reason string is set to {@code - * null}, the {@code SQLState} string is set to {@code null} and the error - * code is set to 0. - */ - public SQLWarning() { - } - - /** - * Creates an {@code SQLWarning} object. The reason string is set to the - * given reason string, the {@code SQLState} string is set to {@code null} - * and the error code is set to 0. - * - * @param theReason - * the reason why this warning is issued. - */ - public SQLWarning(String theReason) { - super(theReason); - } - - /** - * Creates an {@code SQLWarning} object. The reason string is set to the - * given reason string, the {@code SQLState} string is set to the given - * {@code SQLState} string and the error code is set to 0. - * - * @param theReason - * the reason why this warning is issued. - * @param theSQLState - * the string to use as the {@code SQLState} string. - */ - public SQLWarning(String theReason, String theSQLState) { - super(theReason, theSQLState); - } - - /** - * Creates an {@code SQLWarning} object. The reason string is set to the - * given reason string, the {@code SQLState} string is set to the given - * {@code SQLState} string and the error code is set to the given error code - * value. - * - * @param theReason - * the reason why this warning is issued. - * @param theSQLState - * the X/Open standard specifc error code. - * @param theErrorCode - * a vendor specific error code. - */ - public SQLWarning(String theReason, String theSQLState, int theErrorCode) { - super(theReason, theSQLState, theErrorCode); - } - - /** - * Creates an SQLWarning object. The Reason string is set to null, the - * SQLState string is set to null and the Error Code is set to 0, cause is - * set to cause. - * - * @since 1.6 - */ - public SQLWarning(Throwable cause) { - super(cause); - } - - /** - * Creates an SQLWarning object. The Reason string is set to reason, the - * SQLState string is set to null and the Error Code is set to 0, cause is - * set to the given cause - * - * @since 1.6 - */ - public SQLWarning(String reason, Throwable cause) { - super(reason, cause); - } - - /** - * Creates an SQLWarning object. The Reason string is set to reason, the - * SQLState string is set to given SQLState and the Error Code is set to 0, - * cause is set to the given cause - * - * @since 1.6 - */ - public SQLWarning(String reason, String SQLState, Throwable cause) { - super(reason, SQLState, cause); - } - - /** - * Creates an SQLWarning object. The Reason string is set to reason, the - * SQLState string is set to given SQLState and the Error Code is set to - * vendorCode, cause is set to the given cause - * - * @since 1.6 - */ - public SQLWarning(String reason, String SQLState, int vendorCode, - Throwable cause) { - super(reason, SQLState, vendorCode, cause); - } - - /** - * Gets the next {@code SQLWarning} chained to this {@code SQLWarning} object. - * - * @return the {@code SQLWarning} chained to this {@code SQLWarning}. - * {@code null} if no {@code SQLWarning} is chained to this {@code - * SQLWarning}. - */ - public SQLWarning getNextWarning() { - SQLException next = super.getNextException(); - if (next == null) { - return null; - } - if (next instanceof SQLWarning) { - return (SQLWarning) next; - } - throw new Error("SQLWarning chain holds value that is not a SQLWarning"); - } - - /** - * Chains a supplied {@code SQLWarning} to this {@code SQLWarning}. - * - * @param w - * the {@code SQLWarning} linked to this {@code SQLWarning}. - */ - public void setNextWarning(SQLWarning w) { - super.setNextException(w); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLXML.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLXML.java deleted file mode 100644 index 09509a33bc..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/SQLXML.java +++ /dev/null @@ -1,86 +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 java.sql; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; -import javax.xml.transform.Result; -import javax.xml.transform.Source; - -/** - * Maps SQL's XML type into Java. - */ -public interface SQLXML { - /** - * Frees any resources held by this object. After {@code free} is called, calling - * method other than {@code free} will throw {@code SQLException} (calling {@code free} - * repeatedly will do nothing). - * @throws SQLException - */ - void free() throws SQLException; - - /** - * Returns a stream that can be used to read binary data from this SQL {@code XML} object. - * @throws SQLException if an error occurs accessing the data - */ - InputStream getBinaryStream() throws SQLException; - - /** - * Returns a stream that can be used to write binary data to this SQL {@code XML} object. - * @throws SQLException if an error occurs accessing the data - */ - OutputStream setBinaryStream() throws SQLException; - - /** - * Returns a reader that can be used to read character data from this SQL {@code XML} object. - * @throws SQLException if an error occurs accessing the data - */ - Reader getCharacterStream() throws SQLException; - - /** - * Returns a writer that can be used to write character data to this SQL {@code XML} object. - * @throws SQLException if an error occurs accessing the data - */ - Writer setCharacterStream() throws SQLException; - - /** - * Returns this object's data as an XML string. - * @throws SQLException if an error occurs accessing the data - */ - String getString() throws SQLException; - - /** - * Sets this object's data to the given XML string. - * @throws SQLException if an error occurs accessing the data - */ - void setString(String value) throws SQLException; - - /** - * Returns a {@link Source} for reading this object's data. - * @throws SQLException if an error occurs accessing the data - */ - T getSource(Class sourceClass) throws SQLException; - - /** - * Returns a {@link Result} for writing this object's data. - * @throws SQLException if an error occurs accessing the data - */ - T setResult(Class resultClass) throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Savepoint.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Savepoint.java deleted file mode 100644 index 82574a14f5..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Savepoint.java +++ /dev/null @@ -1,45 +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 java.sql; - -/** - * A savepoint is an instant during the current transaction that can be utilized - * by a rollback via the {@link Connection#rollback} command. Rolling back to a - * particular savepoint means that all changes that occurred after that - * savepoint are undone. - */ -public interface Savepoint { - - /** - * Returns the constructed ID for this savepoint. - * - * @return the ID for this savepoint. - * @throws SQLException - * if an error occurrs accessing the database. - */ - public int getSavepointId() throws SQLException; - - /** - * Returns the name for this savepoint. - * - * @return the name of this savepoint. - * @throws SQLException - * if an error occurrs accessing the database. - */ - public String getSavepointName() throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Statement.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Statement.java deleted file mode 100644 index 1f7e2972a9..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Statement.java +++ /dev/null @@ -1,670 +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 java.sql; - -/** - * Interface used for executing static SQL statements to retrieve query results. - * The resulting table rows are returned as {@code ResultSet}s. For any given - * {@code Statement} object, only one {@code ResultSet} can be opened at one - * time. A call to any of the execution methods of {@code Statement} will cause - * any previously created {@code ResultSet} object for that {@code Statement} to - * be closed implicitly. - *

- * To have multiple {@code ResultSet} objects opened concurrently, multiple - * {@code Statement} objects must be created and then executed. - *

- * To obtain such an executable statement one needs to invoke {@code - * Connection#createStatement}. - * - * @see ResultSet - * @see Connection#createStatement - */ -public interface Statement extends Wrapper, AutoCloseable { - - /** - * Passing this constant to {@link #getMoreResults} implies that all {@code - * ResultSet} objects previously kept open should be closed. - */ - public static final int CLOSE_ALL_RESULTS = 3; - - /** - * Passing this constant to {@link #getMoreResults} implies that the current - * {@code ResultSet} object should be closed. - */ - public static final int CLOSE_CURRENT_RESULT = 1; - - /** - * Indicates that an error was encountered during execution of a batch - * statement. - */ - public static final int EXECUTE_FAILED = -3; - - /** - * Passing this constant to getMoreResults implies that the current - * {@code ResultSet} object should not be closed. - */ - public static final int KEEP_CURRENT_RESULT = 2; - - /** - * Indicates that generated keys should not be accessible for retrieval. - */ - public static final int NO_GENERATED_KEYS = 2; - - /** - * Indicates that generated keys should be accessible for retrieval. - */ - public static final int RETURN_GENERATED_KEYS = 1; - - /** - * Indicates that a batch statement was executed with a successful result, - * but a count of the number of rows it affected is unavailable. - */ - public static final int SUCCESS_NO_INFO = -2; - - /** - * Adds a specified SQL command to the list of commands for this {@code - * Statement}. - *

- * The list of commands is executed by invoking the {@code executeBatch} - * method. - * - * @param sql - * the SQL command as a String. Typically an {@code INSERT} or - * {@code UPDATE} statement. - * @throws SQLException - * if an error occurs accessing the database or the database - * does not support batch updates. - */ - public void addBatch(String sql) throws SQLException; - - /** - * Cancels this statement's execution if both the database and the JDBC - * driver support aborting an SQL statement in flight. This method can be - * used by one thread to stop a statement that is executed on another - * thread. - * - * @throws SQLException - * if an error occurs accessing the database. - */ - public void cancel() throws SQLException; - - /** - * Clears the current list of SQL commands for this statement. - * - * @throws SQLException - * if an error occurs accessing the database or the database - * does not support batch updates. - */ - public void clearBatch() throws SQLException; - - /** - * Clears all {@code SQLWarnings} from this statement. - * - * @throws SQLException - * if an error occurs accessing the database. - */ - public void clearWarnings() throws SQLException; - - /** - * Releases this statement's database and JDBC driver resources. - *

- * Using this method to release these resources as soon as possible is - * strongly recommended. - *

- * One should not rely on the resources being automatically released when - * finalized during garbage collection. Doing so can result in unpredictable - * behavior for the application. - * - * @throws SQLException - * if an error occurs accessing the database. - */ - public void close() throws SQLException; - - /** - * Executes a supplied SQL statement. This may return multiple {@code - * ResultSet}s. - *

- * Use the {@code getResultSet} or {@code getUpdateCount} methods to get the - * first result and {@code getMoreResults} to get any subsequent results. - * - * @param sql - * the SQL statement to execute - * @return {@code true} if the first result is a {@code ResultSet}, {@code - * false} if the first result is an update count or if there is no - * result. - * @throws SQLException - * if an error occurs accessing the database. - */ - public boolean execute(String sql) throws SQLException; - - /** - * Executes a supplied SQL statement. This may return multiple {@code - * ResultSet}s. This method allows control of whether auto-generated Keys - * should be made available for retrieval, if the SQL statement is an - * {@code INSERT} statement. - *

- * Use the {@code getResultSet} or {@code getUpdateCount} methods to get the - * first result and {@code getMoreResults} to get any subsequent results. - * - * @param sql - * the SQL statement to execute. - * @param autoGeneratedKeys - * a flag indicating whether to make auto generated keys - * available for retrieval. This parameter must be one of {@code - * Statement.NO_GENERATED_KEYS} or {@code - * Statement.RETURN_GENERATED_KEYS}. - * @return {@code true} if results exists and the first result is a {@code - * ResultSet}, {@code false} if the first result is an update count - * or if there is no result. - * @throws SQLException - * if an error occurs accessing the database. - */ - public boolean execute(String sql, int autoGeneratedKeys) - throws SQLException; - - /** - * Executes the supplied SQL statement. This may return multiple {@code - * ResultSet}s. This method allows retrieval of auto generated keys - * specified by the supplied array of column indexes, if the SQL statement - * is an {@code INSERT} statement. - *

- * Use the {@code getResultSet} or {@code getUpdateCount} methods to get the - * first result and {@code getMoreResults} to get any subsequent results. - * - * @param sql - * the SQL statement to execute. - * @param columnIndexes - * an array of indexes of the columns in the inserted row which - * should be made available for retrieval via the {@code - * getGeneratedKeys} method. - * @return {@code true} if the first result is a {@code ResultSet}, {@code - * false} if the first result is an update count or if there is no - * result. - * @throws SQLException - * if an error occurs accessing the database. - */ - public boolean execute(String sql, int[] columnIndexes) throws SQLException; - - /** - * Executes the supplied SQL statement. This may return multiple {@code - * ResultSet}s. This method allows retrieval of auto generated keys - * specified by the supplied array of column indexes, if the SQL statement - * is an {@code INSERT} statement. - *

- * Use the {@code getResultSet} or {@code getUpdateCount} methods to get the - * first result and {@code getMoreResults} to get any subsequent results. - * - * @param sql - * the SQL statement to execute. - * @param columnNames - * an array of column names in the inserted row which should be - * made available for retrieval via the {@code getGeneratedKeys} - * method. - * @return {@code true} if the first result is a {@code ResultSet}, {@code - * false} if the first result is an update count or if there is no - * result - * @throws SQLException - * if an error occurs accessing the database. - */ - public boolean execute(String sql, String[] columnNames) - throws SQLException; - - /** - * Submits a batch of SQL commands to the database. Returns an array of - * update counts, if all the commands execute successfully. - *

- * If one of the commands in the batch fails, this method can throw a - * {@link BatchUpdateException} and the JDBC driver may or may not process - * the remaining commands. The JDBC driver must behave consistently with the - * underlying database, following the "all or nothing" principle. If the - * driver continues processing, the array of results returned contains the - * same number of elements as there are commands in the batch, with a - * minimum of one of the elements having the {@code EXECUTE_FAILED} value. - * - * @return an array of update counts, with one entry for each command in the - * batch. The elements are ordered according to the order in which - * the commands were added to the batch. - *

- *

    - *
  1. If the value of an element is ≥ 0, the corresponding - * command completed successfully and the value is the update - * count (the number of rows in the database affected by the - * command) for that command.
  2. - *
  3. If the value is {@code SUCCESS_NO_INFO}, the command - * completed successfully but the number of rows affected is - * unknown. - *
  4. - *
  5. If the value is {@code EXECUTE_FAILED}, the command failed. - *
- * @throws SQLException - * if an error occurs accessing the database. - */ - public int[] executeBatch() throws SQLException; - - /** - * Executes a supplied SQL statement. Returns a single {@code ResultSet}. - * - * @param sql - * an SQL statement to execute. Typically a {@code SELECT} - * statement - * @return a {@code ResultSet} containing the data produced by the SQL - * statement. Never null. - * @throws SQLException - * if an error occurs accessing the database or if the statement - * produces anything other than a single {@code ResultSet}. - */ - public ResultSet executeQuery(String sql) throws SQLException; - - /** - * Executes the supplied SQL statement. The statement may be an {@code - * INSERT}, {@code UPDATE} or {@code DELETE} statement or a statement which - * returns nothing. - * - * @param sql - * an SQL statement to execute - an SQL {@code INSERT}, {@code - * UPDATE}, {@code DELETE} or a statement which returns nothing - * @return the count of updated rows, or 0 for a statement that returns - * nothing. - * @throws SQLException - * if an error occurs accessing the database or if the statement - * produces a {@code ResultSet}. - */ - public int executeUpdate(String sql) throws SQLException; - - /** - * Executes the supplied SQL statement. This method allows control of - * whether auto-generated Keys should be made available for retrieval. - * - * @param sql - * an SQL statement to execute - an SQL {@code INSERT}, {@code - * UPDATE}, {@code DELETE} or a statement which does not return - * anything. - * @param autoGeneratedKeys - * a flag that indicates whether to allow retrieval of auto - * generated keys. Parameter must be one of {@code - * Statement.RETURN_GENERATED_KEYS} or {@code - * Statement.NO_GENERATED_KEYS} - * @return the number of updated rows, or 0 if the statement returns - * nothing. - * @throws SQLException - * if an error occurs accessing the database or if the statement - * produces a {@code ResultSet}. - */ - public int executeUpdate(String sql, int autoGeneratedKeys) - throws SQLException; - - /** - * Executes the supplied SQL statement. This method allows retrieval of auto - * generated keys specified by the supplied array of column indexes. - * - * @param sql - * an SQL statement to execute - an SQL {@code INSERT}, {@code - * UPDATE}, {@code DELETE} or a statement which returns nothing - * @param columnIndexes - * an array of indexes of the columns in the inserted row which - * should be made available for retrieval via the {@code - * getGeneratedKeys} method. - * @return the count of updated rows, or 0 for a statement that returns - * nothing. - * @throws SQLException - * if an error occurs accessing the database or if the statement - * produces a {@code ResultSet}. - */ - public int executeUpdate(String sql, int[] columnIndexes) - throws SQLException; - - /** - * Executes the supplied SQL statement. This method allows retrieval of auto - * generated keys specified by the supplied array of column names. - * - * @param sql - * an SQL statement to execute - an SQL {@code INSERT}, {@code - * UPDATE}, {@code DELETE} or a statement which returns nothing - * @param columnNames - * an array of column names in the inserted row which should be - * made available for retrieval via the {@code getGeneratedKeys} - * method. - * @return the count of updated rows, or 0 for a statement that returns - * nothing. - * @throws SQLException - * if an error occurs accessing the database or if the statement - * produces a {@code ResultSet}. - */ - public int executeUpdate(String sql, String[] columnNames) - throws SQLException; - - /** - * Gets the {@code Connection} object which created this statement. - * - * @return the {@code Connection} through which this statement is - * transmitted to the database. - * @throws SQLException - * if an error occurs accessing the database. - */ - public Connection getConnection() throws SQLException; - - /** - * Gets the default direction for fetching rows for {@code ResultSet}s - * generated from this statement. - * - * @return the default fetch direction, one of: - *
    - *
  • ResultSet.FETCH_FORWARD
  • ResultSet.FETCH_REVERSE
  • - *
  • ResultSet.FETCH_UNKNOWN
  • - *
- * @throws SQLException - * if an error occurs accessing the database. - */ - public int getFetchDirection() throws SQLException; - - /** - * Gets the default number of rows for a fetch for the {@code ResultSet} - * objects returned from this statement. - * - * @return the default fetch size for {@code ResultSet}s produced by this - * statement. - * @throws SQLException - * if an error occurs accessing the database. - */ - public int getFetchSize() throws SQLException; - - /** - * Returns auto generated keys created by executing this statement. - * - * @return a {@code ResultSet} containing the auto generated keys - empty if - * no keys are generated by this statement. - * @throws SQLException - * if an error occurs accessing the database. - */ - public ResultSet getGeneratedKeys() throws SQLException; - - /** - * Gets the maximum number of bytes which can be returned as values from - * character and binary type columns in a {@code ResultSet} derived from this - * statement. This limit applies to {@code BINARY}, {@code VARBINARY}, - * {@code LONGVARBINARY}, {@code CHAR}, {@code VARCHAR}, and {@code - * LONGVARCHAR} types. Any data exceeding the maximum size is abandoned - * without announcement. - * - * @return the current size limit, where {@code 0} means that there is no - * limit. - * @throws SQLException - * if an error occurs accessing the database. - */ - public int getMaxFieldSize() throws SQLException; - - /** - * Gets the maximum number of rows that a {@code ResultSet} can contain when - * produced from this statement. If the limit is exceeded, the excess rows - * are discarded silently. - * - * @return the current row limit, where {@code 0} means that there is no - * limit. - * @throws SQLException - * if an error occurs accessing the database. - */ - public int getMaxRows() throws SQLException; - - /** - * Moves to this statement's next result. Returns {@code true} if it is a - * {@code ResultSet}. Any current {@code ResultSet} objects previously - * obtained with {@code getResultSet()} are closed implicitly. - * - * @return {@code true} if the next result is a {@code ResultSet}, {@code - * false} if the next result is not a {@code ResultSet} or if there - * are no more results. Note that if there is no more data, this - * method will return {@code false} and {@code getUpdateCount} will - * return -1. - * @throws SQLException - * if an error occurs accessing the database. - */ - public boolean getMoreResults() throws SQLException; - - /** - * Moves to this statement's next result. Returns {@code true} if the next - * result is a {@code ResultSet}. Any current {@code ResultSet} objects - * previously obtained with {@code getResultSet()} are handled as indicated - * by a supplied Flag parameter. - * - * @param current - * a flag indicating what to do with existing {@code ResultSet}s. - * This parameter must be one of {@code - * Statement.CLOSE_ALL_RESULTS}, {@code - * Statement.CLOSE_CURRENT_RESULT} or {@code - * Statement.KEEP_CURRENT_RESULT}. - * @return {@code true} if the next result exists and is a {@code ResultSet} - * , {@code false} if the next result is not a {@code ResultSet} or - * if there are no more results. Note that if there is no more data, - * this method will return {@code false} and {@code getUpdateCount} - * will return -1. - * @throws SQLException - * if an error occurs accessing the database. - */ - public boolean getMoreResults(int current) throws SQLException; - - /** - * Gets the timeout value for the statement's execution time. The JDBC - * driver will wait up to this value for the execution to complete - after - * the limit is exceeded an SQL {@code Exception} is thrown. - * - * @return the current query timeout value, where {@code 0} indicates that - * there is no current timeout. - * @throws SQLException - * if an error occurs accessing the database. - */ - public int getQueryTimeout() throws SQLException; - - /** - * Gets the current result. Should only be called once per result. - * - * @return the {@code ResultSet} for the current result. {@code null} if the - * result is an update count or if there are no more results. - * @throws SQLException - * if an error occurs accessing the database. - */ - public ResultSet getResultSet() throws SQLException; - - /** - * Gets the concurrency setting for {@code ResultSet} objects generated by - * this statement. - * - * @return {@code ResultSet.CONCUR_READ_ONLY} or {@code - * ResultSet.CONCUR_UPDATABLE}. - * @throws SQLException - * if an error occurs accessing the database. - */ - public int getResultSetConcurrency() throws SQLException; - - /** - * Gets the cursor hold setting for {@code ResultSet} objects generated by - * this statement. - * - * @return {@code ResultSet.HOLD_CURSORS_OVER_COMMIT} or {@code - * ResultSet.CLOSE_CURSORS_AT_COMMIT} - * @throws SQLException - * if there is an error while accessing the database. - */ - public int getResultSetHoldability() throws SQLException; - - /** - * Gets the {@code ResultSet} type setting for {@code ResultSet}s derived - * from this statement. - * - * @return {@code ResultSet.TYPE_FORWARD_ONLY} for a {@code ResultSet} where - * the cursor can only move forwards, {@code - * ResultSet.TYPE_SCROLL_INSENSITIVE} for a {@code ResultSet} which - * is scrollable but is not sensitive to changes made by others, - * {@code ResultSet.TYPE_SCROLL_SENSITIVE} for a {@code ResultSet} - * which is scrollable but is sensitive to changes made by others. - * @throws SQLException - * if there is an error accessing the database. - */ - public int getResultSetType() throws SQLException; - - /** - * Gets an update count for the current result if it is not a {@code - * ResultSet}. - * - * @return the current result as an update count. {@code -1} if the current - * result is a {@code ResultSet} or if there are no more results. - * @throws SQLException - * if an error occurs accessing the database. - */ - public int getUpdateCount() throws SQLException; - - /** - * Retrieves the first {@code SQLWarning} reported by calls on this - * statement. If there are multiple warnings, subsequent warnings are - * chained to the first one. The chain of warnings is cleared each time the - * statement is executed. - *

- * Warnings associated with reads from the {@code ResultSet} returned from - * executing the statement will be attached to the {@code ResultSet}, not the - * statement object. - * - * @return an SQLWarning, null if there are no warnings - * @throws SQLException - * if an error occurs accessing the database. - */ - public SQLWarning getWarnings() throws SQLException; - - /** - * Sets the SQL cursor name. This name is used by subsequent statement - * execute methods. - *

- * Cursor names must be unique within one Connection. - *

- * With the cursor name set, it can then be used in SQL positioned - * update or delete statements to determine the current row in a {@code - * ResultSet} generated from this statement. The positioned update or delete - * must be done with a different statement than this one. - * - * @param name - * the Cursor name as a string, - * @throws SQLException - * if an error occurs accessing the database. - */ - public void setCursorName(String name) throws SQLException; - - /** - * Sets Escape Processing mode. - *

- * If Escape Processing is on, the JDBC driver will do escape substitution - * on an SQL statement before sending it for execution. This does not apply - * to {@link PreparedStatement}s since they are processed when created, - * before this method can be called. - * - * @param enable - * {@code true} to set escape processing mode on, {@code - * false} to turn it off. - * @throws SQLException - * if an error occurs accessing the database. - */ - public void setEscapeProcessing(boolean enable) throws SQLException; - - /** - * Sets the fetch direction - a hint to the JDBC driver about the direction - * of processing of rows in {@code ResultSet}s created by this statement. - * The default fetch direction is {@code FETCH_FORWARD}. - * - * @param direction - * which fetch direction to use. This parameter should be one of - *

    - *
  • {@code ResultSet.FETCH_UNKNOWN}
  • - *
  • {@code ResultSet.FETCH_FORWARD}
  • - *
  • {@code ResultSet.FETCH_REVERSE}
  • - *
- * @throws SQLException - * if there is an error while accessing the database or if the - * fetch direction is unrecognized. - */ - public void setFetchDirection(int direction) throws SQLException; - - /** - * Sets the fetch size. This is a hint to the JDBC driver about how many - * rows should be fetched from the database when more are required by - * application processing. - * - * @param rows - * the number of rows that should be fetched. {@code 0} tells the driver - * to ignore the hint. Should be less than {@code getMaxRows} for - * this statement. Should not be negative. - * @throws SQLException - * if an error occurs accessing the database, or if the rows - * parameter is out of range. - */ - public void setFetchSize(int rows) throws SQLException; - - /** - * Sets the maximum number of bytes for {@code ResultSet} columns that - * contain character or binary values. This applies to {@code BINARY}, - * {@code VARBINARY}, {@code LONGVARBINARY}, {@code CHAR}, {@code VARCHAR}, - * and {@code LONGVARCHAR} fields. Any data exceeding the maximum size is - * abandoned without announcement. - * - * @param max - * the maximum field size in bytes. {@code 0} means "no limit". - * @throws SQLException - * if an error occurs accessing the database or the {@code max} - * value is < {@code 0}. - */ - public void setMaxFieldSize(int max) throws SQLException; - - /** - * Sets the maximum number of rows that any {@code ResultSet} can contain. - * If the number of rows exceeds this value, the additional rows are - * silently discarded. - * - * @param max - * the maximum number of rows. {@code 0} means "no limit". - * @throws SQLException - * if an error occurs accessing the database or if max < {@code - * 0}. - */ - public void setMaxRows(int max) throws SQLException; - - /** - * Sets the timeout, in seconds, for queries - how long the driver will - * allow for completion of a statement execution. If the timeout is - * exceeded, the query will throw an {@code SQLException}. - * - * @param seconds - * timeout in seconds. 0 means no timeout ("wait forever") - * @throws SQLException - * if an error occurs accessing the database or if seconds < - * {@code 0}. - */ - public void setQueryTimeout(int seconds) throws SQLException; - - /** - * Returns true if this statement has been closed, false otherwise. - */ - public boolean isClosed() throws SQLException; - - /** - * Hints whether this statement should be pooled. Defaults to false for {@code Statement}, - * but true for {@code CallableStatement} and {@code PreparedStatement}. Pool manager - * implementations may or may not honor this hint. - */ - public void setPoolable(boolean poolable) throws SQLException; - - /** - * Returns true if this statement is poolable, false otherwise. - */ - public boolean isPoolable() throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Struct.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Struct.java deleted file mode 100644 index af0d8d3991..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Struct.java +++ /dev/null @@ -1,68 +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 java.sql; - -import java.util.Map; - -/** - * An interface which provides facilities for manipulating an SQL structured type - * as a Java object. The {@code Struct} object has a value for each attribute of the SQL structured - * type. - */ -public interface Struct { - - /** - * Gets the SQL Type name of the SQL structured type that this {@code - * Struct} represents. - * - * @return the fully qualified name of SQL structured type. - * @throws SQLException - * if a database error occurs. - */ - public String getSQLTypeName() throws SQLException; - - /** - * Gets the values of the attributes of this SQL structured type. This - * method uses the type map associated with the {@link Connection} for - * customized type mappings. Where there is no entry in the type mapping - * which matches this structured type, the JDBC driver uses the standard - * mapping. - * - * @return an {@code Object} array containing the ordered attributes. - * @throws SQLException - * if a database error occurs. - */ - public Object[] getAttributes() throws SQLException; - - /** - * Gets the values of the attributes of this SQL structured type. This - * method uses the supplied type mapping to determine how to map SQL types - * to their corresponding Java objects. In the - * case where there is no entry in the type mapping which matches this - * structured type, the JDBC driver uses the default mapping. The {@code - * Connection} type map is never utilized by this method. - * - * @param theMap - * a Map describing how SQL Type names are mapped to classes. - * @return an Object array containing the ordered attributes,. - * @throws SQLException - * if a database error occurs. - */ - public Object[] getAttributes(Map> theMap) - throws SQLException; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Time.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Time.java deleted file mode 100644 index c6e2f20e7e..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Time.java +++ /dev/null @@ -1,247 +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 java.sql; - -import java.util.Date; - -/** - * Java representation of an SQL {@code TIME} value. Provides utilities to - * format and parse the time's representation as a String in JDBC escape format. - */ -public class Time extends Date { - - private static final long serialVersionUID = 8397324403548013681L; - - /** - * Constructs a {@code Time} object using the supplied values for Hour, - * Minute and Second. The Year, Month and - * Day elements of the {@code Time} object are set to the date - * of the Epoch (January 1, 1970). - *

- * Any attempt to access the Year, Month or Day - * elements of a {@code Time} object will result in an {@code - * IllegalArgumentException}. - *

- * The result is undefined if any argument is out of bounds. - * - * @deprecated Use the constructor {@link #Time(long)} instead. - * @param theHour - * a value in the range {@code [0,23]}. - * @param theMinute - * a value in the range {@code [0,59]}. - * @param theSecond - * a value in the range {@code [0,59]}. - */ - @SuppressWarnings("deprecation") - @Deprecated - public Time(int theHour, int theMinute, int theSecond) { - super(70, 0, 1, theHour, theMinute, theSecond); - } - - /** - * Constructs a {@code Time} object using a supplied time specified in - * milliseconds. - * - * @param theTime - * a {@code Time} specified in milliseconds since the - * Epoch (January 1st 1970, 00:00:00.000). - */ - public Time(long theTime) { - super(theTime); - } - - /** - * @deprecated This method is deprecated and must not be used. An SQL - * {@code Time} object does not have a date component. - * @return does not return anything. - * @throws IllegalArgumentException - * if this method is called. - */ - @SuppressWarnings("deprecation") - @Deprecated - @Override - public int getDate() { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. An SQL - * {@code Time} object does not have a day component. - * @return does not return anything. - * @throws IllegalArgumentException - * if this method is called. - */ - @SuppressWarnings("deprecation") - @Deprecated - @Override - public int getDay() { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. An SQL - * {@code Time} object does not have a month component. - * @return does not return anything. - * @throws IllegalArgumentException - * if this method is called. - */ - @SuppressWarnings("deprecation") - @Deprecated - @Override - public int getMonth() { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. An SQL - * {@code Time} object does not have a year component. - * @return does not return anything. - * @throws IllegalArgumentException - * if this method is called. - */ - @SuppressWarnings("deprecation") - @Deprecated - @Override - public int getYear() { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. An SQL - * {@code Time} object does not have a date component. - * @throws IllegalArgumentException - * if this method is called. - */ - @SuppressWarnings("deprecation") - @Deprecated - @Override - public void setDate(int i) { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. An SQL - * {@code Time} object does not have a month component. - * @throws IllegalArgumentException - * if this method is called. - */ - @SuppressWarnings("deprecation") - @Deprecated - @Override - public void setMonth(int i) { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * @deprecated This method is deprecated and must not be used. An SQL - * {@code Time} object does not have a year component. - * @throws IllegalArgumentException - * if this method is called. - */ - @SuppressWarnings("deprecation") - @Deprecated - @Override - public void setYear(int i) { - throw new IllegalArgumentException("unimplemented"); - } - - /** - * Sets the time for this {@code Time} object to the supplied milliseconds - * value. - * - * @param time - * A time value expressed as milliseconds since the Epoch. - * Negative values are milliseconds before the Epoch. The Epoch - * is January 1 1970, 00:00:00.000. - */ - @Override - public void setTime(long time) { - super.setTime(time); - } - - /** - * Formats the {@code Time} as a String in JDBC escape format: {@code - * hh:mm:ss}. - * - * @return A String representing the {@code Time} value in JDBC escape - * format: {@code HH:mm:ss} - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(8); - - format(getHours(), 2, sb); - sb.append(':'); - format(getMinutes(), 2, sb); - sb.append(':'); - format(getSeconds(), 2, sb); - - return sb.toString(); - } - - private static final String PADDING = "00"; - - /* - * Private method to format the time - */ - private void format(int date, int digits, StringBuilder sb) { - String str = String.valueOf(date); - if (digits - str.length() > 0) { - sb.append(PADDING.substring(0, digits - str.length())); - } - sb.append(str); - } - - /** - * Creates a {@code Time} object from a string holding a time represented in - * JDBC escape format: {@code hh:mm:ss}. - *

- * An exception occurs if the input string does not comply with this format. - * - * @param timeString - * A String representing the time value in JDBC escape format: - * {@code hh:mm:ss}. - * @return The {@code Time} object set to a time corresponding to the given - * time. - * @throws IllegalArgumentException - * if the supplied time string is not in JDBC escape format. - */ - public static Time valueOf(String timeString) { - if (timeString == null) { - throw new IllegalArgumentException("timeString == null"); - } - int firstIndex = timeString.indexOf(':'); - int secondIndex = timeString.indexOf(':', firstIndex + 1); - // secondIndex == -1 means none or only one separator '-' has been - // found. - // The string is separated into three parts by two separator characters, - // if the first or the third part is null string, we should throw - // IllegalArgumentException to follow RI - if (secondIndex == -1 || firstIndex == 0 - || secondIndex + 1 == timeString.length()) { - throw new IllegalArgumentException(); - } - // parse each part of the string - int hour = Integer.parseInt(timeString.substring(0, firstIndex)); - int minute = Integer.parseInt(timeString.substring(firstIndex + 1, - secondIndex)); - int second = Integer.parseInt(timeString.substring(secondIndex + 1, - timeString.length())); - return new Time(hour, minute, second); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Timestamp.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Timestamp.java deleted file mode 100644 index 7c4ca8526e..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Timestamp.java +++ /dev/null @@ -1,512 +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 java.sql; - -//import java.text.ParsePosition; -//import java.text.SimpleDateFormat; -import java.text.ParsePosition; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.regex.Pattern; - -/** - * A Java representation of the SQL {@code TIMESTAMP} type. It provides the - * capability of representing the SQL {@code TIMESTAMP} nanosecond value, in - * addition to the regular date/time value which has millisecond resolution. - *

- * The {@code Timestamp} class consists of a regular date/time value, where only - * the integral seconds value is stored, plus a nanoseconds value where the - * fractional seconds are stored. - *

- * The addition of the nanosecond value field to the {@code Timestamp} object - * makes it significantly different from the {@code java.util.Date} object which - * it extends. Users should be aware that {@code Timestamp} objects are not - * interchangable with {@code java.util.Date} objects when used outside the - * confines of the {@code java.sql} package. - * - * @see Date - * @see Time - * @see java.util.Date - */ -public class Timestamp extends Date { - - private static final long serialVersionUID = 2745179027874758501L; - - // The nanoseconds time value of the Timestamp - private int nanos; - - // The regex pattern of yyyy-MM-dd HH:mm:ss - private static final String TIME_FORMAT_REGEX = "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.*"; - - /** - * Returns a {@code Timestamp} corresponding to the time specified by the - * supplied values for Year, Month, Date, Hour, - * Minutes, Seconds and Nanoseconds. - * - * @deprecated Use the constructor {@link #Timestamp(long)} instead. - * @param theYear - * specified as the year minus 1900. - * @param theMonth - * specified as an integer in the range [0,11]. - * @param theDate - * specified as an integer in the range [1,31]. - * @param theHour - * specified as an integer in the range [0,23]. - * @param theMinute - * specified as an integer in the range [0,59]. - * @param theSecond - * specified as an integer in the range [0,59]. - * @param theNano - * which defines the nanosecond value of the timestamp specified - * as an integer in the range [0,999'999'999] - * @throws IllegalArgumentException - * if any of the parameters is out of range. - */ - @SuppressWarnings("deprecation") - @Deprecated - public Timestamp(int theYear, int theMonth, int theDate, int theHour, - int theMinute, int theSecond, int theNano) - throws IllegalArgumentException { - super(theYear, theMonth, theDate, theHour, theMinute, theSecond); - if (theNano < 0 || theNano > 999999999) { - throw new IllegalArgumentException("ns out of range: " + theNano); - } - nanos = theNano; - } - - /** - * Returns a {@code Timestamp} object corresponding to the time represented - * by a supplied time value. - * - * @param theTime - * a time value in the format of milliseconds since the Epoch - * (January 1 1970 00:00:00.000 GMT). - */ - public Timestamp(long theTime) { - super(theTime); - /* - * Now set the time for this Timestamp object - which deals with the - * nanosecond value as well as the base time - */ - setTimeImpl(theTime); - } - - /** - * Returns {@code true} if this timestamp object is later than the supplied - * timestamp, otherwise returns {@code false}. - * - * @param theTimestamp - * the timestamp to compare with this timestamp object. - * @return {@code true} if this {@code Timestamp} object is later than the - * supplied timestamp, {@code false} otherwise. - */ - public boolean after(Timestamp theTimestamp) { - long thisTime = this.getTime(); - long compareTime = theTimestamp.getTime(); - - // If the time value is later, the timestamp is later - if (thisTime > compareTime) { - return true; - } - // If the time value is earlier, the timestamp is not later - else if (thisTime < compareTime) { - return false; - } - /* - * Otherwise the time values are equal in which case the nanoseconds - * value determines whether this timestamp is later... - */ - else if (this.getNanos() > theTimestamp.getNanos()) { - return true; - } else { - return false; - } - } - - /** - * Returns {@code true} if this {@code Timestamp} object is earlier than the - * supplied timestamp, otherwise returns {@code false}. - * - * @param theTimestamp - * the timestamp to compare with this {@code Timestamp} object. - * @return {@code true} if this {@code Timestamp} object is earlier than the - * supplied timestamp, {@code false} otherwise. - */ - public boolean before(Timestamp theTimestamp) { - long thisTime = this.getTime(); - long compareTime = theTimestamp.getTime(); - - // If the time value is later, the timestamp is later - if (thisTime < compareTime) { - return true; - } - // If the time value is earlier, the timestamp is not later - else if (thisTime > compareTime) { - return false; - } - /* - * Otherwise the time values are equal in which case the nanoseconds - * value determines whether this timestamp is later... - */ - else if (this.getNanos() < theTimestamp.getNanos()) { - return true; - } else { - return false; - } - } - - /** - * Compares this {@code Timestamp} object with a supplied {@code Timestamp} - * object. - * - * @param theObject - * the timestamp to compare with this {@code Timestamp} object, - * passed as an {@code Object}. - * @return

- *
- * {@code 0} if the two {@code Timestamp} objects are equal in time - *
- *
- * a value {@code < 0} if this {@code Timestamp} object is before - * the supplied {@code Timestamp} and a value - *
- *
- * {@code > 0} if this {@code Timestamp} object is after the - * supplied {@code Timestamp} - *
- *
- * @throws ClassCastException - * if the supplied object is not a {@code Timestamp} object. - */ - @Override - public int compareTo(Date theObject) throws ClassCastException { - return this.compareTo((Timestamp) theObject); - } - - /** - * Compares this {@code Timestamp} object with a supplied {@code Timestamp} - * object. - * - * @param theTimestamp - * the timestamp to compare with this {@code Timestamp} object, - * passed in as a {@code Timestamp}. - * @return one of the following: - *
    - *
  • {@code 0}, if the two {@code Timestamp} objects are - * equal in time
  • - *
  • {@code < 0}, if this {@code Timestamp} object is before the - * supplied {@code Timestamp}
  • - *
  • {@code > 0}, if this {@code Timestamp} object is after the - * supplied {@code Timestamp}
  • - *
- */ - public int compareTo(Timestamp theTimestamp) { - int result = super.compareTo(theTimestamp); - if (result == 0) { - int thisNano = this.getNanos(); - int thatNano = theTimestamp.getNanos(); - if (thisNano > thatNano) { - return 1; - } else if (thisNano == thatNano) { - return 0; - } else { - return -1; - } - } - return result; - } - - /** - * Tests to see if this timestamp is equal to a supplied object. - * - * @param theObject - * the object to which this timestamp is compared. - * @return {@code true} if this {@code Timestamp} object is equal to the - * supplied {@code Timestamp} object
{@code false} if the object - * is not a {@code Timestamp} object or if the object is a {@code - * Timestamp} but represents a different instant in time. - */ - @Override - public boolean equals(Object theObject) { - if (theObject instanceof Timestamp) { - return equals((Timestamp) theObject); - } - return false; - } - - /** - * Tests to see if this timestamp is equal to a supplied timestamp. - * - * @param theTimestamp - * the timestamp to compare with this {@code Timestamp} object, - * passed as an {@code Object}. - * @return {@code true} if this {@code Timestamp} object is equal to the - * supplied {@code Timestamp} object, {@code false} otherwise. - */ - public boolean equals(Timestamp theTimestamp) { - if (theTimestamp == null) { - return false; - } - return (this.getTime() == theTimestamp.getTime()) - && (this.getNanos() == theTimestamp.getNanos()); - } - - /** - * Gets this {@code Timestamp}'s nanosecond value - * - * @return The timestamp's nanosecond value, an integer between 0 and - * 999,999,999. - */ - public int getNanos() { - return nanos; - } - - /** - * Returns the time represented by this {@code Timestamp} object, as a long - * value containing the number of milliseconds since the Epoch (January 1 - * 1970, 00:00:00.000 GMT). - * - * @return the number of milliseconds that have passed since January 1 1970, - * 00:00:00.000 GMT. - */ - @Override - public long getTime() { - long theTime = super.getTime(); - theTime = theTime + (nanos / 1000000); - return theTime; - } - - /** - * Sets the nanosecond value for this {@code Timestamp}. - * - * @param n - * number of nanoseconds. - * @throws IllegalArgumentException - * if number of nanoseconds smaller than 0 or greater than - * 999,999,999. - */ - public void setNanos(int n) throws IllegalArgumentException { - if ((n < 0) || (n > 999999999)) { - throw new IllegalArgumentException("Value out of range"); - } - nanos = n; - } - - /** - * Sets the time represented by this {@code Timestamp} object to the - * supplied time, defined as the number of milliseconds since the Epoch - * (January 1 1970, 00:00:00.000 GMT). - * - * @param theTime - * number of milliseconds since the Epoch (January 1 1970, - * 00:00:00.000 GMT). - */ - @Override - public void setTime(long theTime) { - setTimeImpl(theTime); - } - - private void setTimeImpl(long theTime) { - /* - * Deal with the nanoseconds value. The supplied time is in milliseconds - - * so we must extract the milliseconds value and multiply by 1000000 to - * get nanoseconds. Things are more complex if theTime value is - * negative, since then the time value is the time before the Epoch but - * the nanoseconds value of the Timestamp must be positive - so we must - * take the "raw" milliseconds value and subtract it from 1000 to get to - * the true nanoseconds value Simultaneously, recalculate the time value - * to the exact nearest second and reset the Date time value - */ - int milliseconds = (int) (theTime % 1000); - theTime = theTime - milliseconds; - if (milliseconds < 0) { - theTime = theTime - 1000; - milliseconds = 1000 + milliseconds; - } - super.setTime(theTime); - setNanos(milliseconds * 1000000); - } - - /** - * Returns the timestamp formatted as a String in the JDBC Timestamp Escape - * format, which is {@code "yyyy-MM-dd HH:mm:ss.nnnnnnnnn"}. - * - * @return A string representing the instant defined by the {@code - * Timestamp}, in JDBC Timestamp escape format. - */ - @SuppressWarnings("deprecation") - @Override - public String toString() { - StringBuilder sb = new StringBuilder(29); - - format((getYear() + 1900), 4, sb); - sb.append('-'); - format((getMonth() + 1), 2, sb); - sb.append('-'); - format(getDate(), 2, sb); - sb.append(' '); - format(getHours(), 2, sb); - sb.append(':'); - format(getMinutes(), 2, sb); - sb.append(':'); - format(getSeconds(), 2, sb); - sb.append('.'); - if (nanos == 0) { - sb.append('0'); - } else { - format(nanos, 9, sb); - while (sb.charAt(sb.length() - 1) == '0') { - sb.setLength(sb.length() - 1); - } - } - - return sb.toString(); - } - - private static final String PADDING = "000000000"; - - /* - * Private method to format the time - */ - private void format(int date, int digits, StringBuilder sb) { - String str = String.valueOf(date); - if (digits - str.length() > 0) { - sb.append(PADDING.substring(0, digits - str.length())); - } - sb.append(str); - } - - /** - * Creates a {@code Timestamp} object with a time value equal to the time - * specified by a supplied String holding the time in JDBC timestamp escape - * format, which is {@code "yyyy-MM-dd HH:mm:ss.nnnnnnnnn}" - * - * @param s - * the {@code String} containing a time in JDBC timestamp escape - * format. - * @return A {@code Timestamp} object with time value as defined by the - * supplied {@code String}. - * @throws IllegalArgumentException - * if the provided string is {@code null}. - */ - public static Timestamp valueOf(String s) throws IllegalArgumentException { - if (s == null) { - throw new IllegalArgumentException("Argument cannot be null"); - } - - // omit trailing whitespace - s = s.trim(); - if (!Pattern.matches(TIME_FORMAT_REGEX, s)) { - throw badTimestampString(s); - } - - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US); - ParsePosition pp = new ParsePosition(0); - - /* - * First parse out the yyyy-MM-dd HH:mm:ss component of the String into - * a Date object using the SimpleDateFormat. This should stop after the - * seconds value, according to the definition of SimpleDateFormat.parse, - * with the ParsePosition indicating the index of the "." which should - * precede the nanoseconds value - */ - Date theDate; - try { - theDate = df.parse(s, pp); - } catch (Exception e) { - throw badTimestampString(s); - } - - if (theDate == null) { - throw badTimestampString(s); - } - - /* - * If we get here, the Date part of the string was OK - now for the - * nanoseconds value. Strictly, this requires the remaining part of the - * String to look like ".nnnnnnnnn". However, we accept anything with a - * '.' followed by 1 to 9 digits - we also accept nothing (no fractions - * of a second). Anything else is interpreted as incorrect format which - * will generate an IllegalArgumentException - */ - int position = pp.getIndex(); - int remaining = s.length() - position; - int theNanos; - - if (remaining == 0) { - // First, allow for the case where no fraction of a second is given: - theNanos = 0; - } else { - /* - * Case where fraction of a second is specified: Require 1 character - * plus the "." in the remaining part of the string... - */ - if ((s.length() - position) < ".n".length()) { - throw badTimestampString(s); - } - - /* - * If we're strict, we should not allow any EXTRA characters after - * the 9 digits - */ - if ((s.length() - position) > ".nnnnnnnnn".length()) { - throw badTimestampString(s); - } - - // Require the next character to be a "." - if (s.charAt(position) != '.') { - throw new NumberFormatException("Bad input string format: expected '.' not '" + - s.charAt(position) + "' in \"" + s + "\""); - } - // Get the length of the number string - need to account for the '.' - int nanoLength = s.length() - position - 1; - - // Get the 9 characters following the "." as an integer - String theNanoString = s.substring(position + 1, position + 1 - + nanoLength); - /* - * We must adjust for the cases where the nanos String was not 9 - * characters long by padding out with zeros - */ - theNanoString = theNanoString + "000000000"; - theNanoString = theNanoString.substring(0, 9); - - try { - theNanos = Integer.parseInt(theNanoString); - } catch (Exception e) { - // If we get here, the string was not a number - throw badTimestampString(s); - } - } - - if (theNanos < 0 || theNanos > 999999999) { - throw badTimestampString(s); - } - - Timestamp theTimestamp = new Timestamp(theDate.getTime()); - theTimestamp.setNanos(theNanos); - - return theTimestamp; - } - - private static IllegalArgumentException badTimestampString(String s) { - throw new IllegalArgumentException("Timestamp format must be " + - "yyyy-MM-dd HH:mm:ss.fffffffff; was '" + s + "'"); - } -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Types.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Types.java deleted file mode 100644 index 353fe67fe5..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Types.java +++ /dev/null @@ -1,214 +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 java.sql; - -/** - * A class which defines constants used to identify generic SQL types, also - * called JDBC types. The type constant values are equivalent to those defined - * by X/OPEN. - */ -public class Types { - - /* - * Private constructor to prevent instantiation. - */ - private Types() { - } - - /** - * The type code that identifies the SQL type {@code ARRAY}. - */ - public static final int ARRAY = 2003; - - /** - * The type code that identifies the SQL type {@code BIGINT}. - */ - public static final int BIGINT = -5; - - /** - * The type code that identifies the SQL type {@code BINARY}. - */ - public static final int BINARY = -2; - - /** - * The type code that identifies the SQL type {@code BIT}. - */ - public static final int BIT = -7; - - /** - * The type code that identifies the SQL type {@code BLOB}. - */ - public static final int BLOB = 2004; - - /** - * The type code that identifies the SQL type {@code BOOLEAN}. - */ - public static final int BOOLEAN = 16; - - /** - * The type code that identifies the SQL type {@code CHAR}. - */ - public static final int CHAR = 1; - - /** - * The type code that identifies the SQL type {@code CLOB}. - */ - public static final int CLOB = 2005; - - /** - * The type code that identifies the SQL type {@code DATALINK}. - */ - public static final int DATALINK = 70; - - /** - * The type code that identifies the SQL type {@code DATE}. - */ - public static final int DATE = 91; - - /** - * The type code that identifies the SQL type {@code DECIMAL}. - */ - public static final int DECIMAL = 3; - - /** - * The type code that identifies the SQL type {@code DISTINCT}. - */ - public static final int DISTINCT = 2001; - - /** - * The type code that identifies the SQL type {@code DOUBLE}. - */ - public static final int DOUBLE = 8; - - /** - * The type code that identifies the SQL type {@code FLOAT}. - */ - public static final int FLOAT = 6; - - /** - * The type code that identifies the SQL type {@code INTEGER}. - */ - public static final int INTEGER = 4; - - /** - * The type code that identifies the SQL type {@code JAVA_OBJECT}. - */ - public static final int JAVA_OBJECT = 2000; - - /** - * The type code that identifies the SQL type {@code LONGVARBINARY}. - */ - public static final int LONGVARBINARY = -4; - - /** - * The type code that identifies the SQL type {@code LONGVARCHAR}. - */ - public static final int LONGVARCHAR = -1; - - /** - * The type code that identifies the SQL type {@code NULL}. - */ - public static final int NULL = 0; - - /** - * The type code that identifies the SQL type {@code NUMERIC}. - */ - public static final int NUMERIC = 2; - - /** - * The type code that identifies that the SQL type is database specific and - * is mapped to a Java object, accessed via the methods - * {@code getObject} and {@code setObject}. - */ - public static final int OTHER = 1111; - - /** - * The type code that identifies the SQL type {@code REAL}. - */ - public static final int REAL = 7; - - /** - * The type code that identifies the SQL type {@code REF}. - */ - public static final int REF = 2006; - - /** - * The type code that identifies the SQL type {@code SMALLINT}. - */ - public static final int SMALLINT = 5; - - /** - * The type code that identifies the SQL type {@code STRUCT}. - */ - public static final int STRUCT = 2002; - - /** - * The type code that identifies the SQL type {@code TIME}. - */ - public static final int TIME = 92; - - /** - * The type code that identifies the SQL type {@code TIMESTAMP}. - */ - public static final int TIMESTAMP = 93; - - /** - * The type code that identifies the SQL type {@code TINYINT}. - */ - public static final int TINYINT = -6; - - /** - * The type code that identifies the SQL type {@code VARBINARY}. - */ - public static final int VARBINARY = -3; - - /** - * The type code that identifies the SQL type {@code VARCHAR}. - */ - public static final int VARCHAR = 12; - - /** - * The type code that identifies the SQL type ROWID. - */ - public static final int ROWID = -8; - - /** - * The type code that identifies the SQL type NCHAR. - */ - public static final int NCHAR = -15; - - /** - * The type code that identifies the SQL type NVARCHAR. - */ - public static final int NVARCHAR = -9; - - /** - * The type code that identifies the SQL type LONGNVARCHAR. - */ - public static final int LONGNVARCHAR = -16; - - /** - * The type code that identifies the SQL type NCLOB. - */ - public static final int NCLOB = 2011; - - /** - * The type code that identifies the SQL type SQLXML. - */ - public static final int SQLXML = 2009; -} diff --git a/jre_emul/android/libcore/luni/src/main/java/java/sql/Wrapper.java b/jre_emul/android/libcore/luni/src/main/java/java/sql/Wrapper.java deleted file mode 100644 index a300c71c21..0000000000 --- a/jre_emul/android/libcore/luni/src/main/java/java/sql/Wrapper.java +++ /dev/null @@ -1,52 +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 java.sql; - -/** - * This class is an actual usage of the wrapper pattern for JDBC classes. - * Developers can get the delegate instance when the instance may be a proxy - * class. - * - * @since 1.6 - */ -public interface Wrapper { - - /** - * Returns an object that implements the given interface. If the caller is - * not a wrapper, a SQLException will be thrown. - * - * @param iface - - * the class that defines the interface - * @return - an object that implements the interface - * @throws SQLException - - * if there is no object implementing the specific interface - */ - T unwrap(Class iface) throws SQLException; - - /** - * If the caller is a wrapper of the class or implements the given - * interface, the methods return false and vice versa. - * - * @param iface - - * the class that defines the interface - * @return - true if the instance implements the interface - * @throws SQLException - - * when an error occurs when judges the object - */ - boolean isWrapperFor(Class iface) throws SQLException; -} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Array.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Array.java new file mode 100644 index 0000000000..584c63ffaf --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Array.java @@ -0,0 +1,366 @@ +/* + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The mapping in the Java programming language for the SQL type + * ARRAY. + * By default, an Array value is a transaction-duration + * reference to an SQL ARRAY value. By default, an Array + * object is implemented using an SQL LOCATOR(array) internally, which + * means that an Array object contains a logical pointer + * to the data in the SQL ARRAY value rather + * than containing the ARRAY value's data. + *

+ * The Array interface provides methods for bringing an SQL + * ARRAY value's data to the client as either an array or a + * ResultSet object. + * If the elements of the SQL ARRAY + * are a UDT, they may be custom mapped. To create a custom mapping, + * a programmer must do two things: + *

    + *
  • create a class that implements the {@link SQLData} + * interface for the UDT to be custom mapped. + *
  • make an entry in a type map that contains + *
      + *
    • the fully-qualified SQL type name of the UDT + *
    • the Class object for the class implementing + * SQLData + *
    + *
+ *

+ * When a type map with an entry for + * the base type is supplied to the methods getArray + * and getResultSet, the mapping + * it contains will be used to map the elements of the ARRAY value. + * If no type map is supplied, which would typically be the case, + * the connection's type map is used by default. + * If the connection's type map or a type map supplied to a method has no entry + * for the base type, the elements are mapped according to the standard mapping. + *

+ * All methods on the Array interface must be fully implemented if the + * JDBC driver supports the data type. + * + * @since 1.2 + */ + +public interface Array { + + /** + * Retrieves the SQL type name of the elements in + * the array designated by this Array object. + * If the elements are a built-in type, it returns + * the database-specific type name of the elements. + * If the elements are a user-defined type (UDT), + * this method returns the fully-qualified SQL type name. + * + * @return a String that is the database-specific + * name for a built-in base type; or the fully-qualified SQL type + * name for a base type that is a UDT + * @exception SQLException if an error occurs while attempting + * to access the type name + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + String getBaseTypeName() throws SQLException; + + /** + * Retrieves the JDBC type of the elements in the array designated + * by this Array object. + * + * @return a constant from the class {@link java.sql.Types} that is + * the type code for the elements in the array designated by this + * Array object + * @exception SQLException if an error occurs while attempting + * to access the base type + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + int getBaseType() throws SQLException; + + /** + * Retrieves the contents of the SQL ARRAY value designated + * by this + * Array object in the form of an array in the Java + * programming language. This version of the method getArray + * uses the type map associated with the connection for customizations of + * the type mappings. + *

+ * Note: When getArray is used to materialize + * a base type that maps to a primitive data type, then it is + * implementation-defined whether the array returned is an array of + * that primitive data type or an array of Object. + * + * @return an array in the Java programming language that contains + * the ordered elements of the SQL ARRAY value + * designated by this Array object + * @exception SQLException if an error occurs while attempting to + * access the array + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object getArray() throws SQLException; + + /** + * Retrieves the contents of the SQL ARRAY value designated by this + * Array object. + * This method uses + * the specified map for type map customizations + * unless the base type of the array does not match a user-defined + * type in map, in which case it + * uses the standard mapping. This version of the method + * getArray uses either the given type map or the standard mapping; + * it never uses the type map associated with the connection. + *

+ * Note: When getArray is used to materialize + * a base type that maps to a primitive data type, then it is + * implementation-defined whether the array returned is an array of + * that primitive data type or an array of Object. + * + * @param map a java.util.Map object that contains mappings + * of SQL type names to classes in the Java programming language + * @return an array in the Java programming language that contains the ordered + * elements of the SQL array designated by this object + * @exception SQLException if an error occurs while attempting to + * access the array + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object getArray(java.util.Map> map) throws SQLException; + + /** + * Retrieves a slice of the SQL ARRAY + * value designated by this Array object, beginning with the + * specified index and containing up to count + * successive elements of the SQL array. This method uses the type map + * associated with the connection for customizations of the type mappings. + *

+ * Note: When getArray is used to materialize + * a base type that maps to a primitive data type, then it is + * implementation-defined whether the array returned is an array of + * that primitive data type or an array of Object. + * + * @param index the array index of the first element to retrieve; + * the first element is at index 1 + * @param count the number of successive SQL array elements to retrieve + * @return an array containing up to count consecutive elements + * of the SQL array, beginning with element index + * @exception SQLException if an error occurs while attempting to + * access the array + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object getArray(long index, int count) throws SQLException; + + /** + * Retreives a slice of the SQL ARRAY value + * designated by this Array object, beginning with the specified + * index and containing up to count + * successive elements of the SQL array. + *

+ * This method uses + * the specified map for type map customizations + * unless the base type of the array does not match a user-defined + * type in map, in which case it + * uses the standard mapping. This version of the method + * getArray uses either the given type map or the standard mapping; + * it never uses the type map associated with the connection. + *

+ * Note: When getArray is used to materialize + * a base type that maps to a primitive data type, then it is + * implementation-defined whether the array returned is an array of + * that primitive data type or an array of Object. + * + * @param index the array index of the first element to retrieve; + * the first element is at index 1 + * @param count the number of successive SQL array elements to + * retrieve + * @param map a java.util.Map object + * that contains SQL type names and the classes in + * the Java programming language to which they are mapped + * @return an array containing up to count + * consecutive elements of the SQL ARRAY value designated by this + * Array object, beginning with element + * index + * @exception SQLException if an error occurs while attempting to + * access the array + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object getArray(long index, int count, java.util.Map> map) + throws SQLException; + + /** + * Retrieves a result set that contains the elements of the SQL + * ARRAY value + * designated by this Array object. If appropriate, + * the elements of the array are mapped using the connection's type + * map; otherwise, the standard mapping is used. + *

+ * The result set contains one row for each array element, with + * two columns in each row. The second column stores the element + * value; the first column stores the index into the array for + * that element (with the first array element being at index 1). + * The rows are in ascending order corresponding to + * the order of the indices. + * + * @return a {@link ResultSet} object containing one row for each + * of the elements in the array designated by this Array + * object, with the rows in ascending order based on the indices. + * @exception SQLException if an error occurs while attempting to + * access the array + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + ResultSet getResultSet () throws SQLException; + + /** + * Retrieves a result set that contains the elements of the SQL + * ARRAY value designated by this Array object. + * This method uses + * the specified map for type map customizations + * unless the base type of the array does not match a user-defined + * type in map, in which case it + * uses the standard mapping. This version of the method + * getResultSet uses either the given type map or the standard mapping; + * it never uses the type map associated with the connection. + *

+ * The result set contains one row for each array element, with + * two columns in each row. The second column stores the element + * value; the first column stores the index into the array for + * that element (with the first array element being at index 1). + * The rows are in ascending order corresponding to + * the order of the indices. + * + * @param map contains the mapping of SQL user-defined types to + * classes in the Java programming language + * @return a ResultSet object containing one row for each + * of the elements in the array designated by this Array + * object, with the rows in ascending order based on the indices. + * @exception SQLException if an error occurs while attempting to + * access the array + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + ResultSet getResultSet (java.util.Map> map) throws SQLException; + + /** + * Retrieves a result set holding the elements of the subarray that + * starts at index index and contains up to + * count successive elements. This method uses + * the connection's type map to map the elements of the array if + * the map contains an entry for the base type. Otherwise, the + * standard mapping is used. + *

+ * The result set has one row for each element of the SQL array + * designated by this object, with the first row containing the + * element at index index. The result set has + * up to count rows in ascending order based on the + * indices. Each row has two columns: The second column stores + * the element value; the first column stores the index into the + * array for that element. + * + * @param index the array index of the first element to retrieve; + * the first element is at index 1 + * @param count the number of successive SQL array elements to retrieve + * @return a ResultSet object containing up to + * count consecutive elements of the SQL array + * designated by this Array object, starting at + * index index. + * @exception SQLException if an error occurs while attempting to + * access the array + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + ResultSet getResultSet(long index, int count) throws SQLException; + + /** + * Retrieves a result set holding the elements of the subarray that + * starts at index index and contains up to + * count successive elements. + * This method uses + * the specified map for type map customizations + * unless the base type of the array does not match a user-defined + * type in map, in which case it + * uses the standard mapping. This version of the method + * getResultSet uses either the given type map or the standard mapping; + * it never uses the type map associated with the connection. + *

+ * The result set has one row for each element of the SQL array + * designated by this object, with the first row containing the + * element at index index. The result set has + * up to count rows in ascending order based on the + * indices. Each row has two columns: The second column stores + * the element value; the first column stroes the index into the + * array for that element. + * + * @param index the array index of the first element to retrieve; + * the first element is at index 1 + * @param count the number of successive SQL array elements to retrieve + * @param map the Map object that contains the mapping + * of SQL type names to classes in the Java(tm) programming language + * @return a ResultSet object containing up to + * count consecutive elements of the SQL array + * designated by this Array object, starting at + * index index. + * @exception SQLException if an error occurs while attempting to + * access the array + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + ResultSet getResultSet (long index, int count, + java.util.Map> map) + throws SQLException; + /** + * This method frees the Array object and releases the resources that + * it holds. The object is invalid once the free + * method is called. + *

+ * After free has been called, any attempt to invoke a + * method other than free will result in a SQLException + * being thrown. If free is called multiple times, the subsequent + * calls to free are treated as a no-op. + *

+ * + * @throws SQLException if an error occurs releasing + * the Array's resources + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void free() throws SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/BatchUpdateException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/BatchUpdateException.java new file mode 100644 index 0000000000..19742c82fa --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/BatchUpdateException.java @@ -0,0 +1,340 @@ +/* + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.util.Arrays; + +/** + * The subclass of {@link SQLException} thrown when an error + * occurs during a batch update operation. In addition to the + * information provided by {@link SQLException}, a + * BatchUpdateException provides the update + * counts for all commands that were executed successfully during the + * batch update, that is, all commands that were executed before the error + * occurred. The order of elements in an array of update counts + * corresponds to the order in which commands were added to the batch. + *

+ * After a command in a batch update fails to execute properly + * and a BatchUpdateException is thrown, the driver + * may or may not continue to process the remaining commands in + * the batch. If the driver continues processing after a failure, + * the array returned by the method + * BatchUpdateException.getUpdateCounts will have + * an element for every command in the batch rather than only + * elements for the commands that executed successfully before + * the error. In the case where the driver continues processing + * commands, the array element for any command + * that failed is Statement.EXECUTE_FAILED. + *

+ * @since 1.2 + */ + +public class BatchUpdateException extends SQLException { + + /** + * Constructs a BatchUpdateException object initialized with a given + * reason, SQLState, vendorCode and + * updateCounts. + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @param reason a description of the error + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode an exception code used by a particular + * database vendor + * @param updateCounts an array of int, with each element + * indicating the update count, Statement.SUCCESS_NO_INFO or + * Statement.EXECUTE_FAILED for each SQL command in + * the batch for JDBC drivers that continue processing + * after a command failure; an update count or + * Statement.SUCCESS_NO_INFO for each SQL command in the batch + * prior to the failure for JDBC drivers that stop processing after a command + * failure + * @since 1.2 + */ + public BatchUpdateException( String reason, String SQLState, int vendorCode, + int[] updateCounts ) { + super(reason, SQLState, vendorCode); + this.updateCounts = (updateCounts == null) ? null : Arrays.copyOf(updateCounts, updateCounts.length); + } + + /** + * Constructs a BatchUpdateException object initialized with a given + * reason, SQLState and + * updateCounts. + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * + * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param updateCounts an array of int, with each element + * indicating the update count, Statement.SUCCESS_NO_INFO or + * Statement.EXECUTE_FAILED for each SQL command in + * the batch for JDBC drivers that continue processing + * after a command failure; an update count or + * Statement.SUCCESS_NO_INFO for each SQL command in the batch + * prior to the failure for JDBC drivers that stop processing after a command + * failure + * @since 1.2 + */ + public BatchUpdateException(String reason, String SQLState, + int[] updateCounts) { + this(reason, SQLState, 0, updateCounts); + } + + /** + * Constructs a BatchUpdateException object initialized with a given + * reason and updateCounts. + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The + * SQLState is initialized to null + * and the vender code is initialized to 0. + *

+ * + * + * @param reason a description of the exception + * @param updateCounts an array of int, with each element + * indicating the update count, Statement.SUCCESS_NO_INFO or + * Statement.EXECUTE_FAILED for each SQL command in + * the batch for JDBC drivers that continue processing + * after a command failure; an update count or + * Statement.SUCCESS_NO_INFO for each SQL command in the batch + * prior to the failure for JDBC drivers that stop processing after a command + * failure + * @since 1.2 + */ + public BatchUpdateException(String reason, int[] updateCounts) { + this(reason, null, 0, updateCounts); + } + + /** + * Constructs a BatchUpdateException object initialized with a given + * updateCounts. + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The reason + * and SQLState are initialized to null and the vendor code + * is initialized to 0. + *

+ * + * @param updateCounts an array of int, with each element + * indicating the update count, Statement.SUCCESS_NO_INFO or + * Statement.EXECUTE_FAILED for each SQL command in + * the batch for JDBC drivers that continue processing + * after a command failure; an update count or + * Statement.SUCCESS_NO_INFO for each SQL command in the batch + * prior to the failure for JDBC drivers that stop processing after a command + * failure + * @since 1.2 + */ + public BatchUpdateException(int[] updateCounts) { + this(null, null, 0, updateCounts); + } + + /** + * Constructs a BatchUpdateException object. + * The reason, SQLState and updateCounts + * are initialized to null and the vendor code is initialized to 0. + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @since 1.2 + */ + public BatchUpdateException() { + this(null, null, 0, null); + } + + /** + * Constructs a BatchUpdateException object initialized with + * a given cause. + * The SQLState and updateCounts + * are initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + * @param cause the underlying reason for this SQLException + * (which is saved for later retrieval by the getCause() method); + * may be null indicating the cause is non-existent or unknown. + * @since 1.6 + */ + public BatchUpdateException(Throwable cause) { + this((cause == null ? null : cause.toString()), null, 0, null, cause); + } + + /** + * Constructs a BatchUpdateException object initialized with a + * given cause and updateCounts. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + * + * @param updateCounts an array of int, with each element + * indicating the update count, Statement.SUCCESS_NO_INFO or + * Statement.EXECUTE_FAILED for each SQL command in + * the batch for JDBC drivers that continue processing + * after a command failure; an update count or + * Statement.SUCCESS_NO_INFO for each SQL command in the batch + * prior to the failure for JDBC drivers that stop processing after a command + * failure + * @param cause the underlying reason for this SQLException + * (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public BatchUpdateException(int []updateCounts , Throwable cause) { + this((cause == null ? null : cause.toString()), null, 0, updateCounts, cause); + } + + /** + * Constructs a BatchUpdateException object initialized with + * a given reason, cause + * and updateCounts. The SQLState is initialized + * to null and the vendor code is initialized to 0. + * + * @param reason a description of the exception + * @param updateCounts an array of int, with each element + *indicating the update count, Statement.SUCCESS_NO_INFO or + * Statement.EXECUTE_FAILED for each SQL command in + * the batch for JDBC drivers that continue processing + * after a command failure; an update count or + * Statement.SUCCESS_NO_INFO for each SQL command in the batch + * prior to the failure for JDBC drivers that stop processing after a command + * failure + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); + * may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public BatchUpdateException(String reason, int []updateCounts, Throwable cause) { + this(reason, null, 0, updateCounts, cause); + } + + /** + * Constructs a BatchUpdateException object initialized with + * a given reason, SQLState,cause, and + * updateCounts. The vendor code is initialized to 0. + * + * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param updateCounts an array of int, with each element + * indicating the update count, Statement.SUCCESS_NO_INFO or + * Statement.EXECUTE_FAILED for each SQL command in + * the batch for JDBC drivers that continue processing + * after a command failure; an update count or + * Statement.SUCCESS_NO_INFO for each SQL command in the batch + * prior to the failure for JDBC drivers that stop processing after a command + * failure + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); + * may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public BatchUpdateException(String reason, String SQLState, + int []updateCounts, Throwable cause) { + this(reason, SQLState, 0, updateCounts, cause); + } + + /** + * Constructs a BatchUpdateException object initialized with + * a given reason, SQLState, vendorCode + * cause and updateCounts. + * + * @param reason a description of the error + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode an exception code used by a particular + * database vendor + * @param updateCounts an array of int, with each element + *indicating the update count, Statement.SUCCESS_NO_INFO or + * Statement.EXECUTE_FAILED for each SQL command in + * the batch for JDBC drivers that continue processing + * after a command failure; an update count or + * Statement.SUCCESS_NO_INFO for each SQL command in the batch + * prior to the failure for JDBC drivers that stop processing after a command + * failure + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); + * may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public BatchUpdateException(String reason, String SQLState, int vendorCode, + int []updateCounts,Throwable cause) { + super(reason, SQLState, vendorCode, cause); + this.updateCounts = (updateCounts == null) ? null : Arrays.copyOf(updateCounts, updateCounts.length); + } + + /** + * Retrieves the update count for each update statement in the batch + * update that executed successfully before this exception occurred. + * A driver that implements batch updates may or may not continue to + * process the remaining commands in a batch when one of the commands + * fails to execute properly. If the driver continues processing commands, + * the array returned by this method will have as many elements as + * there are commands in the batch; otherwise, it will contain an + * update count for each command that executed successfully before + * the BatchUpdateException was thrown. + *

+ * The possible return values for this method were modified for + * the Java 2 SDK, Standard Edition, version 1.3. This was done to + * accommodate the new option of continuing to process commands + * in a batch update after a BatchUpdateException object + * has been thrown. + * + * @return an array of int containing the update counts + * for the updates that were executed successfully before this error + * occurred. Or, if the driver continues to process commands after an + * error, one of the following for every command in the batch: + *

    + *
  1. an update count + *
  2. Statement.SUCCESS_NO_INFO to indicate that the command + * executed successfully but the number of rows affected is unknown + *
  3. Statement.EXECUTE_FAILED to indicate that the command + * failed to execute successfully + *
+ * @since 1.3 + */ + public int[] getUpdateCounts() { + return (updateCounts == null) ? null : Arrays.copyOf(updateCounts, updateCounts.length); + } + + /** + * The array that describes the outcome of a batch execution. + * @serial + * @since 1.2 + */ + private final int[] updateCounts; + + private static final long serialVersionUID = 5977529877145521757L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Blob.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Blob.java new file mode 100644 index 0000000000..46b7c2f201 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Blob.java @@ -0,0 +1,304 @@ +/* + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.io.InputStream; + +/** + * The representation (mapping) in + * the JavaTM programming + * language of an SQL + * BLOB value. An SQL BLOB is a built-in type + * that stores a Binary Large Object as a column value in a row of + * a database table. By default drivers implement Blob using + * an SQL locator(BLOB), which means that a + * Blob object contains a logical pointer to the + * SQL BLOB data rather than the data itself. + * A Blob object is valid for the duration of the + * transaction in which is was created. + * + *

Methods in the interfaces {@link ResultSet}, + * {@link CallableStatement}, and {@link PreparedStatement}, such as + * getBlob and setBlob allow a programmer to + * access an SQL BLOB value. + * The Blob interface provides methods for getting the + * length of an SQL BLOB (Binary Large Object) value, + * for materializing a BLOB value on the client, and for + * determining the position of a pattern of bytes within a + * BLOB value. In addition, this interface has methods for updating + * a BLOB value. + *

+ * All methods on the Blob interface must be fully implemented if the + * JDBC driver supports the data type. + * + * @since 1.2 + */ + +public interface Blob { + + /** + * Returns the number of bytes in the BLOB value + * designated by this Blob object. + * @return length of the BLOB in bytes + * @exception SQLException if there is an error accessing the + * length of the BLOB + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + long length() throws SQLException; + + /** + * Retrieves all or part of the BLOB + * value that this Blob object represents, as an array of + * bytes. This byte array contains up to length + * consecutive bytes starting at position pos. + * + * @param pos the ordinal position of the first byte in the + * BLOB value to be extracted; the first byte is at + * position 1 + * @param length the number of consecutive bytes to be copied; the value + * for length must be 0 or greater + * @return a byte array containing up to length + * consecutive bytes from the BLOB value designated + * by this Blob object, starting with the + * byte at position pos + * @exception SQLException if there is an error accessing the + * BLOB value; if pos is less than 1 or length is + * less than 0 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setBytes + * @since 1.2 + */ + byte[] getBytes(long pos, int length) throws SQLException; + + /** + * Retrieves the BLOB value designated by this + * Blob instance as a stream. + * + * @return a stream containing the BLOB data + * @exception SQLException if there is an error accessing the + * BLOB value + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setBinaryStream + * @since 1.2 + */ + java.io.InputStream getBinaryStream () throws SQLException; + + /** + * Retrieves the byte position at which the specified byte array + * pattern begins within the BLOB + * value that this Blob object represents. The + * search for pattern begins at position + * start. + * + * @param pattern the byte array for which to search + * @param start the position at which to begin searching; the + * first position is 1 + * @return the position at which the pattern appears, else -1 + * @exception SQLException if there is an error accessing the + * BLOB or if start is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + long position(byte pattern[], long start) throws SQLException; + + /** + * Retrieves the byte position in the BLOB value + * designated by this Blob object at which + * pattern begins. The search begins at position + * start. + * + * @param pattern the Blob object designating + * the BLOB value for which to search + * @param start the position in the BLOB value + * at which to begin searching; the first position is 1 + * @return the position at which the pattern begins, else -1 + * @exception SQLException if there is an error accessing the + * BLOB value or if start is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + long position(Blob pattern, long start) throws SQLException; + + // -------------------------- JDBC 3.0 ----------------------------------- + + /** + * Writes the given array of bytes to the BLOB value that + * this Blob object represents, starting at position + * pos, and returns the number of bytes written. + * The array of bytes will overwrite the existing bytes + * in the Blob object starting at the position + * pos. If the end of the Blob value is reached + * while writing the array of bytes, then the length of the Blob + * value will be increased to accomodate the extra bytes. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the BLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param pos the position in the BLOB object at which + * to start writing; the first position is 1 + * @param bytes the array of bytes to be written to the BLOB + * value that this Blob object represents + * @return the number of bytes written + * @exception SQLException if there is an error accessing the + * BLOB value or if pos is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getBytes + * @since 1.4 + */ + int setBytes(long pos, byte[] bytes) throws SQLException; + + /** + * Writes all or part of the given byte array to the + * BLOB value that this Blob object represents + * and returns the number of bytes written. + * Writing starts at position pos in the BLOB + * value; len bytes from the given byte array are written. + * The array of bytes will overwrite the existing bytes + * in the Blob object starting at the position + * pos. If the end of the Blob value is reached + * while writing the array of bytes, then the length of the Blob + * value will be increased to accomodate the extra bytes. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the BLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param pos the position in the BLOB object at which + * to start writing; the first position is 1 + * @param bytes the array of bytes to be written to this BLOB + * object + * @param offset the offset into the array bytes at which + * to start reading the bytes to be set + * @param len the number of bytes to be written to the BLOB + * value from the array of bytes bytes + * @return the number of bytes written + * @exception SQLException if there is an error accessing the + * BLOB value or if pos is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getBytes + * @since 1.4 + */ + int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException; + + /** + * Retrieves a stream that can be used to write to the BLOB + * value that this Blob object represents. The stream begins + * at position pos. + * The bytes written to the stream will overwrite the existing bytes + * in the Blob object starting at the position + * pos. If the end of the Blob value is reached + * while writing to the stream, then the length of the Blob + * value will be increased to accomodate the extra bytes. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the BLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param pos the position in the BLOB value at which + * to start writing; the first position is 1 + * @return a java.io.OutputStream object to which data can + * be written + * @exception SQLException if there is an error accessing the + * BLOB value or if pos is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getBinaryStream + * @since 1.4 + */ + java.io.OutputStream setBinaryStream(long pos) throws SQLException; + + /** + * Truncates the BLOB value that this Blob + * object represents to be len bytes in length. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the BLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param len the length, in bytes, to which the BLOB value + * that this Blob object represents should be truncated + * @exception SQLException if there is an error accessing the + * BLOB value or if len is less than 0 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void truncate(long len) throws SQLException; + + /** + * This method frees the Blob object and releases the resources that + * it holds. The object is invalid once the free + * method is called. + *

+ * After free has been called, any attempt to invoke a + * method other than free will result in a SQLException + * being thrown. If free is called multiple times, the subsequent + * calls to free are treated as a no-op. + *

+ * + * @throws SQLException if an error occurs releasing + * the Blob's resources + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void free() throws SQLException; + + /** + * Returns an InputStream object that contains a partial Blob value, + * starting with the byte specified by pos, which is length bytes in length. + * + * @param pos the offset to the first byte of the partial value to be retrieved. + * The first byte in the Blob is at position 1 + * @param length the length in bytes of the partial value to be retrieved + * @return InputStream through which the partial Blob value can be read. + * @throws SQLException if pos is less than 1 or if pos is greater than the number of bytes + * in the Blob or if pos + length is greater than the number of bytes + * in the Blob + * + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + InputStream getBinaryStream(long pos, long length) throws SQLException; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/CallableStatement.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/CallableStatement.java new file mode 100644 index 0000000000..2ac3adf1a7 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/CallableStatement.java @@ -0,0 +1,2440 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.io.Reader; +import java.io.InputStream; + +/** + * The interface used to execute SQL stored procedures. The JDBC API + * provides a stored procedure SQL escape syntax that allows stored procedures + * to be called in a standard way for all RDBMSs. This escape syntax has one + * form that includes a result parameter and one that does not. If used, the result + * parameter must be registered as an OUT parameter. The other parameters + * can be used for input, output or both. Parameters are referred to + * sequentially, by number, with the first parameter being 1. + *

+ *   {?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
+ *   {call <procedure-name>[(<arg1>,<arg2>, ...)]}
+ * 
+ *

+ * IN parameter values are set using the set methods inherited from + * {@link PreparedStatement}. The type of all OUT parameters must be + * registered prior to executing the stored procedure; their values + * are retrieved after execution via the get methods provided here. + *

+ * A CallableStatement can return one {@link ResultSet} object or + * multiple ResultSet objects. Multiple + * ResultSet objects are handled using operations + * inherited from {@link Statement}. + *

+ * For maximum portability, a call's ResultSet objects and + * update counts should be processed prior to getting the values of output + * parameters. + *

+ * + * @see Connection#prepareCall + * @see ResultSet + */ + +public interface CallableStatement extends PreparedStatement { + + /** + * Registers the OUT parameter in ordinal position + * parameterIndex to the JDBC type + * sqlType. All OUT parameters must be registered + * before a stored procedure is executed. + *

+ * The JDBC type specified by sqlType for an OUT + * parameter determines the Java type that must be used + * in the get method to read the value of that parameter. + *

+ * If the JDBC type expected to be returned to this output parameter + * is specific to this particular database, sqlType + * should be java.sql.Types.OTHER. The method + * {@link #getObject} retrieves the value. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @param sqlType the JDBC type code defined by java.sql.Types. + * If the parameter is of JDBC type NUMERIC + * or DECIMAL, the version of + * registerOutParameter that accepts a scale value + * should be used. + * + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if sqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type + * @see Types + */ + void registerOutParameter(int parameterIndex, int sqlType) + throws SQLException; + + /** + * Registers the parameter in ordinal position + * parameterIndex to be of JDBC type + * sqlType. All OUT parameters must be registered + * before a stored procedure is executed. + *

+ * The JDBC type specified by sqlType for an OUT + * parameter determines the Java type that must be used + * in the get method to read the value of that parameter. + *

+ * This version of registerOutParameter should be + * used when the parameter is of JDBC type NUMERIC + * or DECIMAL. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @param sqlType the SQL type code defined by java.sql.Types. + * @param scale the desired number of digits to the right of the + * decimal point. It must be greater than or equal to zero. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if sqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type + * @see Types + */ + void registerOutParameter(int parameterIndex, int sqlType, int scale) + throws SQLException; + + /** + * Retrieves whether the last OUT parameter read had the value of + * SQL NULL. Note that this method should be called only after + * calling a getter method; otherwise, there is no value to use in + * determining whether it is null or not. + * + * @return true if the last parameter read was SQL + * NULL; false otherwise + * @exception SQLException if a database access error occurs or + * this method is called on a closed CallableStatement + */ + boolean wasNull() throws SQLException; + + /** + * Retrieves the value of the designated JDBC CHAR, + * VARCHAR, or LONGVARCHAR parameter as a + * String in the Java programming language. + *

+ * For the fixed-length type JDBC CHAR, + * the String object + * returned has exactly the same value the SQL + * CHAR value had in the + * database, including any padding added by the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, + * the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setString + */ + String getString(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC BIT + * or BOOLEAN parameter as a + * boolean in the Java programming language. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, + * the result is false. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setBoolean + */ + boolean getBoolean(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC TINYINT parameter + * as a byte in the Java programming language. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is 0. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setByte + */ + byte getByte(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC SMALLINT parameter + * as a short in the Java programming language. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is 0. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setShort + */ + short getShort(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC INTEGER parameter + * as an int in the Java programming language. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is 0. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setInt + */ + int getInt(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC BIGINT parameter + * as a long in the Java programming language. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is 0. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setLong + */ + long getLong(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC FLOAT parameter + * as a float in the Java programming language. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is 0. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setFloat + */ + float getFloat(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC DOUBLE parameter as a double + * in the Java programming language. + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is 0. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setDouble + */ + double getDouble(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC NUMERIC parameter as a + * java.math.BigDecimal object with scale digits to + * the right of the decimal point. + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @param scale the number of digits to the right of the decimal point + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @deprecated use getBigDecimal(int parameterIndex) + * or getBigDecimal(String parameterName) + * @see #setBigDecimal + */ + BigDecimal getBigDecimal(int parameterIndex, int scale) + throws SQLException; + + /** + * Retrieves the value of the designated JDBC BINARY or + * VARBINARY parameter as an array of byte + * values in the Java programming language. + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setBytes + */ + byte[] getBytes(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC DATE parameter as a + * java.sql.Date object. + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setDate + */ + java.sql.Date getDate(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC TIME parameter as a + * java.sql.Time object. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setTime + */ + java.sql.Time getTime(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC TIMESTAMP parameter as a + * java.sql.Timestamp object. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setTimestamp + */ + java.sql.Timestamp getTimestamp(int parameterIndex) + throws SQLException; + + //---------------------------------------------------------------------- + // Advanced features: + + + /** + * Retrieves the value of the designated parameter as an Object + * in the Java programming language. If the value is an SQL NULL, + * the driver returns a Java null. + *

+ * This method returns a Java object whose type corresponds to the JDBC + * type that was registered for this parameter using the method + * registerOutParameter. By registering the target JDBC + * type as java.sql.Types.OTHER, this method can be used + * to read database-specific abstract data types. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return A java.lang.Object holding the OUT parameter value + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see Types + * @see #setObject + */ + Object getObject(int parameterIndex) throws SQLException; + + + //--------------------------JDBC 2.0----------------------------- + + /** + * Retrieves the value of the designated JDBC NUMERIC parameter as a + * java.math.BigDecimal object with as many digits to the + * right of the decimal point as the value contains. + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value in full precision. If the value is + * SQL NULL, the result is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setBigDecimal + * @since 1.2 + */ + BigDecimal getBigDecimal(int parameterIndex) throws SQLException; + + /** + * Returns an object representing the value of OUT parameter + * parameterIndex and uses map for the custom + * mapping of the parameter value. + *

+ * This method returns a Java object whose type corresponds to the + * JDBC type that was registered for this parameter using the method + * registerOutParameter. By registering the target + * JDBC type as java.sql.Types.OTHER, this method can + * be used to read database-specific abstract data types. + * @param parameterIndex the first parameter is 1, the second is 2, and so on + * @param map the mapping from SQL type names to Java classes + * @return a java.lang.Object holding the OUT parameter value + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setObject + * @since 1.2 + */ + Object getObject(int parameterIndex, java.util.Map> map) + throws SQLException; + + /** + * Retrieves the value of the designated JDBC REF(<structured-type>) + * parameter as a {@link java.sql.Ref} object in the Java programming language. + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @return the parameter value as a Ref object in the + * Java programming language. If the value was SQL NULL, the value + * null is returned. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Ref getRef (int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC BLOB parameter as a + * {@link java.sql.Blob} object in the Java programming language. + * @param parameterIndex the first parameter is 1, the second is 2, and so on + * @return the parameter value as a Blob object in the + * Java programming language. If the value was SQL NULL, the value + * null is returned. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Blob getBlob (int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC CLOB parameter as a + * java.sql.Clob object in the Java programming language. + * @param parameterIndex the first parameter is 1, the second is 2, and + * so on + * @return the parameter value as a Clob object in the + * Java programming language. If the value was SQL NULL, the + * value null is returned. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Clob getClob (int parameterIndex) throws SQLException; + + /** + * + * Retrieves the value of the designated JDBC ARRAY parameter as an + * {@link java.sql.Array} object in the Java programming language. + * @param parameterIndex the first parameter is 1, the second is 2, and + * so on + * @return the parameter value as an Array object in + * the Java programming language. If the value was SQL NULL, the + * value null is returned. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Array getArray (int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC DATE parameter as a + * java.sql.Date object, using + * the given Calendar object + * to construct the date. + * With a Calendar object, the driver + * can calculate the date taking into account a custom timezone and locale. + * If no Calendar object is specified, the driver uses the + * default timezone and locale. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @param cal the Calendar object the driver will use + * to construct the date + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setDate + * @since 1.2 + */ + java.sql.Date getDate(int parameterIndex, Calendar cal) + throws SQLException; + + /** + * Retrieves the value of the designated JDBC TIME parameter as a + * java.sql.Time object, using + * the given Calendar object + * to construct the time. + * With a Calendar object, the driver + * can calculate the time taking into account a custom timezone and locale. + * If no Calendar object is specified, the driver uses the + * default timezone and locale. + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @param cal the Calendar object the driver will use + * to construct the time + * @return the parameter value; if the value is SQL NULL, the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setTime + * @since 1.2 + */ + java.sql.Time getTime(int parameterIndex, Calendar cal) + throws SQLException; + + /** + * Retrieves the value of the designated JDBC TIMESTAMP parameter as a + * java.sql.Timestamp object, using + * the given Calendar object to construct + * the Timestamp object. + * With a Calendar object, the driver + * can calculate the timestamp taking into account a custom timezone and locale. + * If no Calendar object is specified, the driver uses the + * default timezone and locale. + * + * + * @param parameterIndex the first parameter is 1, the second is 2, + * and so on + * @param cal the Calendar object the driver will use + * to construct the timestamp + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #setTimestamp + * @since 1.2 + */ + java.sql.Timestamp getTimestamp(int parameterIndex, Calendar cal) + throws SQLException; + + + /** + * Registers the designated output parameter. + * This version of + * the method registerOutParameter + * should be used for a user-defined or REF output parameter. Examples + * of user-defined types include: STRUCT, DISTINCT, + * JAVA_OBJECT, and named array types. + *

+ * All OUT parameters must be registered + * before a stored procedure is executed. + *

For a user-defined parameter, the fully-qualified SQL + * type name of the parameter should also be given, while a REF + * parameter requires that the fully-qualified type name of the + * referenced type be given. A JDBC driver that does not need the + * type code and type name information may ignore it. To be portable, + * however, applications should always provide these values for + * user-defined and REF parameters. + * + * Although it is intended for user-defined and REF parameters, + * this method may be used to register a parameter of any JDBC type. + * If the parameter does not have a user-defined or REF type, the + * typeName parameter is ignored. + * + *

Note: When reading the value of an out parameter, you + * must use the getter method whose Java type corresponds to the + * parameter's registered SQL type. + * + * @param parameterIndex the first parameter is 1, the second is 2,... + * @param sqlType a value from {@link java.sql.Types} + * @param typeName the fully-qualified name of an SQL structured type + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if sqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type + * @see Types + * @since 1.2 + */ + void registerOutParameter (int parameterIndex, int sqlType, String typeName) + throws SQLException; + + //--------------------------JDBC 3.0----------------------------- + + /** + * Registers the OUT parameter named + * parameterName to the JDBC type + * sqlType. All OUT parameters must be registered + * before a stored procedure is executed. + *

+ * The JDBC type specified by sqlType for an OUT + * parameter determines the Java type that must be used + * in the get method to read the value of that parameter. + *

+ * If the JDBC type expected to be returned to this output parameter + * is specific to this particular database, sqlType + * should be java.sql.Types.OTHER. The method + * {@link #getObject} retrieves the value. + * @param parameterName the name of the parameter + * @param sqlType the JDBC type code defined by java.sql.Types. + * If the parameter is of JDBC type NUMERIC + * or DECIMAL, the version of + * registerOutParameter that accepts a scale value + * should be used. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if sqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type or if the JDBC driver does not support + * this method + * @since 1.4 + * @see Types + */ + void registerOutParameter(String parameterName, int sqlType) + throws SQLException; + + /** + * Registers the parameter named + * parameterName to be of JDBC type + * sqlType. All OUT parameters must be registered + * before a stored procedure is executed. + *

+ * The JDBC type specified by sqlType for an OUT + * parameter determines the Java type that must be used + * in the get method to read the value of that parameter. + *

+ * This version of registerOutParameter should be + * used when the parameter is of JDBC type NUMERIC + * or DECIMAL. + * + * @param parameterName the name of the parameter + * @param sqlType SQL type code defined by java.sql.Types. + * @param scale the desired number of digits to the right of the + * decimal point. It must be greater than or equal to zero. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if sqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type or if the JDBC driver does not support + * this method + * @since 1.4 + * @see Types + */ + void registerOutParameter(String parameterName, int sqlType, int scale) + throws SQLException; + + /** + * Registers the designated output parameter. This version of + * the method registerOutParameter + * should be used for a user-named or REF output parameter. Examples + * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and + * named array types. + *

+ * All OUT parameters must be registered + * before a stored procedure is executed. + *

+ * For a user-named parameter the fully-qualified SQL + * type name of the parameter should also be given, while a REF + * parameter requires that the fully-qualified type name of the + * referenced type be given. A JDBC driver that does not need the + * type code and type name information may ignore it. To be portable, + * however, applications should always provide these values for + * user-named and REF parameters. + * + * Although it is intended for user-named and REF parameters, + * this method may be used to register a parameter of any JDBC type. + * If the parameter does not have a user-named or REF type, the + * typeName parameter is ignored. + * + *

Note: When reading the value of an out parameter, you + * must use the getXXX method whose Java type XXX corresponds to the + * parameter's registered SQL type. + * + * @param parameterName the name of the parameter + * @param sqlType a value from {@link java.sql.Types} + * @param typeName the fully-qualified name of an SQL structured type + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if sqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type or if the JDBC driver does not support + * this method + * @see Types + * @since 1.4 + */ + void registerOutParameter (String parameterName, int sqlType, String typeName) + throws SQLException; + + /** + * Retrieves the value of the designated JDBC DATALINK parameter as a + * java.net.URL object. + * + * @param parameterIndex the first parameter is 1, the second is 2,... + * @return a java.net.URL object that represents the + * JDBC DATALINK value used as the designated + * parameter + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs, + * this method is called on a closed CallableStatement, + * or if the URL being returned is + * not a valid URL on the Java platform + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setURL + * @since 1.4 + */ + java.net.URL getURL(int parameterIndex) throws SQLException; + + /** + * Sets the designated parameter to the given java.net.URL object. + * The driver converts this to an SQL DATALINK value when + * it sends it to the database. + * + * @param parameterName the name of the parameter + * @param val the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs; + * this method is called on a closed CallableStatement + * or if a URL is malformed + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getURL + * @since 1.4 + */ + void setURL(String parameterName, java.net.URL val) throws SQLException; + + /** + * Sets the designated parameter to SQL NULL. + * + *

Note: You must specify the parameter's SQL type. + * + * @param parameterName the name of the parameter + * @param sqlType the SQL type code defined in java.sql.Types + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void setNull(String parameterName, int sqlType) throws SQLException; + + /** + * Sets the designated parameter to the given Java boolean value. + * The driver converts this + * to an SQL BIT or BOOLEAN value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @see #getBoolean + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void setBoolean(String parameterName, boolean x) throws SQLException; + + /** + * Sets the designated parameter to the given Java byte value. + * The driver converts this + * to an SQL TINYINT value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getByte + * @since 1.4 + */ + void setByte(String parameterName, byte x) throws SQLException; + + /** + * Sets the designated parameter to the given Java short value. + * The driver converts this + * to an SQL SMALLINT value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getShort + * @since 1.4 + */ + void setShort(String parameterName, short x) throws SQLException; + + /** + * Sets the designated parameter to the given Java int value. + * The driver converts this + * to an SQL INTEGER value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getInt + * @since 1.4 + */ + void setInt(String parameterName, int x) throws SQLException; + + /** + * Sets the designated parameter to the given Java long value. + * The driver converts this + * to an SQL BIGINT value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getLong + * @since 1.4 + */ + void setLong(String parameterName, long x) throws SQLException; + + /** + * Sets the designated parameter to the given Java float value. + * The driver converts this + * to an SQL FLOAT value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getFloat + * @since 1.4 + */ + void setFloat(String parameterName, float x) throws SQLException; + + /** + * Sets the designated parameter to the given Java double value. + * The driver converts this + * to an SQL DOUBLE value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getDouble + * @since 1.4 + */ + void setDouble(String parameterName, double x) throws SQLException; + + /** + * Sets the designated parameter to the given + * java.math.BigDecimal value. + * The driver converts this to an SQL NUMERIC value when + * it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getBigDecimal + * @since 1.4 + */ + void setBigDecimal(String parameterName, BigDecimal x) throws SQLException; + + /** + * Sets the designated parameter to the given Java String value. + * The driver converts this + * to an SQL VARCHAR or LONGVARCHAR value + * (depending on the argument's + * size relative to the driver's limits on VARCHAR values) + * when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getString + * @since 1.4 + */ + void setString(String parameterName, String x) throws SQLException; + + /** + * Sets the designated parameter to the given Java array of bytes. + * The driver converts this to an SQL VARBINARY or + * LONGVARBINARY (depending on the argument's size relative + * to the driver's limits on VARBINARY values) when it sends + * it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getBytes + * @since 1.4 + */ + void setBytes(String parameterName, byte x[]) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Date value + * using the default time zone of the virtual machine that is running + * the application. + * The driver converts this + * to an SQL DATE value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getDate + * @since 1.4 + */ + void setDate(String parameterName, java.sql.Date x) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Time value. + * The driver converts this + * to an SQL TIME value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getTime + * @since 1.4 + */ + void setTime(String parameterName, java.sql.Time x) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Timestamp value. + * The driver + * converts this to an SQL TIMESTAMP value when it sends it to the + * database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getTimestamp + * @since 1.4 + */ + void setTimestamp(String parameterName, java.sql.Timestamp x) + throws SQLException; + + /** + * Sets the designated parameter to the given input stream, which will have + * the specified number of bytes. + * When a very large ASCII value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.InputStream. Data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from ASCII to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterName the name of the parameter + * @param x the Java input stream that contains the ASCII parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void setAsciiStream(String parameterName, java.io.InputStream x, int length) + throws SQLException; + + /** + * Sets the designated parameter to the given input stream, which will have + * the specified number of bytes. + * When a very large binary value is input to a LONGVARBINARY + * parameter, it may be more practical to send it via a + * java.io.InputStream object. The data will be read from the stream + * as needed until end-of-file is reached. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterName the name of the parameter + * @param x the java input stream which contains the binary parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void setBinaryStream(String parameterName, java.io.InputStream x, + int length) throws SQLException; + + /** + * Sets the value of the designated parameter with the given object. The second + * argument must be an object type; for integral values, the + * java.lang equivalent objects should be used. + * + *

The given Java object will be converted to the given targetSqlType + * before being sent to the database. + * + * If the object has a custom mapping (is of a class implementing the + * interface SQLData), + * the JDBC driver should call the method SQLData.writeSQL to write it + * to the SQL data stream. + * If, on the other hand, the object is of a class implementing + * Ref, Blob, Clob, NClob, + * Struct, java.net.URL, + * or Array, the driver should pass it to the database as a + * value of the corresponding SQL type. + *

+ * Note that this method may be used to pass datatabase- + * specific abstract data types. + * + * @param parameterName the name of the parameter + * @param x the object containing the input parameter value + * @param targetSqlType the SQL type (as defined in java.sql.Types) to be + * sent to the database. The scale argument may further qualify this type. + * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, + * this is the number of digits after the decimal point. For all other + * types, this value will be ignored. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if targetSqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type + * @see Types + * @see #getObject + * @since 1.4 + */ + void setObject(String parameterName, Object x, int targetSqlType, int scale) + throws SQLException; + + /** + * Sets the value of the designated parameter with the given object. + * This method is like the method setObject + * above, except that it assumes a scale of zero. + * + * @param parameterName the name of the parameter + * @param x the object containing the input parameter value + * @param targetSqlType the SQL type (as defined in java.sql.Types) to be + * sent to the database + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if targetSqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type + * @see #getObject + * @since 1.4 + */ + void setObject(String parameterName, Object x, int targetSqlType) + throws SQLException; + + /** + * Sets the value of the designated parameter with the given object. + * The second parameter must be of type Object; therefore, the + * java.lang equivalent objects should be used for built-in types. + * + *

The JDBC specification specifies a standard mapping from + * Java Object types to SQL types. The given argument + * will be converted to the corresponding SQL type before being + * sent to the database. + *

Note that this method may be used to pass datatabase- + * specific abstract data types, by using a driver-specific Java + * type. + * + * If the object is of a class implementing the interface SQLData, + * the JDBC driver should call the method SQLData.writeSQL + * to write it to the SQL data stream. + * If, on the other hand, the object is of a class implementing + * Ref, Blob, Clob, NClob, + * Struct, java.net.URL, + * or Array, the driver should pass it to the database as a + * value of the corresponding SQL type. + *

+ * This method throws an exception if there is an ambiguity, for example, if the + * object is of a class implementing more than one of the interfaces named above. + *

+ *Note: Not all databases allow for a non-typed Null to be sent to + * the backend. For maximum portability, the setNull or the + * setObject(String parameterName, Object x, int sqlType) + * method should be used + * instead of setObject(String parameterName, Object x). + *

+ * @param parameterName the name of the parameter + * @param x the object containing the input parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs, + * this method is called on a closed CallableStatement or if the given + * Object parameter is ambiguous + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getObject + * @since 1.4 + */ + void setObject(String parameterName, Object x) throws SQLException; + + + /** + * Sets the designated parameter to the given Reader + * object, which is the given number of characters long. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterName the name of the parameter + * @param reader the java.io.Reader object that + * contains the UNICODE data used as the designated parameter + * @param length the number of characters in the stream + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void setCharacterStream(String parameterName, + java.io.Reader reader, + int length) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Date value, + * using the given Calendar object. The driver uses + * the Calendar object to construct an SQL DATE value, + * which the driver then sends to the database. With a + * a Calendar object, the driver can calculate the date + * taking into account a custom timezone. If no + * Calendar object is specified, the driver uses the default + * timezone, which is that of the virtual machine running the application. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @param cal the Calendar object the driver will use + * to construct the date + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getDate + * @since 1.4 + */ + void setDate(String parameterName, java.sql.Date x, Calendar cal) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Time value, + * using the given Calendar object. The driver uses + * the Calendar object to construct an SQL TIME value, + * which the driver then sends to the database. With a + * a Calendar object, the driver can calculate the time + * taking into account a custom timezone. If no + * Calendar object is specified, the driver uses the default + * timezone, which is that of the virtual machine running the application. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @param cal the Calendar object the driver will use + * to construct the time + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getTime + * @since 1.4 + */ + void setTime(String parameterName, java.sql.Time x, Calendar cal) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Timestamp value, + * using the given Calendar object. The driver uses + * the Calendar object to construct an SQL TIMESTAMP value, + * which the driver then sends to the database. With a + * a Calendar object, the driver can calculate the timestamp + * taking into account a custom timezone. If no + * Calendar object is specified, the driver uses the default + * timezone, which is that of the virtual machine running the application. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @param cal the Calendar object the driver will use + * to construct the timestamp + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getTimestamp + * @since 1.4 + */ + void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal) + throws SQLException; + + /** + * Sets the designated parameter to SQL NULL. + * This version of the method setNull should + * be used for user-defined types and REF type parameters. Examples + * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and + * named array types. + * + *

Note: To be portable, applications must give the + * SQL type code and the fully-qualified SQL type name when specifying + * a NULL user-defined or REF parameter. In the case of a user-defined type + * the name is the type name of the parameter itself. For a REF + * parameter, the name is the type name of the referenced type. + *

+ * Although it is intended for user-defined and Ref parameters, + * this method may be used to set a null parameter of any JDBC type. + * If the parameter does not have a user-defined or REF type, the given + * typeName is ignored. + * + * + * @param parameterName the name of the parameter + * @param sqlType a value from java.sql.Types + * @param typeName the fully-qualified name of an SQL user-defined type; + * ignored if the parameter is not a user-defined type or + * SQL REF value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void setNull (String parameterName, int sqlType, String typeName) + throws SQLException; + + /** + * Retrieves the value of a JDBC CHAR, VARCHAR, + * or LONGVARCHAR parameter as a String in + * the Java programming language. + *

+ * For the fixed-length type JDBC CHAR, + * the String object + * returned has exactly the same value the SQL + * CHAR value had in the + * database, including any padding added by the database. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setString + * @since 1.4 + */ + String getString(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC BIT or BOOLEAN + * parameter as a + * boolean in the Java programming language. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, the result + * is false. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setBoolean + * @since 1.4 + */ + boolean getBoolean(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC TINYINT parameter as a byte + * in the Java programming language. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, the result + * is 0. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setByte + * @since 1.4 + */ + byte getByte(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC SMALLINT parameter as a short + * in the Java programming language. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, the result + * is 0. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setShort + * @since 1.4 + */ + short getShort(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC INTEGER parameter as an int + * in the Java programming language. + * + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, + * the result is 0. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setInt + * @since 1.4 + */ + int getInt(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC BIGINT parameter as a long + * in the Java programming language. + * + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, + * the result is 0. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setLong + * @since 1.4 + */ + long getLong(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC FLOAT parameter as a float + * in the Java programming language. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, + * the result is 0. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setFloat + * @since 1.4 + */ + float getFloat(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC DOUBLE parameter as a double + * in the Java programming language. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, + * the result is 0. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setDouble + * @since 1.4 + */ + double getDouble(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC BINARY or VARBINARY + * parameter as an array of byte values in the Java + * programming language. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, the result is + * null. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setBytes + * @since 1.4 + */ + byte[] getBytes(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC DATE parameter as a + * java.sql.Date object. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setDate + * @since 1.4 + */ + java.sql.Date getDate(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC TIME parameter as a + * java.sql.Time object. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setTime + * @since 1.4 + */ + java.sql.Time getTime(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC TIMESTAMP parameter as a + * java.sql.Timestamp object. + * @param parameterName the name of the parameter + * @return the parameter value. If the value is SQL NULL, the result + * is null. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setTimestamp + * @since 1.4 + */ + java.sql.Timestamp getTimestamp(String parameterName) throws SQLException; + + /** + * Retrieves the value of a parameter as an Object in the Java + * programming language. If the value is an SQL NULL, the + * driver returns a Java null. + *

+ * This method returns a Java object whose type corresponds to the JDBC + * type that was registered for this parameter using the method + * registerOutParameter. By registering the target JDBC + * type as java.sql.Types.OTHER, this method can be used + * to read database-specific abstract data types. + * @param parameterName the name of the parameter + * @return A java.lang.Object holding the OUT parameter value. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see Types + * @see #setObject + * @since 1.4 + */ + Object getObject(String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC NUMERIC parameter as a + * java.math.BigDecimal object with as many digits to the + * right of the decimal point as the value contains. + * @param parameterName the name of the parameter + * @return the parameter value in full precision. If the value is + * SQL NULL, the result is null. + * @exception SQLExceptionif parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setBigDecimal + * @since 1.4 + */ + BigDecimal getBigDecimal(String parameterName) throws SQLException; + + /** + * Returns an object representing the value of OUT parameter + * parameterName and uses map for the custom + * mapping of the parameter value. + *

+ * This method returns a Java object whose type corresponds to the + * JDBC type that was registered for this parameter using the method + * registerOutParameter. By registering the target + * JDBC type as java.sql.Types.OTHER, this method can + * be used to read database-specific abstract data types. + * @param parameterName the name of the parameter + * @param map the mapping from SQL type names to Java classes + * @return a java.lang.Object holding the OUT parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setObject + * @since 1.4 + */ + Object getObject(String parameterName, java.util.Map> map) + throws SQLException; + + /** + * Retrieves the value of a JDBC REF(<structured-type>) + * parameter as a {@link java.sql.Ref} object in the Java programming language. + * + * @param parameterName the name of the parameter + * @return the parameter value as a Ref object in the + * Java programming language. If the value was SQL NULL, + * the value null is returned. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + Ref getRef (String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC BLOB parameter as a + * {@link java.sql.Blob} object in the Java programming language. + * + * @param parameterName the name of the parameter + * @return the parameter value as a Blob object in the + * Java programming language. If the value was SQL NULL, + * the value null is returned. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + Blob getBlob (String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC CLOB parameter as a + * java.sql.Clob object in the Java programming language. + * @param parameterName the name of the parameter + * @return the parameter value as a Clob object in the + * Java programming language. If the value was SQL NULL, + * the value null is returned. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + Clob getClob (String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC ARRAY parameter as an + * {@link java.sql.Array} object in the Java programming language. + * + * @param parameterName the name of the parameter + * @return the parameter value as an Array object in + * Java programming language. If the value was SQL NULL, + * the value null is returned. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + Array getArray (String parameterName) throws SQLException; + + /** + * Retrieves the value of a JDBC DATE parameter as a + * java.sql.Date object, using + * the given Calendar object + * to construct the date. + * With a Calendar object, the driver + * can calculate the date taking into account a custom timezone and locale. + * If no Calendar object is specified, the driver uses the + * default timezone and locale. + * + * @param parameterName the name of the parameter + * @param cal the Calendar object the driver will use + * to construct the date + * @return the parameter value. If the value is SQL NULL, + * the result is null. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setDate + * @since 1.4 + */ + java.sql.Date getDate(String parameterName, Calendar cal) + throws SQLException; + + /** + * Retrieves the value of a JDBC TIME parameter as a + * java.sql.Time object, using + * the given Calendar object + * to construct the time. + * With a Calendar object, the driver + * can calculate the time taking into account a custom timezone and locale. + * If no Calendar object is specified, the driver uses the + * default timezone and locale. + * + * @param parameterName the name of the parameter + * @param cal the Calendar object the driver will use + * to construct the time + * @return the parameter value; if the value is SQL NULL, the result is + * null. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setTime + * @since 1.4 + */ + java.sql.Time getTime(String parameterName, Calendar cal) + throws SQLException; + + /** + * Retrieves the value of a JDBC TIMESTAMP parameter as a + * java.sql.Timestamp object, using + * the given Calendar object to construct + * the Timestamp object. + * With a Calendar object, the driver + * can calculate the timestamp taking into account a custom timezone and locale. + * If no Calendar object is specified, the driver uses the + * default timezone and locale. + * + * + * @param parameterName the name of the parameter + * @param cal the Calendar object the driver will use + * to construct the timestamp + * @return the parameter value. If the value is SQL NULL, the result is + * null. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setTimestamp + * @since 1.4 + */ + java.sql.Timestamp getTimestamp(String parameterName, Calendar cal) + throws SQLException; + + /** + * Retrieves the value of a JDBC DATALINK parameter as a + * java.net.URL object. + * + * @param parameterName the name of the parameter + * @return the parameter value as a java.net.URL object in the + * Java programming language. If the value was SQL NULL, the + * value null is returned. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs, + * this method is called on a closed CallableStatement, + * or if there is a problem with the URL + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setURL + * @since 1.4 + */ + java.net.URL getURL(String parameterName) throws SQLException; + + //------------------------- JDBC 4.0 ----------------------------------- + + /** + * Retrieves the value of the designated JDBC ROWID parameter as a + * java.sql.RowId object. + * + * @param parameterIndex the first parameter is 1, the second is 2,... + * @return a RowId object that represents the JDBC ROWID + * value is used as the designated parameter. If the parameter contains + * a SQL NULL, then a null value is returned. + * @throws SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + RowId getRowId(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated JDBC ROWID parameter as a + * java.sql.RowId object. + * + * @param parameterName the name of the parameter + * @return a RowId object that represents the JDBC ROWID + * value is used as the designated parameter. If the parameter contains + * a SQL NULL, then a null value is returned. + * @throws SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + RowId getRowId(String parameterName) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.RowId object. The + * driver converts this to a SQL ROWID when it sends it to the + * database. + * + * @param parameterName the name of the parameter + * @param x the parameter value + * @throws SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setRowId(String parameterName, RowId x) throws SQLException; + + /** + * Sets the designated parameter to the given String object. + * The driver converts this to a SQL NCHAR or + * NVARCHAR or LONGNVARCHAR + * @param parameterName the name of the parameter to be set + * @param value the parameter value + * @throws SQLException if parameterName does not correspond to a named + * parameter; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setNString(String parameterName, String value) + throws SQLException; + + /** + * Sets the designated parameter to a Reader object. The + * Reader reads the data till end-of-file is reached. The + * driver does the necessary conversion from Java character format to + * the national character set in the database. + * @param parameterName the name of the parameter to be set + * @param value the parameter value + * @param length the number of characters in the parameter data. + * @throws SQLException if parameterName does not correspond to a named + * parameter; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setNCharacterStream(String parameterName, Reader value, long length) + throws SQLException; + + /** + * Sets the designated parameter to a java.sql.NClob object. The object + * implements the java.sql.NClob interface. This NClob + * object maps to a SQL NCLOB. + * @param parameterName the name of the parameter to be set + * @param value the parameter value + * @throws SQLException if parameterName does not correspond to a named + * parameter; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setNClob(String parameterName, NClob value) throws SQLException; + + /** + * Sets the designated parameter to a Reader object. The reader must contain the number + * of characters specified by length otherwise a SQLException will be + * generated when the CallableStatement is executed. + * This method differs from the setCharacterStream (int, Reader, int) method + * because it informs the driver that the parameter value should be sent to + * the server as a CLOB. When the setCharacterStream method is used, the + * driver may have to do extra work to determine whether the parameter + * data should be send to the server as a LONGVARCHAR or a CLOB + * @param parameterName the name of the parameter to be set + * @param reader An object that contains the data to set the parameter value to. + * @param length the number of characters in the parameter data. + * @throws SQLException if parameterName does not correspond to a named + * parameter; if the length specified is less than zero; + * a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * + * @since 1.6 + */ + void setClob(String parameterName, Reader reader, long length) + throws SQLException; + + /** + * Sets the designated parameter to a InputStream object. The inputstream must contain the number + * of characters specified by length, otherwise a SQLException will be + * generated when the CallableStatement is executed. + * This method differs from the setBinaryStream (int, InputStream, int) + * method because it informs the driver that the parameter value should be + * sent to the server as a BLOB. When the setBinaryStream method is used, + * the driver may have to do extra work to determine whether the parameter + * data should be sent to the server as a LONGVARBINARY or a BLOB + * + * @param parameterName the name of the parameter to be set + * the second is 2, ... + * + * @param inputStream An object that contains the data to set the parameter + * value to. + * @param length the number of bytes in the parameter data. + * @throws SQLException if parameterName does not correspond to a named + * parameter; if the length specified + * is less than zero; if the number of bytes in the inputstream does not match + * the specfied length; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * + * @since 1.6 + */ + void setBlob(String parameterName, InputStream inputStream, long length) + throws SQLException; + /** + * Sets the designated parameter to a Reader object. The reader must contain the number + * of characters specified by length otherwise a SQLException will be + * generated when the CallableStatement is executed. + * This method differs from the setCharacterStream (int, Reader, int) method + * because it informs the driver that the parameter value should be sent to + * the server as a NCLOB. When the setCharacterStream method is used, the + * driver may have to do extra work to determine whether the parameter + * data should be send to the server as a LONGNVARCHAR or a NCLOB + * + * @param parameterName the name of the parameter to be set + * @param reader An object that contains the data to set the parameter value to. + * @param length the number of characters in the parameter data. + * @throws SQLException if parameterName does not correspond to a named + * parameter; if the length specified is less than zero; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setNClob(String parameterName, Reader reader, long length) + throws SQLException; + + /** + * Retrieves the value of the designated JDBC NCLOB parameter as a + * java.sql.NClob object in the Java programming language. + * + * @param parameterIndex the first parameter is 1, the second is 2, and + * so on + * @return the parameter value as a NClob object in the + * Java programming language. If the value was SQL NULL, the + * value null is returned. + * @exception SQLException if the parameterIndex is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + NClob getNClob (int parameterIndex) throws SQLException; + + + /** + * Retrieves the value of a JDBC NCLOB parameter as a + * java.sql.NClob object in the Java programming language. + * @param parameterName the name of the parameter + * @return the parameter value as a NClob object in the + * Java programming language. If the value was SQL NULL, + * the value null is returned. + * @exception SQLException if parameterName does not correspond to a named + * parameter; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + NClob getNClob (String parameterName) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an + * SQL XML value when it sends it to the database. + * + * @param parameterName the name of the parameter + * @param xmlObject a SQLXML object that maps an SQL XML value + * @throws SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs; + * this method is called on a closed CallableStatement or + * the java.xml.transform.Result, + * Writer or OutputStream has not been closed for the SQLXML object + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * + * @since 1.6 + */ + void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException; + + /** + * Retrieves the value of the designated SQL XML parameter as a + * java.sql.SQLXML object in the Java programming language. + * @param parameterIndex index of the first parameter is 1, the second is 2, ... + * @return a SQLXML object that maps an SQL XML value + * @throws SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + SQLXML getSQLXML(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated SQL XML parameter as a + * java.sql.SQLXML object in the Java programming language. + * @param parameterName the name of the parameter + * @return a SQLXML object that maps an SQL XML value + * @throws SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + SQLXML getSQLXML(String parameterName) throws SQLException; + + /** + * Retrieves the value of the designated NCHAR, + * NVARCHAR + * or LONGNVARCHAR parameter as + * a String in the Java programming language. + *

+ * For the fixed-length type JDBC NCHAR, + * the String object + * returned has exactly the same value the SQL + * NCHAR value had in the + * database, including any padding added by the database. + * + * @param parameterIndex index of the first parameter is 1, the second is 2, ... + * @return a String object that maps an + * NCHAR, NVARCHAR or LONGNVARCHAR value + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + * @see #setNString + */ + String getNString(int parameterIndex) throws SQLException; + + + /** + * Retrieves the value of the designated NCHAR, + * NVARCHAR + * or LONGNVARCHAR parameter as + * a String in the Java programming language. + *

+ * For the fixed-length type JDBC NCHAR, + * the String object + * returned has exactly the same value the SQL + * NCHAR value had in the + * database, including any padding added by the database. + * + * @param parameterName the name of the parameter + * @return a String object that maps an + * NCHAR, NVARCHAR or LONGNVARCHAR value + * @exception SQLException if parameterName does not correspond to a named + * parameter; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + * @see #setNString + */ + String getNString(String parameterName) throws SQLException; + + /** + * Retrieves the value of the designated parameter as a + * java.io.Reader object in the Java programming language. + * It is intended for use when + * accessing NCHAR,NVARCHAR + * and LONGNVARCHAR parameters. + * + * @return a java.io.Reader object that contains the parameter + * value; if the value is SQL NULL, the value returned is + * null in the Java programming language. + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @exception SQLException if the parameterIndex is not valid; + * if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + java.io.Reader getNCharacterStream(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated parameter as a + * java.io.Reader object in the Java programming language. + * It is intended for use when + * accessing NCHAR,NVARCHAR + * and LONGNVARCHAR parameters. + * + * @param parameterName the name of the parameter + * @return a java.io.Reader object that contains the parameter + * value; if the value is SQL NULL, the value returned is + * null in the Java programming language + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + java.io.Reader getNCharacterStream(String parameterName) throws SQLException; + + /** + * Retrieves the value of the designated parameter as a + * java.io.Reader object in the Java programming language. + * + * @return a java.io.Reader object that contains the parameter + * value; if the value is SQL NULL, the value returned is + * null in the Java programming language. + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @exception SQLException if the parameterIndex is not valid; if a database access error occurs or + * this method is called on a closed CallableStatement + * @since 1.6 + */ + java.io.Reader getCharacterStream(int parameterIndex) throws SQLException; + + /** + * Retrieves the value of the designated parameter as a + * java.io.Reader object in the Java programming language. + * + * @param parameterName the name of the parameter + * @return a java.io.Reader object that contains the parameter + * value; if the value is SQL NULL, the value returned is + * null in the Java programming language + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + java.io.Reader getCharacterStream(String parameterName) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Blob object. + * The driver converts this to an SQL BLOB value when it + * sends it to the database. + * + * @param parameterName the name of the parameter + * @param x a Blob object that maps an SQL BLOB value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setBlob (String parameterName, Blob x) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Clob object. + * The driver converts this to an SQL CLOB value when it + * sends it to the database. + * + * @param parameterName the name of the parameter + * @param x a Clob object that maps an SQL CLOB value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setClob (String parameterName, Clob x) throws SQLException; + /** + * Sets the designated parameter to the given input stream, which will have + * the specified number of bytes. + * When a very large ASCII value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.InputStream. Data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from ASCII to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterName the name of the parameter + * @param x the Java input stream that contains the ASCII parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setAsciiStream(String parameterName, java.io.InputStream x, long length) + throws SQLException; + + /** + * Sets the designated parameter to the given input stream, which will have + * the specified number of bytes. + * When a very large binary value is input to a LONGVARBINARY + * parameter, it may be more practical to send it via a + * java.io.InputStream object. The data will be read from the stream + * as needed until end-of-file is reached. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterName the name of the parameter + * @param x the java input stream which contains the binary parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setBinaryStream(String parameterName, java.io.InputStream x, + long length) throws SQLException; + /** + * Sets the designated parameter to the given Reader + * object, which is the given number of characters long. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterName the name of the parameter + * @param reader the java.io.Reader object that + * contains the UNICODE data used as the designated parameter + * @param length the number of characters in the stream + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setCharacterStream(String parameterName, + java.io.Reader reader, + long length) throws SQLException; + //-- + /** + * Sets the designated parameter to the given input stream. + * When a very large ASCII value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.InputStream. Data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from ASCII to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setAsciiStream which takes a length parameter. + * + * @param parameterName the name of the parameter + * @param x the Java input stream that contains the ASCII parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setAsciiStream(String parameterName, java.io.InputStream x) + throws SQLException; + /** + * Sets the designated parameter to the given input stream. + * When a very large binary value is input to a LONGVARBINARY + * parameter, it may be more practical to send it via a + * java.io.InputStream object. The data will be read from the + * stream as needed until end-of-file is reached. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setBinaryStream which takes a length parameter. + * + * @param parameterName the name of the parameter + * @param x the java input stream which contains the binary parameter value + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setBinaryStream(String parameterName, java.io.InputStream x) + throws SQLException; + /** + * Sets the designated parameter to the given Reader + * object. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setCharacterStream which takes a length parameter. + * + * @param parameterName the name of the parameter + * @param reader the java.io.Reader object that contains the + * Unicode data + * @exception SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setCharacterStream(String parameterName, + java.io.Reader reader) throws SQLException; + /** + * Sets the designated parameter to a Reader object. The + * Reader reads the data till end-of-file is reached. The + * driver does the necessary conversion from Java character format to + * the national character set in the database. + + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setNCharacterStream which takes a length parameter. + * + * @param parameterName the name of the parameter + * @param value the parameter value + * @throws SQLException if parameterName does not correspond to a named + * parameter; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs; or + * this method is called on a closed CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setNCharacterStream(String parameterName, Reader value) throws SQLException; + + /** + * Sets the designated parameter to a Reader object. + * This method differs from the setCharacterStream (int, Reader) method + * because it informs the driver that the parameter value should be sent to + * the server as a CLOB. When the setCharacterStream method is used, the + * driver may have to do extra work to determine whether the parameter + * data should be send to the server as a LONGVARCHAR or a CLOB + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setClob which takes a length parameter. + * + * @param parameterName the name of the parameter + * @param reader An object that contains the data to set the parameter value to. + * @throws SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or this method is called on + * a closed CallableStatement + * + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setClob(String parameterName, Reader reader) + throws SQLException; + + /** + * Sets the designated parameter to a InputStream object. + * This method differs from the setBinaryStream (int, InputStream) + * method because it informs the driver that the parameter value should be + * sent to the server as a BLOB. When the setBinaryStream method is used, + * the driver may have to do extra work to determine whether the parameter + * data should be send to the server as a LONGVARBINARY or a BLOB + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setBlob which takes a length parameter. + * + * @param parameterName the name of the parameter + * @param inputStream An object that contains the data to set the parameter + * value to. + * @throws SQLException if parameterName does not correspond to a named + * parameter; if a database access error occurs or + * this method is called on a closed CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * + * @since 1.6 + */ + void setBlob(String parameterName, InputStream inputStream) + throws SQLException; + /** + * Sets the designated parameter to a Reader object. + * This method differs from the setCharacterStream (int, Reader) method + * because it informs the driver that the parameter value should be sent to + * the server as a NCLOB. When the setCharacterStream method is used, the + * driver may have to do extra work to determine whether the parameter + * data should be send to the server as a LONGNVARCHAR or a NCLOB + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setNClob which takes a length parameter. + * + * @param parameterName the name of the parameter + * @param reader An object that contains the data to set the parameter value to. + * @throws SQLException if parameterName does not correspond to a named + * parameter; if the driver does not support national character sets; + * if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * + * @since 1.6 + */ + void setNClob(String parameterName, Reader reader) + throws SQLException; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ClientInfoStatus.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ClientInfoStatus.java new file mode 100644 index 0000000000..bf13e5f613 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ClientInfoStatus.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.util.*; + +/** + * Enumeration for status of the reason that a property could not be set + * via a call to Connection.setClientInfo + * @since 1.6 + */ + +public enum ClientInfoStatus { + + /** + * The client info property could not be set for some unknown reason + * @since 1.6 + */ + REASON_UNKNOWN, + + /** + * The client info property name specified was not a recognized property + * name. + * @since 1.6 + */ + REASON_UNKNOWN_PROPERTY, + + /** + * The value specified for the client info property was not valid. + * @since 1.6 + */ + REASON_VALUE_INVALID, + + /** + * The value specified for the client info property was too large. + * @since 1.6 + */ + REASON_VALUE_TRUNCATED +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Clob.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Clob.java new file mode 100644 index 0000000000..868c862a01 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Clob.java @@ -0,0 +1,348 @@ +/* + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.io.Reader; + +/** + * The mapping in the JavaTM programming language + * for the SQL CLOB type. + * An SQL CLOB is a built-in type + * that stores a Character Large Object as a column value in a row of + * a database table. + * By default drivers implement a Clob object using an SQL + * locator(CLOB), which means that a Clob object + * contains a logical pointer to the SQL CLOB data rather than + * the data itself. A Clob object is valid for the duration + * of the transaction in which it was created. + *

The Clob interface provides methods for getting the + * length of an SQL CLOB (Character Large Object) value, + * for materializing a CLOB value on the client, and for + * searching for a substring or CLOB object within a + * CLOB value. + * Methods in the interfaces {@link ResultSet}, + * {@link CallableStatement}, and {@link PreparedStatement}, such as + * getClob and setClob allow a programmer to + * access an SQL CLOB value. In addition, this interface + * has methods for updating a CLOB value. + *

+ * All methods on the Clob interface must be fully implemented if the + * JDBC driver supports the data type. + * + * @since 1.2 + */ + +public interface Clob { + + /** + * Retrieves the number of characters + * in the CLOB value + * designated by this Clob object. + * + * @return length of the CLOB in characters + * @exception SQLException if there is an error accessing the + * length of the CLOB value + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + long length() throws SQLException; + + /** + * Retrieves a copy of the specified substring + * in the CLOB value + * designated by this Clob object. + * The substring begins at position + * pos and has up to length consecutive + * characters. + * + * @param pos the first character of the substring to be extracted. + * The first character is at position 1. + * @param length the number of consecutive characters to be copied; + * the value for length must be 0 or greater + * @return a String that is the specified substring in + * the CLOB value designated by this Clob object + * @exception SQLException if there is an error accessing the + * CLOB value; if pos is less than 1 or length is + * less than 0 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + String getSubString(long pos, int length) throws SQLException; + + /** + * Retrieves the CLOB value designated by this Clob + * object as a java.io.Reader object (or as a stream of + * characters). + * + * @return a java.io.Reader object containing the + * CLOB data + * @exception SQLException if there is an error accessing the + * CLOB value + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setCharacterStream + * @since 1.2 + */ + java.io.Reader getCharacterStream() throws SQLException; + + /** + * Retrieves the CLOB value designated by this Clob + * object as an ascii stream. + * + * @return a java.io.InputStream object containing the + * CLOB data + * @exception SQLException if there is an error accessing the + * CLOB value + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #setAsciiStream + * @since 1.2 + */ + java.io.InputStream getAsciiStream() throws SQLException; + + /** + * Retrieves the character position at which the specified substring + * searchstr appears in the SQL CLOB value + * represented by this Clob object. The search + * begins at position start. + * + * @param searchstr the substring for which to search + * @param start the position at which to begin searching; the first position + * is 1 + * @return the position at which the substring appears or -1 if it is not + * present; the first position is 1 + * @exception SQLException if there is an error accessing the + * CLOB value or if pos is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + long position(String searchstr, long start) throws SQLException; + + /** + * Retrieves the character position at which the specified + * Clob object searchstr appears in this + * Clob object. The search begins at position + * start. + * + * @param searchstr the Clob object for which to search + * @param start the position at which to begin searching; the first + * position is 1 + * @return the position at which the Clob object appears + * or -1 if it is not present; the first position is 1 + * @exception SQLException if there is an error accessing the + * CLOB value or if start is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + long position(Clob searchstr, long start) throws SQLException; + + //---------------------------- jdbc 3.0 ----------------------------------- + + /** + * Writes the given Java String to the CLOB + * value that this Clob object designates at the position + * pos. The string will overwrite the existing characters + * in the Clob object starting at the position + * pos. If the end of the Clob value is reached + * while writing the given string, then the length of the Clob + * value will be increased to accomodate the extra characters. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the CLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param pos the position at which to start writing to the CLOB + * value that this Clob object represents; + * The first position is 1 + * @param str the string to be written to the CLOB + * value that this Clob designates + * @return the number of characters written + * @exception SQLException if there is an error accessing the + * CLOB value or if pos is less than 1 + * + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + int setString(long pos, String str) throws SQLException; + + /** + * Writes len characters of str, starting + * at character offset, to the CLOB value + * that this Clob represents. The string will overwrite the existing characters + * in the Clob object starting at the position + * pos. If the end of the Clob value is reached + * while writing the given string, then the length of the Clob + * value will be increased to accomodate the extra characters. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the CLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param pos the position at which to start writing to this + * CLOB object; The first position is 1 + * @param str the string to be written to the CLOB + * value that this Clob object represents + * @param offset the offset into str to start reading + * the characters to be written + * @param len the number of characters to be written + * @return the number of characters written + * @exception SQLException if there is an error accessing the + * CLOB value or if pos is less than 1 + * + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + int setString(long pos, String str, int offset, int len) throws SQLException; + + /** + * Retrieves a stream to be used to write Ascii characters to the + * CLOB value that this Clob object represents, + * starting at position pos. Characters written to the stream + * will overwrite the existing characters + * in the Clob object starting at the position + * pos. If the end of the Clob value is reached + * while writing characters to the stream, then the length of the Clob + * value will be increased to accomodate the extra characters. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the CLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param pos the position at which to start writing to this + * CLOB object; The first position is 1 + * @return the stream to which ASCII encoded characters can be written + * @exception SQLException if there is an error accessing the + * CLOB value or if pos is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getAsciiStream + * + * @since 1.4 + */ + java.io.OutputStream setAsciiStream(long pos) throws SQLException; + + /** + * Retrieves a stream to be used to write a stream of Unicode characters + * to the CLOB value that this Clob object + * represents, at position pos. Characters written to the stream + * will overwrite the existing characters + * in the Clob object starting at the position + * pos. If the end of the Clob value is reached + * while writing characters to the stream, then the length of the Clob + * value will be increased to accomodate the extra characters. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the CLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param pos the position at which to start writing to the + * CLOB value; The first position is 1 + * + * @return a stream to which Unicode encoded characters can be written + * @exception SQLException if there is an error accessing the + * CLOB value or if pos is less than 1 + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see #getCharacterStream + * + * @since 1.4 + */ + java.io.Writer setCharacterStream(long pos) throws SQLException; + + /** + * Truncates the CLOB value that this Clob + * designates to have a length of len + * characters. + *

+ * Note: If the value specified for pos + * is greater then the length+1 of the CLOB value then the + * behavior is undefined. Some JDBC drivers may throw a + * SQLException while other drivers may support this + * operation. + * + * @param len the length, in characters, to which the CLOB value + * should be truncated + * @exception SQLException if there is an error accessing the + * CLOB value or if len is less than 0 + * + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void truncate(long len) throws SQLException; + + /** + * This method frees the Clob object and releases the resources the resources + * that it holds. The object is invalid once the free method + * is called. + *

+ * After free has been called, any attempt to invoke a + * method other than free will result in a SQLException + * being thrown. If free is called multiple times, the subsequent + * calls to free are treated as a no-op. + *

+ * @throws SQLException if an error occurs releasing + * the Clob's resources + * + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void free() throws SQLException; + + /** + * Returns a Reader object that contains a partial Clob value, starting + * with the character specified by pos, which is length characters in length. + * + * @param pos the offset to the first character of the partial value to + * be retrieved. The first character in the Clob is at position 1. + * @param length the length in characters of the partial value to be retrieved. + * @return Reader through which the partial Clob value can be read. + * @throws SQLException if pos is less than 1 or if pos is greater than the number of + * characters in the Clob or if pos + length is greater than the number of + * characters in the Clob + * + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + Reader getCharacterStream(long pos, long length) throws SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Connection.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Connection.java new file mode 100644 index 0000000000..3acfd12f5f --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Connection.java @@ -0,0 +1,1306 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.util.Properties; +import java.util.concurrent.Executor; + +/** + *

A connection (session) with a specific + * database. SQL statements are executed and results are returned + * within the context of a connection. + *

+ * A Connection object's database is able to provide information + * describing its tables, its supported SQL grammar, its stored + * procedures, the capabilities of this connection, and so on. This + * information is obtained with the getMetaData method. + * + *

Note: When configuring a Connection, JDBC applications + * should use the appropriate Connection method such as + * setAutoCommit or setTransactionIsolation. + * Applications should not invoke SQL commands directly to change the connection's + * configuration when there is a JDBC method available. By default a Connection object is in + * auto-commit mode, which means that it automatically commits changes + * after executing each statement. If auto-commit mode has been + * disabled, the method commit must be called explicitly in + * order to commit changes; otherwise, database changes will not be saved. + *

+ * A new Connection object created using the JDBC 2.1 core API + * has an initially empty type map associated with it. A user may enter a + * custom mapping for a UDT in this type map. + * When a UDT is retrieved from a data source with the + * method ResultSet.getObject, the getObject method + * will check the connection's type map to see if there is an entry for that + * UDT. If so, the getObject method will map the UDT to the + * class indicated. If there is no entry, the UDT will be mapped using the + * standard mapping. + *

+ * A user may create a new type map, which is a java.util.Map + * object, make an entry in it, and pass it to the java.sql + * methods that can perform custom mapping. In this case, the method + * will use the given type map instead of the one associated with + * the connection. + *

+ * For example, the following code fragment specifies that the SQL + * type ATHLETES will be mapped to the class + * Athletes in the Java programming language. + * The code fragment retrieves the type map for the Connection + * object con, inserts the entry into it, and then sets + * the type map with the new entry as the connection's type map. + *

+ *      java.util.Map map = con.getTypeMap();
+ *      map.put("mySchemaName.ATHLETES", Class.forName("Athletes"));
+ *      con.setTypeMap(map);
+ * 
+ * + * @see DriverManager#getConnection + * @see Statement + * @see ResultSet + * @see DatabaseMetaData + */ +public interface Connection extends Wrapper, AutoCloseable { + + /** + * Creates a Statement object for sending + * SQL statements to the database. + * SQL statements without parameters are normally + * executed using Statement objects. If the same SQL statement + * is executed many times, it may be more efficient to use a + * PreparedStatement object. + *

+ * Result sets created using the returned Statement + * object will by default be type TYPE_FORWARD_ONLY + * and have a concurrency level of CONCUR_READ_ONLY. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @return a new default Statement object + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + */ + Statement createStatement() throws SQLException; + + /** + * Creates a PreparedStatement object for sending + * parameterized SQL statements to the database. + *

+ * A SQL statement with or without IN parameters can be + * pre-compiled and stored in a PreparedStatement object. This + * object can then be used to efficiently execute this statement + * multiple times. + * + *

Note: This method is optimized for handling + * parametric SQL statements that benefit from precompilation. If + * the driver supports precompilation, + * the method prepareStatement will send + * the statement to the database for precompilation. Some drivers + * may not support precompilation. In this case, the statement may + * not be sent to the database until the PreparedStatement + * object is executed. This has no direct effect on users; however, it does + * affect which methods throw certain SQLException objects. + *

+ * Result sets created using the returned PreparedStatement + * object will by default be type TYPE_FORWARD_ONLY + * and have a concurrency level of CONCUR_READ_ONLY. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @param sql an SQL statement that may contain one or more '?' IN + * parameter placeholders + * @return a new default PreparedStatement object containing the + * pre-compiled SQL statement + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + */ + PreparedStatement prepareStatement(String sql) + throws SQLException; + + /** + * Creates a CallableStatement object for calling + * database stored procedures. + * The CallableStatement object provides + * methods for setting up its IN and OUT parameters, and + * methods for executing the call to a stored procedure. + * + *

Note: This method is optimized for handling stored + * procedure call statements. Some drivers may send the call + * statement to the database when the method prepareCall + * is done; others + * may wait until the CallableStatement object + * is executed. This has no + * direct effect on users; however, it does affect which method + * throws certain SQLExceptions. + *

+ * Result sets created using the returned CallableStatement + * object will by default be type TYPE_FORWARD_ONLY + * and have a concurrency level of CONCUR_READ_ONLY. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @param sql an SQL statement that may contain one or more '?' + * parameter placeholders. Typically this statement is specified using JDBC + * call escape syntax. + * @return a new default CallableStatement object containing the + * pre-compiled SQL statement + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + */ + CallableStatement prepareCall(String sql) throws SQLException; + + /** + * Converts the given SQL statement into the system's native SQL grammar. + * A driver may convert the JDBC SQL grammar into its system's + * native SQL grammar prior to sending it. This method returns the + * native form of the statement that the driver would have sent. + * + * @param sql an SQL statement that may contain one or more '?' + * parameter placeholders + * @return the native form of this statement + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + */ + String nativeSQL(String sql) throws SQLException; + + /** + * Sets this connection's auto-commit mode to the given state. + * If a connection is in auto-commit mode, then all its SQL + * statements will be executed and committed as individual + * transactions. Otherwise, its SQL statements are grouped into + * transactions that are terminated by a call to either + * the method commit or the method rollback. + * By default, new connections are in auto-commit + * mode. + *

+ * The commit occurs when the statement completes. The time when the statement + * completes depends on the type of SQL Statement: + *

    + *
  • For DML statements, such as Insert, Update or Delete, and DDL statements, + * the statement is complete as soon as it has finished executing. + *
  • For Select statements, the statement is complete when the associated result + * set is closed. + *
  • For CallableStatement objects or for statements that return + * multiple results, the statement is complete + * when all of the associated result sets have been closed, and all update + * counts and output parameters have been retrieved. + *
+ *

+ * NOTE: If this method is called during a transaction and the + * auto-commit mode is changed, the transaction is committed. If + * setAutoCommit is called and the auto-commit mode is + * not changed, the call is a no-op. + * + * @param autoCommit true to enable auto-commit mode; + * false to disable it + * @exception SQLException if a database access error occurs, + * setAutoCommit(true) is called while participating in a distributed transaction, + * or this method is called on a closed connection + * @see #getAutoCommit + */ + void setAutoCommit(boolean autoCommit) throws SQLException; + + /** + * Retrieves the current auto-commit mode for this Connection + * object. + * + * @return the current state of this Connection object's + * auto-commit mode + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + * @see #setAutoCommit + */ + boolean getAutoCommit() throws SQLException; + + /** + * Makes all changes made since the previous + * commit/rollback permanent and releases any database locks + * currently held by this Connection object. + * This method should be + * used only when auto-commit mode has been disabled. + * + * @exception SQLException if a database access error occurs, + * this method is called while participating in a distributed transaction, + * if this method is called on a closed conection or this + * Connection object is in auto-commit mode + * @see #setAutoCommit + */ + void commit() throws SQLException; + + /** + * Undoes all changes made in the current transaction + * and releases any database locks currently held + * by this Connection object. This method should be + * used only when auto-commit mode has been disabled. + * + * @exception SQLException if a database access error occurs, + * this method is called while participating in a distributed transaction, + * this method is called on a closed connection or this + * Connection object is in auto-commit mode + * @see #setAutoCommit + */ + void rollback() throws SQLException; + + /** + * Releases this Connection object's database and JDBC resources + * immediately instead of waiting for them to be automatically released. + *

+ * Calling the method close on a Connection + * object that is already closed is a no-op. + *

+ * It is strongly recommended that an application explicitly + * commits or rolls back an active transaction prior to calling the + * close method. If the close method is called + * and there is an active transaction, the results are implementation-defined. + *

+ * + * @exception SQLException SQLException if a database access error occurs + */ + void close() throws SQLException; + + /** + * Retrieves whether this Connection object has been + * closed. A connection is closed if the method close + * has been called on it or if certain fatal errors have occurred. + * This method is guaranteed to return true only when + * it is called after the method Connection.close has + * been called. + *

+ * This method generally cannot be called to determine whether a + * connection to a database is valid or invalid. A typical client + * can determine that a connection is invalid by catching any + * exceptions that might be thrown when an operation is attempted. + * + * @return true if this Connection object + * is closed; false if it is still open + * @exception SQLException if a database access error occurs + */ + boolean isClosed() throws SQLException; + + //====================================================================== + // Advanced features: + + /** + * Retrieves a DatabaseMetaData object that contains + * metadata about the database to which this + * Connection object represents a connection. + * The metadata includes information about the database's + * tables, its supported SQL grammar, its stored + * procedures, the capabilities of this connection, and so on. + * + * @return a DatabaseMetaData object for this + * Connection object + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + */ + DatabaseMetaData getMetaData() throws SQLException; + + /** + * Puts this connection in read-only mode as a hint to the driver to enable + * database optimizations. + * + *

Note: This method cannot be called during a transaction. + * + * @param readOnly true enables read-only mode; + * false disables it + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection or this + * method is called during a transaction + */ + void setReadOnly(boolean readOnly) throws SQLException; + + /** + * Retrieves whether this Connection + * object is in read-only mode. + * + * @return true if this Connection object + * is read-only; false otherwise + * @exception SQLException SQLException if a database access error occurs + * or this method is called on a closed connection + */ + boolean isReadOnly() throws SQLException; + + /** + * Sets the given catalog name in order to select + * a subspace of this Connection object's database + * in which to work. + *

+ * If the driver does not support catalogs, it will + * silently ignore this request. + *

+ * Calling {@code setCatalog} has no effect on previously created or prepared + * {@code Statement} objects. It is implementation defined whether a DBMS + * prepare operation takes place immediately when the {@code Connection} + * method {@code prepareStatement} or {@code prepareCall} is invoked. + * For maximum portability, {@code setCatalog} should be called before a + * {@code Statement} is created or prepared. + * + * @param catalog the name of a catalog (subspace in this + * Connection object's database) in which to work + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + * @see #getCatalog + */ + void setCatalog(String catalog) throws SQLException; + + /** + * Retrieves this Connection object's current catalog name. + * + * @return the current catalog name or null if there is none + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + * @see #setCatalog + */ + String getCatalog() throws SQLException; + + /** + * A constant indicating that transactions are not supported. + */ + int TRANSACTION_NONE = 0; + + /** + * A constant indicating that + * dirty reads, non-repeatable reads and phantom reads can occur. + * This level allows a row changed by one transaction to be read + * by another transaction before any changes in that row have been + * committed (a "dirty read"). If any of the changes are rolled back, + * the second transaction will have retrieved an invalid row. + */ + int TRANSACTION_READ_UNCOMMITTED = 1; + + /** + * A constant indicating that + * dirty reads are prevented; non-repeatable reads and phantom + * reads can occur. This level only prohibits a transaction + * from reading a row with uncommitted changes in it. + */ + int TRANSACTION_READ_COMMITTED = 2; + + /** + * A constant indicating that + * dirty reads and non-repeatable reads are prevented; phantom + * reads can occur. This level prohibits a transaction from + * reading a row with uncommitted changes in it, and it also + * prohibits the situation where one transaction reads a row, + * a second transaction alters the row, and the first transaction + * rereads the row, getting different values the second time + * (a "non-repeatable read"). + */ + int TRANSACTION_REPEATABLE_READ = 4; + + /** + * A constant indicating that + * dirty reads, non-repeatable reads and phantom reads are prevented. + * This level includes the prohibitions in + * TRANSACTION_REPEATABLE_READ and further prohibits the + * situation where one transaction reads all rows that satisfy + * a WHERE condition, a second transaction inserts a row that + * satisfies that WHERE condition, and the first transaction + * rereads for the same condition, retrieving the additional + * "phantom" row in the second read. + */ + int TRANSACTION_SERIALIZABLE = 8; + + /** + * Attempts to change the transaction isolation level for this + * Connection object to the one given. + * The constants defined in the interface Connection + * are the possible transaction isolation levels. + *

+ * Note: If this method is called during a transaction, the result + * is implementation-defined. + * + * @param level one of the following Connection constants: + * Connection.TRANSACTION_READ_UNCOMMITTED, + * Connection.TRANSACTION_READ_COMMITTED, + * Connection.TRANSACTION_REPEATABLE_READ, or + * Connection.TRANSACTION_SERIALIZABLE. + * (Note that Connection.TRANSACTION_NONE cannot be used + * because it specifies that transactions are not supported.) + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection + * or the given parameter is not one of the Connection + * constants + * @see DatabaseMetaData#supportsTransactionIsolationLevel + * @see #getTransactionIsolation + */ + void setTransactionIsolation(int level) throws SQLException; + + /** + * Retrieves this Connection object's current + * transaction isolation level. + * + * @return the current transaction isolation level, which will be one + * of the following constants: + * Connection.TRANSACTION_READ_UNCOMMITTED, + * Connection.TRANSACTION_READ_COMMITTED, + * Connection.TRANSACTION_REPEATABLE_READ, + * Connection.TRANSACTION_SERIALIZABLE, or + * Connection.TRANSACTION_NONE. + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + * @see #setTransactionIsolation + */ + int getTransactionIsolation() throws SQLException; + + /** + * Retrieves the first warning reported by calls on this + * Connection object. If there is more than one + * warning, subsequent warnings will be chained to the first one + * and can be retrieved by calling the method + * SQLWarning.getNextWarning on the warning + * that was retrieved previously. + *

+ * This method may not be + * called on a closed connection; doing so will cause an + * SQLException to be thrown. + * + *

Note: Subsequent warnings will be chained to this + * SQLWarning. + * + * @return the first SQLWarning object or null + * if there are none + * @exception SQLException if a database access error occurs or + * this method is called on a closed connection + * @see SQLWarning + */ + SQLWarning getWarnings() throws SQLException; + + /** + * Clears all warnings reported for this Connection object. + * After a call to this method, the method getWarnings + * returns null until a new warning is + * reported for this Connection object. + * + * @exception SQLException SQLException if a database access error occurs + * or this method is called on a closed connection + */ + void clearWarnings() throws SQLException; + + + //--------------------------JDBC 2.0----------------------------- + + /** + * Creates a Statement object that will generate + * ResultSet objects with the given type and concurrency. + * This method is the same as the createStatement method + * above, but it allows the default result set + * type and concurrency to be overridden. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @param resultSetType a result set type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @param resultSetConcurrency a concurrency type; one of + * ResultSet.CONCUR_READ_ONLY or + * ResultSet.CONCUR_UPDATABLE + * @return a new Statement object that will generate + * ResultSet objects with the given type and + * concurrency + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection + * or the given parameters are not ResultSet + * constants indicating type and concurrency + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method or this method is not supported for the specified result + * set type and result set concurrency. + * @since 1.2 + */ + Statement createStatement(int resultSetType, int resultSetConcurrency) + throws SQLException; + + /** + * + * Creates a PreparedStatement object that will generate + * ResultSet objects with the given type and concurrency. + * This method is the same as the prepareStatement method + * above, but it allows the default result set + * type and concurrency to be overridden. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @param sql a String object that is the SQL statement to + * be sent to the database; may contain one or more '?' IN + * parameters + * @param resultSetType a result set type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @param resultSetConcurrency a concurrency type; one of + * ResultSet.CONCUR_READ_ONLY or + * ResultSet.CONCUR_UPDATABLE + * @return a new PreparedStatement object containing the + * pre-compiled SQL statement that will produce ResultSet + * objects with the given type and concurrency + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection + * or the given parameters are not ResultSet + * constants indicating type and concurrency + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method or this method is not supported for the specified result + * set type and result set concurrency. + * @since 1.2 + */ + PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency) + throws SQLException; + + /** + * Creates a CallableStatement object that will generate + * ResultSet objects with the given type and concurrency. + * This method is the same as the prepareCall method + * above, but it allows the default result set + * type and concurrency to be overridden. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @param sql a String object that is the SQL statement to + * be sent to the database; may contain on or more '?' parameters + * @param resultSetType a result set type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @param resultSetConcurrency a concurrency type; one of + * ResultSet.CONCUR_READ_ONLY or + * ResultSet.CONCUR_UPDATABLE + * @return a new CallableStatement object containing the + * pre-compiled SQL statement that will produce ResultSet + * objects with the given type and concurrency + * @exception SQLException if a database access error occurs, this method + * is called on a closed connection + * or the given parameters are not ResultSet + * constants indicating type and concurrency + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method or this method is not supported for the specified result + * set type and result set concurrency. + * @since 1.2 + */ + CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException; + + /** + * Retrieves the Map object associated with this + * Connection object. + * Unless the application has added an entry, the type map returned + * will be empty. + *

+ * You must invoke setTypeMap after making changes to the + * Map object returned from + * getTypeMap as a JDBC driver may create an internal + * copy of the Map object passed to setTypeMap: + *

+ *

+     *      Map<String,Class<?>> myMap = con.getTypeMap();
+     *      myMap.put("mySchemaName.ATHLETES", Athletes.class);
+     *      con.setTypeMap(myMap);
+     * 
+ * @return the java.util.Map object associated + * with this Connection object + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + * @see #setTypeMap + */ + java.util.Map> getTypeMap() throws SQLException; + + /** + * Installs the given TypeMap object as the type map for + * this Connection object. The type map will be used for the + * custom mapping of SQL structured types and distinct types. + *

+ * You must set the the values for the TypeMap prior to + * callng setMap as a JDBC driver may create an internal copy + * of the TypeMap: + *

+ *

+     *      Map myMap<String,Class<?>> = new HashMap<String,Class<?>>();
+     *      myMap.put("mySchemaName.ATHLETES", Athletes.class);
+     *      con.setTypeMap(myMap);
+     * 
+ * @param map the java.util.Map object to install + * as the replacement for this Connection + * object's default type map + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection or + * the given parameter is not a java.util.Map + * object + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + * @see #getTypeMap + */ + void setTypeMap(java.util.Map> map) throws SQLException; + + //--------------------------JDBC 3.0----------------------------- + + + /** + * Changes the default holdability of ResultSet objects + * created using this Connection object to the given + * holdability. The default holdability of ResultSet objects + * can be be determined by invoking + * {@link DatabaseMetaData#getResultSetHoldability}. + * + * @param holdability a ResultSet holdability constant; one of + * ResultSet.HOLD_CURSORS_OVER_COMMIT or + * ResultSet.CLOSE_CURSORS_AT_COMMIT + * @throws SQLException if a database access occurs, this method is called + * on a closed connection, or the given parameter + * is not a ResultSet constant indicating holdability + * @exception SQLFeatureNotSupportedException if the given holdability is not supported + * @see #getHoldability + * @see DatabaseMetaData#getResultSetHoldability + * @see ResultSet + * @since 1.4 + */ + void setHoldability(int holdability) throws SQLException; + + /** + * Retrieves the current holdability of ResultSet objects + * created using this Connection object. + * + * @return the holdability, one of + * ResultSet.HOLD_CURSORS_OVER_COMMIT or + * ResultSet.CLOSE_CURSORS_AT_COMMIT + * @throws SQLException if a database access error occurs + * or this method is called on a closed connection + * @see #setHoldability + * @see DatabaseMetaData#getResultSetHoldability + * @see ResultSet + * @since 1.4 + */ + int getHoldability() throws SQLException; + + /** + * Creates an unnamed savepoint in the current transaction and + * returns the new Savepoint object that represents it. + * + *

if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created + *savepoint. + * + * @return the new Savepoint object + * @exception SQLException if a database access error occurs, + * this method is called while participating in a distributed transaction, + * this method is called on a closed connection + * or this Connection object is currently in + * auto-commit mode + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see Savepoint + * @since 1.4 + */ + Savepoint setSavepoint() throws SQLException; + + /** + * Creates a savepoint with the given name in the current transaction + * and returns the new Savepoint object that represents it. + * + *

if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created + *savepoint. + * + * @param name a String containing the name of the savepoint + * @return the new Savepoint object + * @exception SQLException if a database access error occurs, + * this method is called while participating in a distributed transaction, + * this method is called on a closed connection + * or this Connection object is currently in + * auto-commit mode + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see Savepoint + * @since 1.4 + */ + Savepoint setSavepoint(String name) throws SQLException; + + /** + * Undoes all changes made after the given Savepoint object + * was set. + *

+ * This method should be used only when auto-commit has been disabled. + * + * @param savepoint the Savepoint object to roll back to + * @exception SQLException if a database access error occurs, + * this method is called while participating in a distributed transaction, + * this method is called on a closed connection, + * the Savepoint object is no longer valid, + * or this Connection object is currently in + * auto-commit mode + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see Savepoint + * @see #rollback + * @since 1.4 + */ + void rollback(Savepoint savepoint) throws SQLException; + + /** + * Removes the specified Savepoint and subsequent Savepoint objects from the current + * transaction. Any reference to the savepoint after it have been removed + * will cause an SQLException to be thrown. + * + * @param savepoint the Savepoint object to be removed + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection or + * the given Savepoint object is not a valid + * savepoint in the current transaction + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void releaseSavepoint(Savepoint savepoint) throws SQLException; + + /** + * Creates a Statement object that will generate + * ResultSet objects with the given type, concurrency, + * and holdability. + * This method is the same as the createStatement method + * above, but it allows the default result set + * type, concurrency, and holdability to be overridden. + * + * @param resultSetType one of the following ResultSet + * constants: + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @param resultSetConcurrency one of the following ResultSet + * constants: + * ResultSet.CONCUR_READ_ONLY or + * ResultSet.CONCUR_UPDATABLE + * @param resultSetHoldability one of the following ResultSet + * constants: + * ResultSet.HOLD_CURSORS_OVER_COMMIT or + * ResultSet.CLOSE_CURSORS_AT_COMMIT + * @return a new Statement object that will generate + * ResultSet objects with the given type, + * concurrency, and holdability + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection + * or the given parameters are not ResultSet + * constants indicating type, concurrency, and holdability + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method or this method is not supported for the specified result + * set type, result set holdability and result set concurrency. + * @see ResultSet + * @since 1.4 + */ + Statement createStatement(int resultSetType, int resultSetConcurrency, + int resultSetHoldability) throws SQLException; + + /** + * Creates a PreparedStatement object that will generate + * ResultSet objects with the given type, concurrency, + * and holdability. + *

+ * This method is the same as the prepareStatement method + * above, but it allows the default result set + * type, concurrency, and holdability to be overridden. + * + * @param sql a String object that is the SQL statement to + * be sent to the database; may contain one or more '?' IN + * parameters + * @param resultSetType one of the following ResultSet + * constants: + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @param resultSetConcurrency one of the following ResultSet + * constants: + * ResultSet.CONCUR_READ_ONLY or + * ResultSet.CONCUR_UPDATABLE + * @param resultSetHoldability one of the following ResultSet + * constants: + * ResultSet.HOLD_CURSORS_OVER_COMMIT or + * ResultSet.CLOSE_CURSORS_AT_COMMIT + * @return a new PreparedStatement object, containing the + * pre-compiled SQL statement, that will generate + * ResultSet objects with the given type, + * concurrency, and holdability + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection + * or the given parameters are not ResultSet + * constants indicating type, concurrency, and holdability + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method or this method is not supported for the specified result + * set type, result set holdability and result set concurrency. + * @see ResultSet + * @since 1.4 + */ + PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException; + + /** + * Creates a CallableStatement object that will generate + * ResultSet objects with the given type and concurrency. + * This method is the same as the prepareCall method + * above, but it allows the default result set + * type, result set concurrency type and holdability to be overridden. + * + * @param sql a String object that is the SQL statement to + * be sent to the database; may contain on or more '?' parameters + * @param resultSetType one of the following ResultSet + * constants: + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @param resultSetConcurrency one of the following ResultSet + * constants: + * ResultSet.CONCUR_READ_ONLY or + * ResultSet.CONCUR_UPDATABLE + * @param resultSetHoldability one of the following ResultSet + * constants: + * ResultSet.HOLD_CURSORS_OVER_COMMIT or + * ResultSet.CLOSE_CURSORS_AT_COMMIT + * @return a new CallableStatement object, containing the + * pre-compiled SQL statement, that will generate + * ResultSet objects with the given type, + * concurrency, and holdability + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection + * or the given parameters are not ResultSet + * constants indicating type, concurrency, and holdability + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method or this method is not supported for the specified result + * set type, result set holdability and result set concurrency. + * @see ResultSet + * @since 1.4 + */ + CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency, + int resultSetHoldability) throws SQLException; + + + /** + * Creates a default PreparedStatement object that has + * the capability to retrieve auto-generated keys. The given constant + * tells the driver whether it should make auto-generated keys + * available for retrieval. This parameter is ignored if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * Note: This method is optimized for handling + * parametric SQL statements that benefit from precompilation. If + * the driver supports precompilation, + * the method prepareStatement will send + * the statement to the database for precompilation. Some drivers + * may not support precompilation. In this case, the statement may + * not be sent to the database until the PreparedStatement + * object is executed. This has no direct effect on users; however, it does + * affect which methods throw certain SQLExceptions. + *

+ * Result sets created using the returned PreparedStatement + * object will by default be type TYPE_FORWARD_ONLY + * and have a concurrency level of CONCUR_READ_ONLY. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @param sql an SQL statement that may contain one or more '?' IN + * parameter placeholders + * @param autoGeneratedKeys a flag indicating whether auto-generated keys + * should be returned; one of + * Statement.RETURN_GENERATED_KEYS or + * Statement.NO_GENERATED_KEYS + * @return a new PreparedStatement object, containing the + * pre-compiled SQL statement, that will have the capability of + * returning auto-generated keys + * @exception SQLException if a database access error occurs, this + * method is called on a closed connection + * or the given parameter is not a Statement + * constant indicating whether auto-generated keys should be + * returned + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method with a constant of Statement.RETURN_GENERATED_KEYS + * @since 1.4 + */ + PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) + throws SQLException; + + /** + * Creates a default PreparedStatement object capable + * of returning the auto-generated keys designated by the given array. + * This array contains the indexes of the columns in the target + * table that contain the auto-generated keys that should be made + * available. The driver will ignore the array if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * An SQL statement with or without IN parameters can be + * pre-compiled and stored in a PreparedStatement object. This + * object can then be used to efficiently execute this statement + * multiple times. + *

+ * Note: This method is optimized for handling + * parametric SQL statements that benefit from precompilation. If + * the driver supports precompilation, + * the method prepareStatement will send + * the statement to the database for precompilation. Some drivers + * may not support precompilation. In this case, the statement may + * not be sent to the database until the PreparedStatement + * object is executed. This has no direct effect on users; however, it does + * affect which methods throw certain SQLExceptions. + *

+ * Result sets created using the returned PreparedStatement + * object will by default be type TYPE_FORWARD_ONLY + * and have a concurrency level of CONCUR_READ_ONLY. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @param sql an SQL statement that may contain one or more '?' IN + * parameter placeholders + * @param columnIndexes an array of column indexes indicating the columns + * that should be returned from the inserted row or rows + * @return a new PreparedStatement object, containing the + * pre-compiled statement, that is capable of returning the + * auto-generated keys designated by the given array of column + * indexes + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * + * @since 1.4 + */ + PreparedStatement prepareStatement(String sql, int columnIndexes[]) + throws SQLException; + + /** + * Creates a default PreparedStatement object capable + * of returning the auto-generated keys designated by the given array. + * This array contains the names of the columns in the target + * table that contain the auto-generated keys that should be returned. + * The driver will ignore the array if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * An SQL statement with or without IN parameters can be + * pre-compiled and stored in a PreparedStatement object. This + * object can then be used to efficiently execute this statement + * multiple times. + *

+ * Note: This method is optimized for handling + * parametric SQL statements that benefit from precompilation. If + * the driver supports precompilation, + * the method prepareStatement will send + * the statement to the database for precompilation. Some drivers + * may not support precompilation. In this case, the statement may + * not be sent to the database until the PreparedStatement + * object is executed. This has no direct effect on users; however, it does + * affect which methods throw certain SQLExceptions. + *

+ * Result sets created using the returned PreparedStatement + * object will by default be type TYPE_FORWARD_ONLY + * and have a concurrency level of CONCUR_READ_ONLY. + * The holdability of the created result sets can be determined by + * calling {@link #getHoldability}. + * + * @param sql an SQL statement that may contain one or more '?' IN + * parameter placeholders + * @param columnNames an array of column names indicating the columns + * that should be returned from the inserted row or rows + * @return a new PreparedStatement object, containing the + * pre-compiled statement, that is capable of returning the + * auto-generated keys designated by the given array of column + * names + * @exception SQLException if a database access error occurs + * or this method is called on a closed connection + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * + * @since 1.4 + */ + PreparedStatement prepareStatement(String sql, String columnNames[]) + throws SQLException; + + /** + * Constructs an object that implements the Clob interface. The object + * returned initially contains no data. The setAsciiStream, + * setCharacterStream and setString methods of + * the Clob interface may be used to add data to the Clob. + * @return An object that implements the Clob interface + * @throws SQLException if an object that implements the + * Clob interface can not be constructed, this method is + * called on a closed connection or a database access error occurs. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this data type + * + * @since 1.6 + */ + Clob createClob() throws SQLException; + + /** + * Constructs an object that implements the Blob interface. The object + * returned initially contains no data. The setBinaryStream and + * setBytes methods of the Blob interface may be used to add data to + * the Blob. + * @return An object that implements the Blob interface + * @throws SQLException if an object that implements the + * Blob interface can not be constructed, this method is + * called on a closed connection or a database access error occurs. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this data type + * + * @since 1.6 + */ + Blob createBlob() throws SQLException; + + /** + * Constructs an object that implements the NClob interface. The object + * returned initially contains no data. The setAsciiStream, + * setCharacterStream and setString methods of the NClob interface may + * be used to add data to the NClob. + * @return An object that implements the NClob interface + * @throws SQLException if an object that implements the + * NClob interface can not be constructed, this method is + * called on a closed connection or a database access error occurs. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this data type + * + * @since 1.6 + */ + NClob createNClob() throws SQLException; + + /** + * Constructs an object that implements the SQLXML interface. The object + * returned initially contains no data. The createXmlStreamWriter object and + * setString method of the SQLXML interface may be used to add data to the SQLXML + * object. + * @return An object that implements the SQLXML interface + * @throws SQLException if an object that implements the SQLXML interface can not + * be constructed, this method is + * called on a closed connection or a database access error occurs. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this data type + * @since 1.6 + */ + SQLXML createSQLXML() throws SQLException; + + /** + * Returns true if the connection has not been closed and is still valid. + * The driver shall submit a query on the connection or use some other + * mechanism that positively verifies the connection is still valid when + * this method is called. + *

+ * The query submitted by the driver to validate the connection shall be + * executed in the context of the current transaction. + * + * @param timeout - The time in seconds to wait for the database operation + * used to validate the connection to complete. If + * the timeout period expires before the operation + * completes, this method returns false. A value of + * 0 indicates a timeout is not applied to the + * database operation. + *

+ * @return true if the connection is valid, false otherwise + * @exception SQLException if the value supplied for timeout + * is less then 0 + * @since 1.6 + *

+ * @see java.sql.DatabaseMetaData#getClientInfoProperties + */ + boolean isValid(int timeout) throws SQLException; + + /** + * Sets the value of the client info property specified by name to the + * value specified by value. + *

+ * Applications may use the DatabaseMetaData.getClientInfoProperties + * method to determine the client info properties supported by the driver + * and the maximum length that may be specified for each property. + *

+ * The driver stores the value specified in a suitable location in the + * database. For example in a special register, session parameter, or + * system table column. For efficiency the driver may defer setting the + * value in the database until the next time a statement is executed or + * prepared. Other than storing the client information in the appropriate + * place in the database, these methods shall not alter the behavior of + * the connection in anyway. The values supplied to these methods are + * used for accounting, diagnostics and debugging purposes only. + *

+ * The driver shall generate a warning if the client info name specified + * is not recognized by the driver. + *

+ * If the value specified to this method is greater than the maximum + * length for the property the driver may either truncate the value and + * generate a warning or generate a SQLClientInfoException. If the driver + * generates a SQLClientInfoException, the value specified was not set on the + * connection. + *

+ * The following are standard client info properties. Drivers are not + * required to support these properties however if the driver supports a + * client info property that can be described by one of the standard + * properties, the standard property name should be used. + *

+ *

    + *
  • ApplicationName - The name of the application currently utilizing + * the connection
  • + *
  • ClientUser - The name of the user that the application using + * the connection is performing work for. This may + * not be the same as the user name that was used + * in establishing the connection.
  • + *
  • ClientHostname - The hostname of the computer the application + * using the connection is running on.
  • + *
+ *

+ * @param name The name of the client info property to set + * @param value The value to set the client info property to. If the + * value is null, the current value of the specified + * property is cleared. + *

+ * @throws SQLClientInfoException if the database server returns an error while + * setting the client info value on the database server or this method + * is called on a closed connection + *

+ * @since 1.6 + */ + void setClientInfo(String name, String value) + throws SQLClientInfoException; + + /** + * Sets the value of the connection's client info properties. The + * Properties object contains the names and values of the client info + * properties to be set. The set of client info properties contained in + * the properties list replaces the current set of client info properties + * on the connection. If a property that is currently set on the + * connection is not present in the properties list, that property is + * cleared. Specifying an empty properties list will clear all of the + * properties on the connection. See setClientInfo (String, String) for + * more information. + *

+ * If an error occurs in setting any of the client info properties, a + * SQLClientInfoException is thrown. The SQLClientInfoException + * contains information indicating which client info properties were not set. + * The state of the client information is unknown because + * some databases do not allow multiple client info properties to be set + * atomically. For those databases, one or more properties may have been + * set before the error occurred. + *

+ * + * @param properties the list of client info properties to set + *

+ * @see java.sql.Connection#setClientInfo(String, String) setClientInfo(String, String) + * @since 1.6 + *

+ * @throws SQLClientInfoException if the database server returns an error while + * setting the clientInfo values on the database server or this method + * is called on a closed connection + *

+ */ + void setClientInfo(Properties properties) + throws SQLClientInfoException; + + /** + * Returns the value of the client info property specified by name. This + * method may return null if the specified client info property has not + * been set and does not have a default value. This method will also + * return null if the specified client info property name is not supported + * by the driver. + *

+ * Applications may use the DatabaseMetaData.getClientInfoProperties + * method to determine the client info properties supported by the driver. + *

+ * @param name The name of the client info property to retrieve + *

+ * @return The value of the client info property specified + *

+ * @throws SQLException if the database server returns an error when + * fetching the client info value from the database + *or this method is called on a closed connection + *

+ * @since 1.6 + *

+ * @see java.sql.DatabaseMetaData#getClientInfoProperties + */ + String getClientInfo(String name) + throws SQLException; + + /** + * Returns a list containing the name and current value of each client info + * property supported by the driver. The value of a client info property + * may be null if the property has not been set and does not have a + * default value. + *

+ * @return A Properties object that contains the name and current value of + * each of the client info properties supported by the driver. + *

+ * @throws SQLException if the database server returns an error when + * fetching the client info values from the database + * or this method is called on a closed connection + *

+ * @since 1.6 + */ + Properties getClientInfo() + throws SQLException; + +/** + * Factory method for creating Array objects. + *

+ * Note: When createArrayOf is used to create an array object + * that maps to a primitive data type, then it is implementation-defined + * whether the Array object is an array of that primitive + * data type or an array of Object. + *

+ * Note: The JDBC driver is responsible for mapping the elements + * Object array to the default JDBC SQL type defined in + * java.sql.Types for the given class of Object. The default + * mapping is specified in Appendix B of the JDBC specification. If the + * resulting JDBC type is not the appropriate type for the given typeName then + * it is implementation defined whether an SQLException is + * thrown or the driver supports the resulting conversion. + * + * @param typeName the SQL name of the type the elements of the array map to. The typeName is a + * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This + * is the value returned by Array.getBaseTypeName + * @param elements the elements that populate the returned object + * @return an Array object whose elements map to the specified SQL type + * @throws SQLException if a database error occurs, the JDBC type is not + * appropriate for the typeName and the conversion is not supported, the typeName is null or this method is called on a closed connection + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type + * @since 1.6 + */ + Array createArrayOf(String typeName, Object[] elements) throws +SQLException; + +/** + * Factory method for creating Struct objects. + * + * @param typeName the SQL type name of the SQL structured type that this Struct + * object maps to. The typeName is the name of a user-defined type that + * has been defined for this database. It is the value returned by + * Struct.getSQLTypeName. + + * @param attributes the attributes that populate the returned object + * @return a Struct object that maps to the given SQL type and is populated with the given attributes + * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type + * @since 1.6 + */ + Struct createStruct(String typeName, Object[] attributes) +throws SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DataTruncation.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DataTruncation.java new file mode 100644 index 0000000000..09d43ac601 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DataTruncation.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * An exception thrown as a DataTruncation exception + * (on writes) or reported as a + * DataTruncation warning (on reads) + * when a data values is unexpectedly truncated for reasons other than its having + * execeeded MaxFieldSize. + * + *

The SQLstate for a DataTruncation during read is 01004. + *

The SQLstate for a DataTruncation during write is 22001. + */ + +public class DataTruncation extends SQLWarning { + + /** + * Creates a DataTruncation object + * with the SQLState initialized + * to 01004 when read is set to true and 22001 + * when read is set to false, + * the reason set to "Data truncation", the + * vendor code set to 0, and + * the other fields set to the given values. + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @param index The index of the parameter or column value + * @param parameter true if a parameter value was truncated + * @param read true if a read was truncated + * @param dataSize the original size of the data + * @param transferSize the size after truncation + */ + public DataTruncation(int index, boolean parameter, + boolean read, int dataSize, + int transferSize) { + super("Data truncation", read == true?"01004":"22001"); + this.index = index; + this.parameter = parameter; + this.read = read; + this.dataSize = dataSize; + this.transferSize = transferSize; + + } + + /** + * Creates a DataTruncation object + * with the SQLState initialized + * to 01004 when read is set to true and 22001 + * when read is set to false, + * the reason set to "Data truncation", the + * vendor code set to 0, and + * the other fields set to the given values. + *

+ * + * @param index The index of the parameter or column value + * @param parameter true if a parameter value was truncated + * @param read true if a read was truncated + * @param dataSize the original size of the data + * @param transferSize the size after truncation + * @param cause the underlying reason for this DataTruncation + * (which is saved for later retrieval by the getCause() method); + * may be null indicating the cause is non-existent or unknown. + * + * @since 1.6 + */ + public DataTruncation(int index, boolean parameter, + boolean read, int dataSize, + int transferSize, Throwable cause) { + super("Data truncation", read == true?"01004":"22001",cause); + this.index = index; + this.parameter = parameter; + this.read = read; + this.dataSize = dataSize; + this.transferSize = transferSize; + } + + /** + * Retrieves the index of the column or parameter that was truncated. + * + *

This may be -1 if the column or parameter index is unknown, in + * which case the parameter and read fields should be ignored. + * + * @return the index of the truncated paramter or column value + */ + public int getIndex() { + return index; + } + + /** + * Indicates whether the value truncated was a parameter value or + * a column value. + * + * @return true if the value truncated was a parameter; + * false if it was a column value + */ + public boolean getParameter() { + return parameter; + } + + /** + * Indicates whether or not the value was truncated on a read. + * + * @return true if the value was truncated when read from + * the database; false if the data was truncated on a write + */ + public boolean getRead() { + return read; + } + + /** + * Gets the number of bytes of data that should have been transferred. + * This number may be approximate if data conversions were being + * performed. The value may be -1 if the size is unknown. + * + * @return the number of bytes of data that should have been transferred + */ + public int getDataSize() { + return dataSize; + } + + /** + * Gets the number of bytes of data actually transferred. + * The value may be -1 if the size is unknown. + * + * @return the number of bytes of data actually transferred + */ + public int getTransferSize() { + return transferSize; + } + + /** + * @serial + */ + private int index; + + /** + * @serial + */ + private boolean parameter; + + /** + * @serial + */ + private boolean read; + + /** + * @serial + */ + private int dataSize; + + /** + * @serial + */ + private int transferSize; + + /** + * @serial + */ + private static final long serialVersionUID = 6464298989504059473L; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DatabaseMetaData.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DatabaseMetaData.java new file mode 100644 index 0000000000..98101ce882 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DatabaseMetaData.java @@ -0,0 +1,3577 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package java.sql; + +/** + * Comprehensive information about the database as a whole. + *

+ * This interface is implemented by driver vendors to let users know the capabilities + * of a Database Management System (DBMS) in combination with + * the driver based on JDBCTM technology + * ("JDBC driver") that is used with it. Different relational DBMSs often support + * different features, implement features in different ways, and use different + * data types. In addition, a driver may implement a feature on top of what the + * DBMS offers. Information returned by methods in this interface applies + * to the capabilities of a particular driver and a particular DBMS working + * together. Note that as used in this documentation, the term "database" is + * used generically to refer to both the driver and DBMS. + *

+ * A user for this interface is commonly a tool that needs to discover how to + * deal with the underlying DBMS. This is especially true for applications + * that are intended to be used with more than one DBMS. For example, a tool might use the method + * getTypeInfo to find out what data types can be used in a + * CREATE TABLE statement. Or a user might call the method + * supportsCorrelatedSubqueries to see if it is possible to use + * a correlated subquery or supportsBatchUpdates to see if it is + * possible to use batch updates. + *

+ * Some DatabaseMetaData methods return lists of information + * in the form of ResultSet objects. + * Regular ResultSet methods, such as + * getString and getInt, can be used + * to retrieve the data from these ResultSet objects. If + * a given form of metadata is not available, an empty ResultSet + * will be returned. Additional columns beyond the columns defined to be + * returned by the ResultSet object for a given method + * can be defined by the JDBC driver vendor and must be accessed + * by their column label. + *

+ * Some DatabaseMetaData methods take arguments that are + * String patterns. These arguments all have names such as fooPattern. + * Within a pattern String, "%" means match any substring of 0 or more + * characters, and "_" means match any one character. Only metadata + * entries matching the search pattern are returned. If a search pattern + * argument is set to null, that argument's criterion will + * be dropped from the search. + *

+ */ +public interface DatabaseMetaData extends Wrapper { + + //---------------------------------------------------------------------- + // First, a variety of minor information about the target database. + + /** + * Retrieves whether the current user can call all the procedures + * returned by the method getProcedures. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean allProceduresAreCallable() throws SQLException; + + /** + * Retrieves whether the current user can use all the tables returned + * by the method getTables in a SELECT + * statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean allTablesAreSelectable() throws SQLException; + + /** + * Retrieves the URL for this DBMS. + * + * @return the URL for this DBMS or null if it cannot be + * generated + * @exception SQLException if a database access error occurs + */ + String getURL() throws SQLException; + + /** + * Retrieves the user name as known to this database. + * + * @return the database user name + * @exception SQLException if a database access error occurs + */ + String getUserName() throws SQLException; + + /** + * Retrieves whether this database is in read-only mode. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isReadOnly() throws SQLException; + + /** + * Retrieves whether NULL values are sorted high. + * Sorted high means that NULL values + * sort higher than any other value in a domain. In an ascending order, + * if this method returns true, NULL values + * will appear at the end. By contrast, the method + * nullsAreSortedAtEnd indicates whether NULL values + * are sorted at the end regardless of sort order. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean nullsAreSortedHigh() throws SQLException; + + /** + * Retrieves whether NULL values are sorted low. + * Sorted low means that NULL values + * sort lower than any other value in a domain. In an ascending order, + * if this method returns true, NULL values + * will appear at the beginning. By contrast, the method + * nullsAreSortedAtStart indicates whether NULL values + * are sorted at the beginning regardless of sort order. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean nullsAreSortedLow() throws SQLException; + + /** + * Retrieves whether NULL values are sorted at the start regardless + * of sort order. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean nullsAreSortedAtStart() throws SQLException; + + /** + * Retrieves whether NULL values are sorted at the end regardless of + * sort order. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean nullsAreSortedAtEnd() throws SQLException; + + /** + * Retrieves the name of this database product. + * + * @return database product name + * @exception SQLException if a database access error occurs + */ + String getDatabaseProductName() throws SQLException; + + /** + * Retrieves the version number of this database product. + * + * @return database version number + * @exception SQLException if a database access error occurs + */ + String getDatabaseProductVersion() throws SQLException; + + /** + * Retrieves the name of this JDBC driver. + * + * @return JDBC driver name + * @exception SQLException if a database access error occurs + */ + String getDriverName() throws SQLException; + + /** + * Retrieves the version number of this JDBC driver as a String. + * + * @return JDBC driver version + * @exception SQLException if a database access error occurs + */ + String getDriverVersion() throws SQLException; + + /** + * Retrieves this JDBC driver's major version number. + * + * @return JDBC driver major version + */ + int getDriverMajorVersion(); + + /** + * Retrieves this JDBC driver's minor version number. + * + * @return JDBC driver minor version number + */ + int getDriverMinorVersion(); + + /** + * Retrieves whether this database stores tables in a local file. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean usesLocalFiles() throws SQLException; + + /** + * Retrieves whether this database uses a file for each table. + * + * @return true if this database uses a local file for each table; + * false otherwise + * @exception SQLException if a database access error occurs + */ + boolean usesLocalFilePerTable() throws SQLException; + + /** + * Retrieves whether this database treats mixed case unquoted SQL identifiers as + * case sensitive and as a result stores them in mixed case. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsMixedCaseIdentifiers() throws SQLException; + + /** + * Retrieves whether this database treats mixed case unquoted SQL identifiers as + * case insensitive and stores them in upper case. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean storesUpperCaseIdentifiers() throws SQLException; + + /** + * Retrieves whether this database treats mixed case unquoted SQL identifiers as + * case insensitive and stores them in lower case. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean storesLowerCaseIdentifiers() throws SQLException; + + /** + * Retrieves whether this database treats mixed case unquoted SQL identifiers as + * case insensitive and stores them in mixed case. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean storesMixedCaseIdentifiers() throws SQLException; + + /** + * Retrieves whether this database treats mixed case quoted SQL identifiers as + * case sensitive and as a result stores them in mixed case. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsMixedCaseQuotedIdentifiers() throws SQLException; + + /** + * Retrieves whether this database treats mixed case quoted SQL identifiers as + * case insensitive and stores them in upper case. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean storesUpperCaseQuotedIdentifiers() throws SQLException; + + /** + * Retrieves whether this database treats mixed case quoted SQL identifiers as + * case insensitive and stores them in lower case. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean storesLowerCaseQuotedIdentifiers() throws SQLException; + + /** + * Retrieves whether this database treats mixed case quoted SQL identifiers as + * case insensitive and stores them in mixed case. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean storesMixedCaseQuotedIdentifiers() throws SQLException; + + /** + * Retrieves the string used to quote SQL identifiers. + * This method returns a space " " if identifier quoting is not supported. + * + * @return the quoting string or a space if quoting is not supported + * @exception SQLException if a database access error occurs + */ + String getIdentifierQuoteString() throws SQLException; + + /** + * Retrieves a comma-separated list of all of this database's SQL keywords + * that are NOT also SQL:2003 keywords. + * + * @return the list of this database's keywords that are not also + * SQL:2003 keywords + * @exception SQLException if a database access error occurs + */ + String getSQLKeywords() throws SQLException; + + /** + * Retrieves a comma-separated list of math functions available with + * this database. These are the Open /Open CLI math function names used in + * the JDBC function escape clause. + * + * @return the list of math functions supported by this database + * @exception SQLException if a database access error occurs + */ + String getNumericFunctions() throws SQLException; + + /** + * Retrieves a comma-separated list of string functions available with + * this database. These are the Open Group CLI string function names used + * in the JDBC function escape clause. + * + * @return the list of string functions supported by this database + * @exception SQLException if a database access error occurs + */ + String getStringFunctions() throws SQLException; + + /** + * Retrieves a comma-separated list of system functions available with + * this database. These are the Open Group CLI system function names used + * in the JDBC function escape clause. + * + * @return a list of system functions supported by this database + * @exception SQLException if a database access error occurs + */ + String getSystemFunctions() throws SQLException; + + /** + * Retrieves a comma-separated list of the time and date functions available + * with this database. + * + * @return the list of time and date functions supported by this database + * @exception SQLException if a database access error occurs + */ + String getTimeDateFunctions() throws SQLException; + + /** + * Retrieves the string that can be used to escape wildcard characters. + * This is the string that can be used to escape '_' or '%' in + * the catalog search parameters that are a pattern (and therefore use one + * of the wildcard characters). + * + *

The '_' character represents any single character; + * the '%' character represents any sequence of zero or + * more characters. + * + * @return the string used to escape wildcard characters + * @exception SQLException if a database access error occurs + */ + String getSearchStringEscape() throws SQLException; + + /** + * Retrieves all the "extra" characters that can be used in unquoted + * identifier names (those beyond a-z, A-Z, 0-9 and _). + * + * @return the string containing the extra characters + * @exception SQLException if a database access error occurs + */ + String getExtraNameCharacters() throws SQLException; + + //-------------------------------------------------------------------- + // Functions describing which features are supported. + + /** + * Retrieves whether this database supports ALTER TABLE + * with add column. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsAlterTableWithAddColumn() throws SQLException; + + /** + * Retrieves whether this database supports ALTER TABLE + * with drop column. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsAlterTableWithDropColumn() throws SQLException; + + /** + * Retrieves whether this database supports column aliasing. + * + *

If so, the SQL AS clause can be used to provide names for + * computed columns or to provide alias names for columns as + * required. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsColumnAliasing() throws SQLException; + + /** + * Retrieves whether this database supports concatenations between + * NULL and non-NULL values being + * NULL. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean nullPlusNonNullIsNull() throws SQLException; + + /** + * Retrieves whether this database supports the JDBC scalar function + * CONVERT for the conversion of one JDBC type to another. + * The JDBC types are the generic SQL data types defined + * in java.sql.Types. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsConvert() throws SQLException; + + /** + * Retrieves whether this database supports the JDBC scalar function + * CONVERT for conversions between the JDBC types fromType + * and toType. The JDBC types are the generic SQL data types defined + * in java.sql.Types. + * + * @param fromType the type to convert from; one of the type codes from + * the class java.sql.Types + * @param toType the type to convert to; one of the type codes from + * the class java.sql.Types + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + * @see Types + */ + boolean supportsConvert(int fromType, int toType) throws SQLException; + + /** + * Retrieves whether this database supports table correlation names. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsTableCorrelationNames() throws SQLException; + + /** + * Retrieves whether, when table correlation names are supported, they + * are restricted to being different from the names of the tables. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsDifferentTableCorrelationNames() throws SQLException; + + /** + * Retrieves whether this database supports expressions in + * ORDER BY lists. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsExpressionsInOrderBy() throws SQLException; + + /** + * Retrieves whether this database supports using a column that is + * not in the SELECT statement in an + * ORDER BY clause. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsOrderByUnrelated() throws SQLException; + + /** + * Retrieves whether this database supports some form of + * GROUP BY clause. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsGroupBy() throws SQLException; + + /** + * Retrieves whether this database supports using a column that is + * not in the SELECT statement in a + * GROUP BY clause. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsGroupByUnrelated() throws SQLException; + + /** + * Retrieves whether this database supports using columns not included in + * the SELECT statement in a GROUP BY clause + * provided that all of the columns in the SELECT statement + * are included in the GROUP BY clause. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsGroupByBeyondSelect() throws SQLException; + + /** + * Retrieves whether this database supports specifying a + * LIKE escape clause. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsLikeEscapeClause() throws SQLException; + + /** + * Retrieves whether this database supports getting multiple + * ResultSet objects from a single call to the + * method execute. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsMultipleResultSets() throws SQLException; + + /** + * Retrieves whether this database allows having multiple + * transactions open at once (on different connections). + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsMultipleTransactions() throws SQLException; + + /** + * Retrieves whether columns in this database may be defined as non-nullable. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsNonNullableColumns() throws SQLException; + + /** + * Retrieves whether this database supports the ODBC Minimum SQL grammar. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsMinimumSQLGrammar() throws SQLException; + + /** + * Retrieves whether this database supports the ODBC Core SQL grammar. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsCoreSQLGrammar() throws SQLException; + + /** + * Retrieves whether this database supports the ODBC Extended SQL grammar. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsExtendedSQLGrammar() throws SQLException; + + /** + * Retrieves whether this database supports the ANSI92 entry level SQL + * grammar. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsANSI92EntryLevelSQL() throws SQLException; + + /** + * Retrieves whether this database supports the ANSI92 intermediate SQL grammar supported. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsANSI92IntermediateSQL() throws SQLException; + + /** + * Retrieves whether this database supports the ANSI92 full SQL grammar supported. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsANSI92FullSQL() throws SQLException; + + /** + * Retrieves whether this database supports the SQL Integrity + * Enhancement Facility. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsIntegrityEnhancementFacility() throws SQLException; + + /** + * Retrieves whether this database supports some form of outer join. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsOuterJoins() throws SQLException; + + /** + * Retrieves whether this database supports full nested outer joins. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsFullOuterJoins() throws SQLException; + + /** + * Retrieves whether this database provides limited support for outer + * joins. (This will be true if the method + * supportsFullOuterJoins returns true). + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsLimitedOuterJoins() throws SQLException; + + /** + * Retrieves the database vendor's preferred term for "schema". + * + * @return the vendor term for "schema" + * @exception SQLException if a database access error occurs + */ + String getSchemaTerm() throws SQLException; + + /** + * Retrieves the database vendor's preferred term for "procedure". + * + * @return the vendor term for "procedure" + * @exception SQLException if a database access error occurs + */ + String getProcedureTerm() throws SQLException; + + /** + * Retrieves the database vendor's preferred term for "catalog". + * + * @return the vendor term for "catalog" + * @exception SQLException if a database access error occurs + */ + String getCatalogTerm() throws SQLException; + + /** + * Retrieves whether a catalog appears at the start of a fully qualified + * table name. If not, the catalog appears at the end. + * + * @return true if the catalog name appears at the beginning + * of a fully qualified table name; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isCatalogAtStart() throws SQLException; + + /** + * Retrieves the String that this database uses as the + * separator between a catalog and table name. + * + * @return the separator string + * @exception SQLException if a database access error occurs + */ + String getCatalogSeparator() throws SQLException; + + /** + * Retrieves whether a schema name can be used in a data manipulation statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSchemasInDataManipulation() throws SQLException; + + /** + * Retrieves whether a schema name can be used in a procedure call statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSchemasInProcedureCalls() throws SQLException; + + /** + * Retrieves whether a schema name can be used in a table definition statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSchemasInTableDefinitions() throws SQLException; + + /** + * Retrieves whether a schema name can be used in an index definition statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSchemasInIndexDefinitions() throws SQLException; + + /** + * Retrieves whether a schema name can be used in a privilege definition statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSchemasInPrivilegeDefinitions() throws SQLException; + + /** + * Retrieves whether a catalog name can be used in a data manipulation statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsCatalogsInDataManipulation() throws SQLException; + + /** + * Retrieves whether a catalog name can be used in a procedure call statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsCatalogsInProcedureCalls() throws SQLException; + + /** + * Retrieves whether a catalog name can be used in a table definition statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsCatalogsInTableDefinitions() throws SQLException; + + /** + * Retrieves whether a catalog name can be used in an index definition statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsCatalogsInIndexDefinitions() throws SQLException; + + /** + * Retrieves whether a catalog name can be used in a privilege definition statement. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException; + + + /** + * Retrieves whether this database supports positioned DELETE + * statements. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsPositionedDelete() throws SQLException; + + /** + * Retrieves whether this database supports positioned UPDATE + * statements. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsPositionedUpdate() throws SQLException; + + /** + * Retrieves whether this database supports SELECT FOR UPDATE + * statements. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSelectForUpdate() throws SQLException; + + /** + * Retrieves whether this database supports stored procedure calls + * that use the stored procedure escape syntax. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsStoredProcedures() throws SQLException; + + /** + * Retrieves whether this database supports subqueries in comparison + * expressions. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSubqueriesInComparisons() throws SQLException; + + /** + * Retrieves whether this database supports subqueries in + * EXISTS expressions. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSubqueriesInExists() throws SQLException; + + /** + * Retrieves whether this database supports subqueries in + * IN expressions. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSubqueriesInIns() throws SQLException; + + /** + * Retrieves whether this database supports subqueries in quantified + * expressions. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsSubqueriesInQuantifieds() throws SQLException; + + /** + * Retrieves whether this database supports correlated subqueries. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsCorrelatedSubqueries() throws SQLException; + + /** + * Retrieves whether this database supports SQL UNION. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsUnion() throws SQLException; + + /** + * Retrieves whether this database supports SQL UNION ALL. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsUnionAll() throws SQLException; + + /** + * Retrieves whether this database supports keeping cursors open + * across commits. + * + * @return true if cursors always remain open; + * false if they might not remain open + * @exception SQLException if a database access error occurs + */ + boolean supportsOpenCursorsAcrossCommit() throws SQLException; + + /** + * Retrieves whether this database supports keeping cursors open + * across rollbacks. + * + * @return true if cursors always remain open; + * false if they might not remain open + * @exception SQLException if a database access error occurs + */ + boolean supportsOpenCursorsAcrossRollback() throws SQLException; + + /** + * Retrieves whether this database supports keeping statements open + * across commits. + * + * @return true if statements always remain open; + * false if they might not remain open + * @exception SQLException if a database access error occurs + */ + boolean supportsOpenStatementsAcrossCommit() throws SQLException; + + /** + * Retrieves whether this database supports keeping statements open + * across rollbacks. + * + * @return true if statements always remain open; + * false if they might not remain open + * @exception SQLException if a database access error occurs + */ + boolean supportsOpenStatementsAcrossRollback() throws SQLException; + + + + //---------------------------------------------------------------------- + // The following group of methods exposes various limitations + // based on the target database with the current driver. + // Unless otherwise specified, a result of zero means there is no + // limit, or the limit is not known. + + /** + * Retrieves the maximum number of hex characters this database allows in an + * inline binary literal. + * + * @return max the maximum length (in hex characters) for a binary literal; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxBinaryLiteralLength() throws SQLException; + + /** + * Retrieves the maximum number of characters this database allows + * for a character literal. + * + * @return the maximum number of characters allowed for a character literal; + * a result of zero means that there is no limit or the limit is + * not known + * @exception SQLException if a database access error occurs + */ + int getMaxCharLiteralLength() throws SQLException; + + /** + * Retrieves the maximum number of characters this database allows + * for a column name. + * + * @return the maximum number of characters allowed for a column name; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxColumnNameLength() throws SQLException; + + /** + * Retrieves the maximum number of columns this database allows in a + * GROUP BY clause. + * + * @return the maximum number of columns allowed; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxColumnsInGroupBy() throws SQLException; + + /** + * Retrieves the maximum number of columns this database allows in an index. + * + * @return the maximum number of columns allowed; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxColumnsInIndex() throws SQLException; + + /** + * Retrieves the maximum number of columns this database allows in an + * ORDER BY clause. + * + * @return the maximum number of columns allowed; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxColumnsInOrderBy() throws SQLException; + + /** + * Retrieves the maximum number of columns this database allows in a + * SELECT list. + * + * @return the maximum number of columns allowed; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxColumnsInSelect() throws SQLException; + + /** + * Retrieves the maximum number of columns this database allows in a table. + * + * @return the maximum number of columns allowed; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxColumnsInTable() throws SQLException; + + /** + * Retrieves the maximum number of concurrent connections to this + * database that are possible. + * + * @return the maximum number of active connections possible at one time; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxConnections() throws SQLException; + + /** + * Retrieves the maximum number of characters that this database allows in a + * cursor name. + * + * @return the maximum number of characters allowed in a cursor name; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxCursorNameLength() throws SQLException; + + /** + * Retrieves the maximum number of bytes this database allows for an + * index, including all of the parts of the index. + * + * @return the maximum number of bytes allowed; this limit includes the + * composite of all the constituent parts of the index; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxIndexLength() throws SQLException; + + /** + * Retrieves the maximum number of characters that this database allows in a + * schema name. + * + * @return the maximum number of characters allowed in a schema name; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxSchemaNameLength() throws SQLException; + + /** + * Retrieves the maximum number of characters that this database allows in a + * procedure name. + * + * @return the maximum number of characters allowed in a procedure name; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxProcedureNameLength() throws SQLException; + + /** + * Retrieves the maximum number of characters that this database allows in a + * catalog name. + * + * @return the maximum number of characters allowed in a catalog name; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxCatalogNameLength() throws SQLException; + + /** + * Retrieves the maximum number of bytes this database allows in + * a single row. + * + * @return the maximum number of bytes allowed for a row; a result of + * zero means that there is no limit or the limit is not known + * @exception SQLException if a database access error occurs + */ + int getMaxRowSize() throws SQLException; + + /** + * Retrieves whether the return value for the method + * getMaxRowSize includes the SQL data types + * LONGVARCHAR and LONGVARBINARY. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean doesMaxRowSizeIncludeBlobs() throws SQLException; + + /** + * Retrieves the maximum number of characters this database allows in + * an SQL statement. + * + * @return the maximum number of characters allowed for an SQL statement; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxStatementLength() throws SQLException; + + /** + * Retrieves the maximum number of active statements to this database + * that can be open at the same time. + * + * @return the maximum number of statements that can be open at one time; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxStatements() throws SQLException; + + /** + * Retrieves the maximum number of characters this database allows in + * a table name. + * + * @return the maximum number of characters allowed for a table name; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxTableNameLength() throws SQLException; + + /** + * Retrieves the maximum number of tables this database allows in a + * SELECT statement. + * + * @return the maximum number of tables allowed in a SELECT + * statement; a result of zero means that there is no limit or + * the limit is not known + * @exception SQLException if a database access error occurs + */ + int getMaxTablesInSelect() throws SQLException; + + /** + * Retrieves the maximum number of characters this database allows in + * a user name. + * + * @return the maximum number of characters allowed for a user name; + * a result of zero means that there is no limit or the limit + * is not known + * @exception SQLException if a database access error occurs + */ + int getMaxUserNameLength() throws SQLException; + + //---------------------------------------------------------------------- + + /** + * Retrieves this database's default transaction isolation level. The + * possible values are defined in java.sql.Connection. + * + * @return the default isolation level + * @exception SQLException if a database access error occurs + * @see Connection + */ + int getDefaultTransactionIsolation() throws SQLException; + + /** + * Retrieves whether this database supports transactions. If not, invoking the + * method commit is a noop, and the isolation level is + * TRANSACTION_NONE. + * + * @return true if transactions are supported; + * false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsTransactions() throws SQLException; + + /** + * Retrieves whether this database supports the given transaction isolation level. + * + * @param level one of the transaction isolation levels defined in + * java.sql.Connection + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + * @see Connection + */ + boolean supportsTransactionIsolationLevel(int level) + throws SQLException; + + /** + * Retrieves whether this database supports both data definition and + * data manipulation statements within a transaction. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsDataDefinitionAndDataManipulationTransactions() + throws SQLException; + /** + * Retrieves whether this database supports only data manipulation + * statements within a transaction. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean supportsDataManipulationTransactionsOnly() + throws SQLException; + + /** + * Retrieves whether a data definition statement within a transaction forces + * the transaction to commit. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean dataDefinitionCausesTransactionCommit() + throws SQLException; + + /** + * Retrieves whether this database ignores a data definition statement + * within a transaction. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean dataDefinitionIgnoredInTransactions() + throws SQLException; + + /** + * Retrieves a description of the stored procedures available in the given + * catalog. + *

+ * Only procedure descriptions matching the schema and + * procedure name criteria are returned. They are ordered by + * PROCEDURE_CAT, PROCEDURE_SCHEM, + * PROCEDURE_NAME and SPECIFIC_ NAME. + * + *

Each procedure description has the the following columns: + *

    + *
  1. PROCEDURE_CAT String => procedure catalog (may be null) + *
  2. PROCEDURE_SCHEM String => procedure schema (may be null) + *
  3. PROCEDURE_NAME String => procedure name + *
  4. reserved for future use + *
  5. reserved for future use + *
  6. reserved for future use + *
  7. REMARKS String => explanatory comment on the procedure + *
  8. PROCEDURE_TYPE short => kind of procedure: + *
      + *
    • procedureResultUnknown - Cannot determine if a return value + * will be returned + *
    • procedureNoResult - Does not return a return value + *
    • procedureReturnsResult - Returns a return value + *
    + *
  9. SPECIFIC_NAME String => The name which uniquely identifies this + * procedure within its schema. + *
+ *

+ * A user may not have permissions to execute any of the procedures that are + * returned by getProcedures + * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param procedureNamePattern a procedure name pattern; must match the + * procedure name as it is stored in the database + * @return ResultSet - each row is a procedure description + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + */ + ResultSet getProcedures(String catalog, String schemaPattern, + String procedureNamePattern) throws SQLException; + + /** + * Indicates that it is not known whether the procedure returns + * a result. + *

+ * A possible value for column PROCEDURE_TYPE in the + * ResultSet object returned by the method + * getProcedures. + */ + int procedureResultUnknown = 0; + + /** + * Indicates that the procedure does not return a result. + *

+ * A possible value for column PROCEDURE_TYPE in the + * ResultSet object returned by the method + * getProcedures. + */ + int procedureNoResult = 1; + + /** + * Indicates that the procedure returns a result. + *

+ * A possible value for column PROCEDURE_TYPE in the + * ResultSet object returned by the method + * getProcedures. + */ + int procedureReturnsResult = 2; + + /** + * Retrieves a description of the given catalog's stored procedure parameter + * and result columns. + * + *

Only descriptions matching the schema, procedure and + * parameter name criteria are returned. They are ordered by + * PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME and SPECIFIC_NAME. Within this, the return value, + * if any, is first. Next are the parameter descriptions in call + * order. The column descriptions follow in column number order. + * + *

Each row in the ResultSet is a parameter description or + * column description with the following fields: + *

    + *
  1. PROCEDURE_CAT String => procedure catalog (may be null) + *
  2. PROCEDURE_SCHEM String => procedure schema (may be null) + *
  3. PROCEDURE_NAME String => procedure name + *
  4. COLUMN_NAME String => column/parameter name + *
  5. COLUMN_TYPE Short => kind of column/parameter: + *
      + *
    • procedureColumnUnknown - nobody knows + *
    • procedureColumnIn - IN parameter + *
    • procedureColumnInOut - INOUT parameter + *
    • procedureColumnOut - OUT parameter + *
    • procedureColumnReturn - procedure return value + *
    • procedureColumnResult - result column in ResultSet + *
    + *
  6. DATA_TYPE int => SQL type from java.sql.Types + *
  7. TYPE_NAME String => SQL type name, for a UDT type the + * type name is fully qualified + *
  8. PRECISION int => precision + *
  9. LENGTH int => length in bytes of data + *
  10. SCALE short => scale - null is returned for data types where + * SCALE is not applicable. + *
  11. RADIX short => radix + *
  12. NULLABLE short => can it contain NULL. + *
      + *
    • procedureNoNulls - does not allow NULL values + *
    • procedureNullable - allows NULL values + *
    • procedureNullableUnknown - nullability unknown + *
    + *
  13. REMARKS String => comment describing parameter/column + *
  14. COLUMN_DEF String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null) + *
      + *
    • The string NULL (not enclosed in quotes) - if NULL was specified as the default value + *
    • TRUNCATE (not enclosed in quotes) - if the specified default value cannot be represented without truncation + *
    • NULL - if a default value was not specified + *
    + *
  15. SQL_DATA_TYPE int => reserved for future use + *
  16. SQL_DATETIME_SUB int => reserved for future use + *
  17. CHAR_OCTET_LENGTH int => the maximum length of binary and character based columns. For any other datatype the returned value is a + * NULL + *
  18. ORDINAL_POSITION int => the ordinal position, starting from 1, for the input and output parameters for a procedure. A value of 0 + *is returned if this row describes the procedure's return value. For result set columns, it is the + *ordinal position of the column in the result set starting from 1. If there are + *multiple result sets, the column ordinal positions are implementation + * defined. + *
  19. IS_NULLABLE String => ISO rules are used to determine the nullability for a column. + *
      + *
    • YES --- if the column can include NULLs + *
    • NO --- if the column cannot include NULLs + *
    • empty string --- if the nullability for the + * column is unknown + *
    + *
  20. SPECIFIC_NAME String => the name which uniquely identifies this procedure within its schema. + *
+ * + *

Note: Some databases may not return the column + * descriptions for a procedure. + * + *

The PRECISION column represents the specified column size for the given column. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. Null is returned for data types where the + * column size is not applicable. + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param procedureNamePattern a procedure name pattern; must match the + * procedure name as it is stored in the database + * @param columnNamePattern a column name pattern; must match the column name + * as it is stored in the database + * @return ResultSet - each row describes a stored procedure parameter or + * column + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + */ + ResultSet getProcedureColumns(String catalog, + String schemaPattern, + String procedureNamePattern, + String columnNamePattern) throws SQLException; + + /** + * Indicates that type of the column is unknown. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getProcedureColumns. + */ + int procedureColumnUnknown = 0; + + /** + * Indicates that the column stores IN parameters. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getProcedureColumns. + */ + int procedureColumnIn = 1; + + /** + * Indicates that the column stores INOUT parameters. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getProcedureColumns. + */ + int procedureColumnInOut = 2; + + /** + * Indicates that the column stores OUT parameters. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getProcedureColumns. + */ + int procedureColumnOut = 4; + /** + * Indicates that the column stores return values. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getProcedureColumns. + */ + int procedureColumnReturn = 5; + + /** + * Indicates that the column stores results. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getProcedureColumns. + */ + int procedureColumnResult = 3; + + /** + * Indicates that NULL values are not allowed. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet object + * returned by the method getProcedureColumns. + */ + int procedureNoNulls = 0; + + /** + * Indicates that NULL values are allowed. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet object + * returned by the method getProcedureColumns. + */ + int procedureNullable = 1; + + /** + * Indicates that whether NULL values are allowed + * is unknown. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet object + * returned by the method getProcedureColumns. + */ + int procedureNullableUnknown = 2; + + + /** + * Retrieves a description of the tables available in the given catalog. + * Only table descriptions matching the catalog, schema, table + * name and type criteria are returned. They are ordered by + * TABLE_TYPE, TABLE_CAT, + * TABLE_SCHEM and TABLE_NAME. + *

+ * Each table description has the following columns: + *

    + *
  1. TABLE_CAT String => table catalog (may be null) + *
  2. TABLE_SCHEM String => table schema (may be null) + *
  3. TABLE_NAME String => table name + *
  4. TABLE_TYPE String => table type. Typical types are "TABLE", + * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", + * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". + *
  5. REMARKS String => explanatory comment on the table + *
  6. TYPE_CAT String => the types catalog (may be null) + *
  7. TYPE_SCHEM String => the types schema (may be null) + *
  8. TYPE_NAME String => type name (may be null) + *
  9. SELF_REFERENCING_COL_NAME String => name of the designated + * "identifier" column of a typed table (may be null) + *
  10. REF_GENERATION String => specifies how values in + * SELF_REFERENCING_COL_NAME are created. Values are + * "SYSTEM", "USER", "DERIVED". (may be null) + *
+ * + *

Note: Some databases may not return information for + * all tables. + * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param tableNamePattern a table name pattern; must match the + * table name as it is stored in the database + * @param types a list of table types, which must be from the list of table types + * returned from {@link #getTableTypes},to include; null returns + * all types + * @return ResultSet - each row is a table description + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + */ + ResultSet getTables(String catalog, String schemaPattern, + String tableNamePattern, String types[]) throws SQLException; + + /** + * Retrieves the schema names available in this database. The results + * are ordered by TABLE_CATALOG and + * TABLE_SCHEM. + * + *

The schema columns are: + *

    + *
  1. TABLE_SCHEM String => schema name + *
  2. TABLE_CATALOG String => catalog name (may be null) + *
+ * + * @return a ResultSet object in which each row is a + * schema description + * @exception SQLException if a database access error occurs + * + */ + ResultSet getSchemas() throws SQLException; + + /** + * Retrieves the catalog names available in this database. The results + * are ordered by catalog name. + * + *

The catalog column is: + *

    + *
  1. TABLE_CAT String => catalog name + *
+ * + * @return a ResultSet object in which each row has a + * single String column that is a catalog name + * @exception SQLException if a database access error occurs + */ + ResultSet getCatalogs() throws SQLException; + + /** + * Retrieves the table types available in this database. The results + * are ordered by table type. + * + *

The table type is: + *

    + *
  1. TABLE_TYPE String => table type. Typical types are "TABLE", + * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", + * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". + *
+ * + * @return a ResultSet object in which each row has a + * single String column that is a table type + * @exception SQLException if a database access error occurs + */ + ResultSet getTableTypes() throws SQLException; + + /** + * Retrieves a description of table columns available in + * the specified catalog. + * + *

Only column descriptions matching the catalog, schema, table + * and column name criteria are returned. They are ordered by + * TABLE_CAT,TABLE_SCHEM, + * TABLE_NAME, and ORDINAL_POSITION. + * + *

Each column description has the following columns: + *

    + *
  1. TABLE_CAT String => table catalog (may be null) + *
  2. TABLE_SCHEM String => table schema (may be null) + *
  3. TABLE_NAME String => table name + *
  4. COLUMN_NAME String => column name + *
  5. DATA_TYPE int => SQL type from java.sql.Types + *
  6. TYPE_NAME String => Data source dependent type name, + * for a UDT the type name is fully qualified + *
  7. COLUMN_SIZE int => column size. + *
  8. BUFFER_LENGTH is not used. + *
  9. DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where + * DECIMAL_DIGITS is not applicable. + *
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2) + *
  11. NULLABLE int => is NULL allowed. + *
      + *
    • columnNoNulls - might not allow NULL values + *
    • columnNullable - definitely allows NULL values + *
    • columnNullableUnknown - nullability unknown + *
    + *
  12. REMARKS String => comment describing column (may be null) + *
  13. COLUMN_DEF String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null) + *
  14. SQL_DATA_TYPE int => unused + *
  15. SQL_DATETIME_SUB int => unused + *
  16. CHAR_OCTET_LENGTH int => for char types the + * maximum number of bytes in the column + *
  17. ORDINAL_POSITION int => index of column in table + * (starting at 1) + *
  18. IS_NULLABLE String => ISO rules are used to determine the nullability for a column. + *
      + *
    • YES --- if the column can include NULLs + *
    • NO --- if the column cannot include NULLs + *
    • empty string --- if the nullability for the + * column is unknown + *
    + *
  19. SCOPE_CATALOG String => catalog of table that is the scope + * of a reference attribute (null if DATA_TYPE isn't REF) + *
  20. SCOPE_SCHEMA String => schema of table that is the scope + * of a reference attribute (null if the DATA_TYPE isn't REF) + *
  21. SCOPE_TABLE String => table name that this the scope + * of a reference attribute (null if the DATA_TYPE isn't REF) + *
  22. SOURCE_DATA_TYPE short => source type of a distinct type or user-generated + * Ref type, SQL type from java.sql.Types (null if DATA_TYPE + * isn't DISTINCT or user-generated REF) + *
  23. IS_AUTOINCREMENT String => Indicates whether this column is auto incremented + *
      + *
    • YES --- if the column is auto incremented + *
    • NO --- if the column is not auto incremented + *
    • empty string --- if it cannot be determined whether the column is auto incremented + *
    + *
  24. IS_GENERATEDCOLUMN String => Indicates whether this is a generated column + *
      + *
    • YES --- if this a generated column + *
    • NO --- if this not a generated column + *
    • empty string --- if it cannot be determined whether this is a generated column + *
    + *
+ * + *

The COLUMN_SIZE column specifies the column size for the given column. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. Null is returned for data types where the + * column size is not applicable. + * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param tableNamePattern a table name pattern; must match the + * table name as it is stored in the database + * @param columnNamePattern a column name pattern; must match the column + * name as it is stored in the database + * @return ResultSet - each row is a column description + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + */ + ResultSet getColumns(String catalog, String schemaPattern, + String tableNamePattern, String columnNamePattern) + throws SQLException; + + /** + * Indicates that the column might not allow NULL values. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet returned by the method + * getColumns. + */ + int columnNoNulls = 0; + + /** + * Indicates that the column definitely allows NULL values. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet returned by the method + * getColumns. + */ + int columnNullable = 1; + + /** + * Indicates that the nullability of columns is unknown. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet returned by the method + * getColumns. + */ + int columnNullableUnknown = 2; + + /** + * Retrieves a description of the access rights for a table's columns. + * + *

Only privileges matching the column name criteria are + * returned. They are ordered by COLUMN_NAME and PRIVILEGE. + * + *

Each privilige description has the following columns: + *

    + *
  1. TABLE_CAT String => table catalog (may be null) + *
  2. TABLE_SCHEM String => table schema (may be null) + *
  3. TABLE_NAME String => table name + *
  4. COLUMN_NAME String => column name + *
  5. GRANTOR String => grantor of access (may be null) + *
  6. GRANTEE String => grantee of access + *
  7. PRIVILEGE String => name of access (SELECT, + * INSERT, UPDATE, REFRENCES, ...) + *
  8. IS_GRANTABLE String => "YES" if grantee is permitted + * to grant to others; "NO" if not; null if unknown + *
+ * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schema a schema name; must match the schema name as it is + * stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param table a table name; must match the table name as it is + * stored in the database + * @param columnNamePattern a column name pattern; must match the column + * name as it is stored in the database + * @return ResultSet - each row is a column privilege description + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + */ + ResultSet getColumnPrivileges(String catalog, String schema, + String table, String columnNamePattern) throws SQLException; + + /** + * Retrieves a description of the access rights for each table available + * in a catalog. Note that a table privilege applies to one or + * more columns in the table. It would be wrong to assume that + * this privilege applies to all columns (this may be true for + * some systems but is not true for all.) + * + *

Only privileges matching the schema and table name + * criteria are returned. They are ordered by + * TABLE_CAT, + * TABLE_SCHEM, TABLE_NAME, + * and PRIVILEGE. + * + *

Each privilige description has the following columns: + *

    + *
  1. TABLE_CAT String => table catalog (may be null) + *
  2. TABLE_SCHEM String => table schema (may be null) + *
  3. TABLE_NAME String => table name + *
  4. GRANTOR String => grantor of access (may be null) + *
  5. GRANTEE String => grantee of access + *
  6. PRIVILEGE String => name of access (SELECT, + * INSERT, UPDATE, REFRENCES, ...) + *
  7. IS_GRANTABLE String => "YES" if grantee is permitted + * to grant to others; "NO" if not; null if unknown + *
+ * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param tableNamePattern a table name pattern; must match the + * table name as it is stored in the database + * @return ResultSet - each row is a table privilege description + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + */ + ResultSet getTablePrivileges(String catalog, String schemaPattern, + String tableNamePattern) throws SQLException; + + /** + * Retrieves a description of a table's optimal set of columns that + * uniquely identifies a row. They are ordered by SCOPE. + * + *

Each column description has the following columns: + *

    + *
  1. SCOPE short => actual scope of result + *
      + *
    • bestRowTemporary - very temporary, while using row + *
    • bestRowTransaction - valid for remainder of current transaction + *
    • bestRowSession - valid for remainder of current session + *
    + *
  2. COLUMN_NAME String => column name + *
  3. DATA_TYPE int => SQL data type from java.sql.Types + *
  4. TYPE_NAME String => Data source dependent type name, + * for a UDT the type name is fully qualified + *
  5. COLUMN_SIZE int => precision + *
  6. BUFFER_LENGTH int => not used + *
  7. DECIMAL_DIGITS short => scale - Null is returned for data types where + * DECIMAL_DIGITS is not applicable. + *
  8. PSEUDO_COLUMN short => is this a pseudo column + * like an Oracle ROWID + *
      + *
    • bestRowUnknown - may or may not be pseudo column + *
    • bestRowNotPseudo - is NOT a pseudo column + *
    • bestRowPseudo - is a pseudo column + *
    + *
+ * + *

The COLUMN_SIZE column represents the specified column size for the given column. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. Null is returned for data types where the + * column size is not applicable. + * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schema a schema name; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param table a table name; must match the table name as it is stored + * in the database + * @param scope the scope of interest; use same values as SCOPE + * @param nullable include columns that are nullable. + * @return ResultSet - each row is a column description + * @exception SQLException if a database access error occurs + */ + ResultSet getBestRowIdentifier(String catalog, String schema, + String table, int scope, boolean nullable) throws SQLException; + + /** + * Indicates that the scope of the best row identifier is + * very temporary, lasting only while the + * row is being used. + *

+ * A possible value for the column + * SCOPE + * in the ResultSet object + * returned by the method getBestRowIdentifier. + */ + int bestRowTemporary = 0; + + /** + * Indicates that the scope of the best row identifier is + * the remainder of the current transaction. + *

+ * A possible value for the column + * SCOPE + * in the ResultSet object + * returned by the method getBestRowIdentifier. + */ + int bestRowTransaction = 1; + + /** + * Indicates that the scope of the best row identifier is + * the remainder of the current session. + *

+ * A possible value for the column + * SCOPE + * in the ResultSet object + * returned by the method getBestRowIdentifier. + */ + int bestRowSession = 2; + + /** + * Indicates that the best row identifier may or may not be a pseudo column. + *

+ * A possible value for the column + * PSEUDO_COLUMN + * in the ResultSet object + * returned by the method getBestRowIdentifier. + */ + int bestRowUnknown = 0; + + /** + * Indicates that the best row identifier is NOT a pseudo column. + *

+ * A possible value for the column + * PSEUDO_COLUMN + * in the ResultSet object + * returned by the method getBestRowIdentifier. + */ + int bestRowNotPseudo = 1; + + /** + * Indicates that the best row identifier is a pseudo column. + *

+ * A possible value for the column + * PSEUDO_COLUMN + * in the ResultSet object + * returned by the method getBestRowIdentifier. + */ + int bestRowPseudo = 2; + + /** + * Retrieves a description of a table's columns that are automatically + * updated when any value in a row is updated. They are + * unordered. + * + *

Each column description has the following columns: + *

    + *
  1. SCOPE short => is not used + *
  2. COLUMN_NAME String => column name + *
  3. DATA_TYPE int => SQL data type from java.sql.Types + *
  4. TYPE_NAME String => Data source-dependent type name + *
  5. COLUMN_SIZE int => precision + *
  6. BUFFER_LENGTH int => length of column value in bytes + *
  7. DECIMAL_DIGITS short => scale - Null is returned for data types where + * DECIMAL_DIGITS is not applicable. + *
  8. PSEUDO_COLUMN short => whether this is pseudo column + * like an Oracle ROWID + *
      + *
    • versionColumnUnknown - may or may not be pseudo column + *
    • versionColumnNotPseudo - is NOT a pseudo column + *
    • versionColumnPseudo - is a pseudo column + *
    + *
+ * + *

The COLUMN_SIZE column represents the specified column size for the given column. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. Null is returned for data types where the + * column size is not applicable. + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schema a schema name; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param table a table name; must match the table name as it is stored + * in the database + * @return a ResultSet object in which each row is a + * column description + * @exception SQLException if a database access error occurs + */ + ResultSet getVersionColumns(String catalog, String schema, + String table) throws SQLException; + + /** + * Indicates that this version column may or may not be a pseudo column. + *

+ * A possible value for the column + * PSEUDO_COLUMN + * in the ResultSet object + * returned by the method getVersionColumns. + */ + int versionColumnUnknown = 0; + + /** + * Indicates that this version column is NOT a pseudo column. + *

+ * A possible value for the column + * PSEUDO_COLUMN + * in the ResultSet object + * returned by the method getVersionColumns. + */ + int versionColumnNotPseudo = 1; + + /** + * Indicates that this version column is a pseudo column. + *

+ * A possible value for the column + * PSEUDO_COLUMN + * in the ResultSet object + * returned by the method getVersionColumns. + */ + int versionColumnPseudo = 2; + + /** + * Retrieves a description of the given table's primary key columns. They + * are ordered by COLUMN_NAME. + * + *

Each primary key column description has the following columns: + *

    + *
  1. TABLE_CAT String => table catalog (may be null) + *
  2. TABLE_SCHEM String => table schema (may be null) + *
  3. TABLE_NAME String => table name + *
  4. COLUMN_NAME String => column name + *
  5. KEY_SEQ short => sequence number within primary key( a value + * of 1 represents the first column of the primary key, a value of 2 would + * represent the second column within the primary key). + *
  6. PK_NAME String => primary key name (may be null) + *
+ * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schema a schema name; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param table a table name; must match the table name as it is stored + * in the database + * @return ResultSet - each row is a primary key column description + * @exception SQLException if a database access error occurs + */ + ResultSet getPrimaryKeys(String catalog, String schema, + String table) throws SQLException; + + /** + * Retrieves a description of the primary key columns that are + * referenced by the given table's foreign key columns (the primary keys + * imported by a table). They are ordered by PKTABLE_CAT, + * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ. + * + *

Each primary key column description has the following columns: + *

    + *
  1. PKTABLE_CAT String => primary key table catalog + * being imported (may be null) + *
  2. PKTABLE_SCHEM String => primary key table schema + * being imported (may be null) + *
  3. PKTABLE_NAME String => primary key table name + * being imported + *
  4. PKCOLUMN_NAME String => primary key column name + * being imported + *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) + *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) + *
  7. FKTABLE_NAME String => foreign key table name + *
  8. FKCOLUMN_NAME String => foreign key column name + *
  9. KEY_SEQ short => sequence number within a foreign key( a value + * of 1 represents the first column of the foreign key, a value of 2 would + * represent the second column within the foreign key). + *
  10. UPDATE_RULE short => What happens to a + * foreign key when the primary key is updated: + *
      + *
    • importedNoAction - do not allow update of primary + * key if it has been imported + *
    • importedKeyCascade - change imported key to agree + * with primary key update + *
    • importedKeySetNull - change imported key to NULL + * if its primary key has been updated + *
    • importedKeySetDefault - change imported key to default values + * if its primary key has been updated + *
    • importedKeyRestrict - same as importedKeyNoAction + * (for ODBC 2.x compatibility) + *
    + *
  11. DELETE_RULE short => What happens to + * the foreign key when primary is deleted. + *
      + *
    • importedKeyNoAction - do not allow delete of primary + * key if it has been imported + *
    • importedKeyCascade - delete rows that import a deleted key + *
    • importedKeySetNull - change imported key to NULL if + * its primary key has been deleted + *
    • importedKeyRestrict - same as importedKeyNoAction + * (for ODBC 2.x compatibility) + *
    • importedKeySetDefault - change imported key to default if + * its primary key has been deleted + *
    + *
  12. FK_NAME String => foreign key name (may be null) + *
  13. PK_NAME String => primary key name (may be null) + *
  14. DEFERRABILITY short => can the evaluation of foreign key + * constraints be deferred until commit + *
      + *
    • importedKeyInitiallyDeferred - see SQL92 for definition + *
    • importedKeyInitiallyImmediate - see SQL92 for definition + *
    • importedKeyNotDeferrable - see SQL92 for definition + *
    + *
+ * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schema a schema name; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param table a table name; must match the table name as it is stored + * in the database + * @return ResultSet - each row is a primary key column description + * @exception SQLException if a database access error occurs + * @see #getExportedKeys + */ + ResultSet getImportedKeys(String catalog, String schema, + String table) throws SQLException; + + /** + * For the column UPDATE_RULE, + * indicates that + * when the primary key is updated, the foreign key (imported key) + * is changed to agree with it. + * For the column DELETE_RULE, + * it indicates that + * when the primary key is deleted, rows that imported that key + * are deleted. + *

+ * A possible value for the columns UPDATE_RULE + * and DELETE_RULE in the + * ResultSet objects returned by the methods + * getImportedKeys, getExportedKeys, + * and getCrossReference. + */ + int importedKeyCascade = 0; + + /** + * For the column UPDATE_RULE, indicates that + * a primary key may not be updated if it has been imported by + * another table as a foreign key. + * For the column DELETE_RULE, indicates that + * a primary key may not be deleted if it has been imported by + * another table as a foreign key. + *

+ * A possible value for the columns UPDATE_RULE + * and DELETE_RULE in the + * ResultSet objects returned by the methods + * getImportedKeys, getExportedKeys, + * and getCrossReference. + */ + int importedKeyRestrict = 1; + + /** + * For the columns UPDATE_RULE + * and DELETE_RULE, indicates that + * when the primary key is updated or deleted, the foreign key (imported key) + * is changed to NULL. + *

+ * A possible value for the columns UPDATE_RULE + * and DELETE_RULE in the + * ResultSet objects returned by the methods + * getImportedKeys, getExportedKeys, + * and getCrossReference. + */ + int importedKeySetNull = 2; + + /** + * For the columns UPDATE_RULE + * and DELETE_RULE, indicates that + * if the primary key has been imported, it cannot be updated or deleted. + *

+ * A possible value for the columns UPDATE_RULE + * and DELETE_RULE in the + * ResultSet objects returned by the methods + * getImportedKeys, getExportedKeys, + * and getCrossReference. + */ + int importedKeyNoAction = 3; + + /** + * For the columns UPDATE_RULE + * and DELETE_RULE, indicates that + * if the primary key is updated or deleted, the foreign key (imported key) + * is set to the default value. + *

+ * A possible value for the columns UPDATE_RULE + * and DELETE_RULE in the + * ResultSet objects returned by the methods + * getImportedKeys, getExportedKeys, + * and getCrossReference. + */ + int importedKeySetDefault = 4; + + /** + * Indicates deferrability. See SQL-92 for a definition. + *

+ * A possible value for the column DEFERRABILITY + * in the ResultSet objects returned by the methods + * getImportedKeys, getExportedKeys, + * and getCrossReference. + */ + int importedKeyInitiallyDeferred = 5; + + /** + * Indicates deferrability. See SQL-92 for a definition. + *

+ * A possible value for the column DEFERRABILITY + * in the ResultSet objects returned by the methods + * getImportedKeys, getExportedKeys, + * and getCrossReference. + */ + int importedKeyInitiallyImmediate = 6; + + /** + * Indicates deferrability. See SQL-92 for a definition. + *

+ * A possible value for the column DEFERRABILITY + * in the ResultSet objects returned by the methods + * getImportedKeys, getExportedKeys, + * and getCrossReference. + */ + int importedKeyNotDeferrable = 7; + + /** + * Retrieves a description of the foreign key columns that reference the + * given table's primary key columns (the foreign keys exported by a + * table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, + * FKTABLE_NAME, and KEY_SEQ. + * + *

Each foreign key column description has the following columns: + *

    + *
  1. PKTABLE_CAT String => primary key table catalog (may be null) + *
  2. PKTABLE_SCHEM String => primary key table schema (may be null) + *
  3. PKTABLE_NAME String => primary key table name + *
  4. PKCOLUMN_NAME String => primary key column name + *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) + * being exported (may be null) + *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) + * being exported (may be null) + *
  7. FKTABLE_NAME String => foreign key table name + * being exported + *
  8. FKCOLUMN_NAME String => foreign key column name + * being exported + *
  9. KEY_SEQ short => sequence number within foreign key( a value + * of 1 represents the first column of the foreign key, a value of 2 would + * represent the second column within the foreign key). + *
  10. UPDATE_RULE short => What happens to + * foreign key when primary is updated: + *
      + *
    • importedNoAction - do not allow update of primary + * key if it has been imported + *
    • importedKeyCascade - change imported key to agree + * with primary key update + *
    • importedKeySetNull - change imported key to NULL if + * its primary key has been updated + *
    • importedKeySetDefault - change imported key to default values + * if its primary key has been updated + *
    • importedKeyRestrict - same as importedKeyNoAction + * (for ODBC 2.x compatibility) + *
    + *
  11. DELETE_RULE short => What happens to + * the foreign key when primary is deleted. + *
      + *
    • importedKeyNoAction - do not allow delete of primary + * key if it has been imported + *
    • importedKeyCascade - delete rows that import a deleted key + *
    • importedKeySetNull - change imported key to NULL if + * its primary key has been deleted + *
    • importedKeyRestrict - same as importedKeyNoAction + * (for ODBC 2.x compatibility) + *
    • importedKeySetDefault - change imported key to default if + * its primary key has been deleted + *
    + *
  12. FK_NAME String => foreign key name (may be null) + *
  13. PK_NAME String => primary key name (may be null) + *
  14. DEFERRABILITY short => can the evaluation of foreign key + * constraints be deferred until commit + *
      + *
    • importedKeyInitiallyDeferred - see SQL92 for definition + *
    • importedKeyInitiallyImmediate - see SQL92 for definition + *
    • importedKeyNotDeferrable - see SQL92 for definition + *
    + *
+ * + * @param catalog a catalog name; must match the catalog name as it + * is stored in this database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schema a schema name; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param table a table name; must match the table name as it is stored + * in this database + * @return a ResultSet object in which each row is a + * foreign key column description + * @exception SQLException if a database access error occurs + * @see #getImportedKeys + */ + ResultSet getExportedKeys(String catalog, String schema, + String table) throws SQLException; + + /** + * Retrieves a description of the foreign key columns in the given foreign key + * table that reference the primary key or the columns representing a unique constraint of the parent table (could be the same or a different table). + * The number of columns returned from the parent table must match the number of + * columns that make up the foreign key. They + * are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and + * KEY_SEQ. + * + *

Each foreign key column description has the following columns: + *

    + *
  1. PKTABLE_CAT String => parent key table catalog (may be null) + *
  2. PKTABLE_SCHEM String => parent key table schema (may be null) + *
  3. PKTABLE_NAME String => parent key table name + *
  4. PKCOLUMN_NAME String => parent key column name + *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) + * being exported (may be null) + *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) + * being exported (may be null) + *
  7. FKTABLE_NAME String => foreign key table name + * being exported + *
  8. FKCOLUMN_NAME String => foreign key column name + * being exported + *
  9. KEY_SEQ short => sequence number within foreign key( a value + * of 1 represents the first column of the foreign key, a value of 2 would + * represent the second column within the foreign key). + *
  10. UPDATE_RULE short => What happens to + * foreign key when parent key is updated: + *
      + *
    • importedNoAction - do not allow update of parent + * key if it has been imported + *
    • importedKeyCascade - change imported key to agree + * with parent key update + *
    • importedKeySetNull - change imported key to NULL if + * its parent key has been updated + *
    • importedKeySetDefault - change imported key to default values + * if its parent key has been updated + *
    • importedKeyRestrict - same as importedKeyNoAction + * (for ODBC 2.x compatibility) + *
    + *
  11. DELETE_RULE short => What happens to + * the foreign key when parent key is deleted. + *
      + *
    • importedKeyNoAction - do not allow delete of parent + * key if it has been imported + *
    • importedKeyCascade - delete rows that import a deleted key + *
    • importedKeySetNull - change imported key to NULL if + * its primary key has been deleted + *
    • importedKeyRestrict - same as importedKeyNoAction + * (for ODBC 2.x compatibility) + *
    • importedKeySetDefault - change imported key to default if + * its parent key has been deleted + *
    + *
  12. FK_NAME String => foreign key name (may be null) + *
  13. PK_NAME String => parent key name (may be null) + *
  14. DEFERRABILITY short => can the evaluation of foreign key + * constraints be deferred until commit + *
      + *
    • importedKeyInitiallyDeferred - see SQL92 for definition + *
    • importedKeyInitiallyImmediate - see SQL92 for definition + *
    • importedKeyNotDeferrable - see SQL92 for definition + *
    + *
+ * + * @param parentCatalog a catalog name; must match the catalog name + * as it is stored in the database; "" retrieves those without a + * catalog; null means drop catalog name from the selection criteria + * @param parentSchema a schema name; must match the schema name as + * it is stored in the database; "" retrieves those without a schema; + * null means drop schema name from the selection criteria + * @param parentTable the name of the table that exports the key; must match + * the table name as it is stored in the database + * @param foreignCatalog a catalog name; must match the catalog name as + * it is stored in the database; "" retrieves those without a + * catalog; null means drop catalog name from the selection criteria + * @param foreignSchema a schema name; must match the schema name as it + * is stored in the database; "" retrieves those without a schema; + * null means drop schema name from the selection criteria + * @param foreignTable the name of the table that imports the key; must match + * the table name as it is stored in the database + * @return ResultSet - each row is a foreign key column description + * @exception SQLException if a database access error occurs + * @see #getImportedKeys + */ + ResultSet getCrossReference( + String parentCatalog, String parentSchema, String parentTable, + String foreignCatalog, String foreignSchema, String foreignTable + ) throws SQLException; + + /** + * Retrieves a description of all the data types supported by + * this database. They are ordered by DATA_TYPE and then by how + * closely the data type maps to the corresponding JDBC SQL type. + * + *

If the database supports SQL distinct types, then getTypeInfo() will return + * a single row with a TYPE_NAME of DISTINCT and a DATA_TYPE of Types.DISTINCT. + * If the database supports SQL structured types, then getTypeInfo() will return + * a single row with a TYPE_NAME of STRUCT and a DATA_TYPE of Types.STRUCT. + * + *

If SQL distinct or structured types are supported, then information on the + * individual types may be obtained from the getUDTs() method. + * + + * + *

Each type description has the following columns: + *

    + *
  1. TYPE_NAME String => Type name + *
  2. DATA_TYPE int => SQL data type from java.sql.Types + *
  3. PRECISION int => maximum precision + *
  4. LITERAL_PREFIX String => prefix used to quote a literal + * (may be null) + *
  5. LITERAL_SUFFIX String => suffix used to quote a literal + (may be null) + *
  6. CREATE_PARAMS String => parameters used in creating + * the type (may be null) + *
  7. NULLABLE short => can you use NULL for this type. + *
      + *
    • typeNoNulls - does not allow NULL values + *
    • typeNullable - allows NULL values + *
    • typeNullableUnknown - nullability unknown + *
    + *
  8. CASE_SENSITIVE boolean=> is it case sensitive. + *
  9. SEARCHABLE short => can you use "WHERE" based on this type: + *
      + *
    • typePredNone - No support + *
    • typePredChar - Only supported with WHERE .. LIKE + *
    • typePredBasic - Supported except for WHERE .. LIKE + *
    • typeSearchable - Supported for all WHERE .. + *
    + *
  10. UNSIGNED_ATTRIBUTE boolean => is it unsigned. + *
  11. FIXED_PREC_SCALE boolean => can it be a money value. + *
  12. AUTO_INCREMENT boolean => can it be used for an + * auto-increment value. + *
  13. LOCAL_TYPE_NAME String => localized version of type name + * (may be null) + *
  14. MINIMUM_SCALE short => minimum scale supported + *
  15. MAXIMUM_SCALE short => maximum scale supported + *
  16. SQL_DATA_TYPE int => unused + *
  17. SQL_DATETIME_SUB int => unused + *
  18. NUM_PREC_RADIX int => usually 2 or 10 + *
+ * + *

The PRECISION column represents the maximum column size that the server supports for the given datatype. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. Null is returned for data types where the + * column size is not applicable. + * + * @return a ResultSet object in which each row is an SQL + * type description + * @exception SQLException if a database access error occurs + */ + ResultSet getTypeInfo() throws SQLException; + + /** + * Indicates that a NULL value is NOT allowed for this + * data type. + *

+ * A possible value for column NULLABLE in the + * ResultSet object returned by the method + * getTypeInfo. + */ + int typeNoNulls = 0; + + /** + * Indicates that a NULL value is allowed for this + * data type. + *

+ * A possible value for column NULLABLE in the + * ResultSet object returned by the method + * getTypeInfo. + */ + int typeNullable = 1; + + /** + * Indicates that it is not known whether a NULL value + * is allowed for this data type. + *

+ * A possible value for column NULLABLE in the + * ResultSet object returned by the method + * getTypeInfo. + */ + int typeNullableUnknown = 2; + + /** + * Indicates that WHERE search clauses are not supported + * for this type. + *

+ * A possible value for column SEARCHABLE in the + * ResultSet object returned by the method + * getTypeInfo. + */ + int typePredNone = 0; + + /** + * Indicates that the data type + * can be only be used in WHERE search clauses + * that use LIKE predicates. + *

+ * A possible value for column SEARCHABLE in the + * ResultSet object returned by the method + * getTypeInfo. + */ + int typePredChar = 1; + + /** + * Indicates that the data type can be only be used in WHERE + * search clauses + * that do not use LIKE predicates. + *

+ * A possible value for column SEARCHABLE in the + * ResultSet object returned by the method + * getTypeInfo. + */ + int typePredBasic = 2; + + /** + * Indicates that all WHERE search clauses can be + * based on this type. + *

+ * A possible value for column SEARCHABLE in the + * ResultSet object returned by the method + * getTypeInfo. + */ + int typeSearchable = 3; + + /** + * Retrieves a description of the given table's indices and statistics. They are + * ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION. + * + *

Each index column description has the following columns: + *

    + *
  1. TABLE_CAT String => table catalog (may be null) + *
  2. TABLE_SCHEM String => table schema (may be null) + *
  3. TABLE_NAME String => table name + *
  4. NON_UNIQUE boolean => Can index values be non-unique. + * false when TYPE is tableIndexStatistic + *
  5. INDEX_QUALIFIER String => index catalog (may be null); + * null when TYPE is tableIndexStatistic + *
  6. INDEX_NAME String => index name; null when TYPE is + * tableIndexStatistic + *
  7. TYPE short => index type: + *
      + *
    • tableIndexStatistic - this identifies table statistics that are + * returned in conjuction with a table's index descriptions + *
    • tableIndexClustered - this is a clustered index + *
    • tableIndexHashed - this is a hashed index + *
    • tableIndexOther - this is some other style of index + *
    + *
  8. ORDINAL_POSITION short => column sequence number + * within index; zero when TYPE is tableIndexStatistic + *
  9. COLUMN_NAME String => column name; null when TYPE is + * tableIndexStatistic + *
  10. ASC_OR_DESC String => column sort sequence, "A" => ascending, + * "D" => descending, may be null if sort sequence is not supported; + * null when TYPE is tableIndexStatistic + *
  11. CARDINALITY int => When TYPE is tableIndexStatistic, then + * this is the number of rows in the table; otherwise, it is the + * number of unique values in the index. + *
  12. PAGES int => When TYPE is tableIndexStatisic then + * this is the number of pages used for the table, otherwise it + * is the number of pages used for the current index. + *
  13. FILTER_CONDITION String => Filter condition, if any. + * (may be null) + *
+ * + * @param catalog a catalog name; must match the catalog name as it + * is stored in this database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schema a schema name; must match the schema name + * as it is stored in this database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param table a table name; must match the table name as it is stored + * in this database + * @param unique when true, return only indices for unique values; + * when false, return indices regardless of whether unique or not + * @param approximate when true, result is allowed to reflect approximate + * or out of data values; when false, results are requested to be + * accurate + * @return ResultSet - each row is an index column description + * @exception SQLException if a database access error occurs + */ + ResultSet getIndexInfo(String catalog, String schema, String table, + boolean unique, boolean approximate) + throws SQLException; + + /** + * Indicates that this column contains table statistics that + * are returned in conjunction with a table's index descriptions. + *

+ * A possible value for column TYPE in the + * ResultSet object returned by the method + * getIndexInfo. + */ + short tableIndexStatistic = 0; + + /** + * Indicates that this table index is a clustered index. + *

+ * A possible value for column TYPE in the + * ResultSet object returned by the method + * getIndexInfo. + */ + short tableIndexClustered = 1; + + /** + * Indicates that this table index is a hashed index. + *

+ * A possible value for column TYPE in the + * ResultSet object returned by the method + * getIndexInfo. + */ + short tableIndexHashed = 2; + + /** + * Indicates that this table index is not a clustered + * index, a hashed index, or table statistics; + * it is something other than these. + *

+ * A possible value for column TYPE in the + * ResultSet object returned by the method + * getIndexInfo. + */ + short tableIndexOther = 3; + + //--------------------------JDBC 2.0----------------------------- + + /** + * Retrieves whether this database supports the given result set type. + * + * @param type defined in java.sql.ResultSet + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + * @see Connection + * @since 1.2 + */ + boolean supportsResultSetType(int type) throws SQLException; + + /** + * Retrieves whether this database supports the given concurrency type + * in combination with the given result set type. + * + * @param type defined in java.sql.ResultSet + * @param concurrency type defined in java.sql.ResultSet + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + * @see Connection + * @since 1.2 + */ + boolean supportsResultSetConcurrency(int type, int concurrency) + throws SQLException; + + /** + * + * Retrieves whether for the given type of ResultSet object, + * the result set's own updates are visible. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if updates are visible for the given result set type; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean ownUpdatesAreVisible(int type) throws SQLException; + + /** + * Retrieves whether a result set's own deletes are visible. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if deletes are visible for the given result set type; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean ownDeletesAreVisible(int type) throws SQLException; + + /** + * Retrieves whether a result set's own inserts are visible. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if inserts are visible for the given result set type; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean ownInsertsAreVisible(int type) throws SQLException; + + /** + * Retrieves whether updates made by others are visible. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if updates made by others + * are visible for the given result set type; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean othersUpdatesAreVisible(int type) throws SQLException; + + /** + * Retrieves whether deletes made by others are visible. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if deletes made by others + * are visible for the given result set type; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean othersDeletesAreVisible(int type) throws SQLException; + + /** + * Retrieves whether inserts made by others are visible. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if inserts made by others + * are visible for the given result set type; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean othersInsertsAreVisible(int type) throws SQLException; + + /** + * Retrieves whether or not a visible row update can be detected by + * calling the method ResultSet.rowUpdated. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if changes are detected by the result set type; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean updatesAreDetected(int type) throws SQLException; + + /** + * Retrieves whether or not a visible row delete can be detected by + * calling the method ResultSet.rowDeleted. If the method + * deletesAreDetected returns false, it means that + * deleted rows are removed from the result set. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if deletes are detected by the given result set type; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean deletesAreDetected(int type) throws SQLException; + + /** + * Retrieves whether or not a visible row insert can be detected + * by calling the method ResultSet.rowInserted. + * + * @param type the ResultSet type; one of + * ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @return true if changes are detected by the specified result + * set type; false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean insertsAreDetected(int type) throws SQLException; + + /** + * Retrieves whether this database supports batch updates. + * + * @return true if this database supports batch upcates; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + boolean supportsBatchUpdates() throws SQLException; + + /** + * Retrieves a description of the user-defined types (UDTs) defined + * in a particular schema. Schema-specific UDTs may have type + * JAVA_OBJECT, STRUCT, + * or DISTINCT. + * + *

Only types matching the catalog, schema, type name and type + * criteria are returned. They are ordered by DATA_TYPE, + * TYPE_CAT, TYPE_SCHEM and + * TYPE_NAME. The type name parameter may be a fully-qualified + * name. In this case, the catalog and schemaPattern parameters are + * ignored. + * + *

Each type description has the following columns: + *

    + *
  1. TYPE_CAT String => the type's catalog (may be null) + *
  2. TYPE_SCHEM String => type's schema (may be null) + *
  3. TYPE_NAME String => type name + *
  4. CLASS_NAME String => Java class name + *
  5. DATA_TYPE int => type value defined in java.sql.Types. + * One of JAVA_OBJECT, STRUCT, or DISTINCT + *
  6. REMARKS String => explanatory comment on the type + *
  7. BASE_TYPE short => type code of the source type of a + * DISTINCT type or the type that implements the user-generated + * reference type of the SELF_REFERENCING_COLUMN of a structured + * type as defined in java.sql.Types (null if DATA_TYPE is not + * DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) + *
+ * + *

Note: If the driver does not support UDTs, an empty + * result set is returned. + * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema pattern name; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param typeNamePattern a type name pattern; must match the type name + * as it is stored in the database; may be a fully qualified name + * @param types a list of user-defined types (JAVA_OBJECT, + * STRUCT, or DISTINCT) to include; null returns all types + * @return ResultSet object in which each row describes a UDT + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + * @since 1.2 + */ + ResultSet getUDTs(String catalog, String schemaPattern, + String typeNamePattern, int[] types) + throws SQLException; + + /** + * Retrieves the connection that produced this metadata object. + *

+ * @return the connection that produced this metadata object + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + Connection getConnection() throws SQLException; + + // ------------------- JDBC 3.0 ------------------------- + + /** + * Retrieves whether this database supports savepoints. + * + * @return true if savepoints are supported; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + boolean supportsSavepoints() throws SQLException; + + /** + * Retrieves whether this database supports named parameters to callable + * statements. + * + * @return true if named parameters are supported; + * false otherwise + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + boolean supportsNamedParameters() throws SQLException; + + /** + * Retrieves whether it is possible to have multiple ResultSet objects + * returned from a CallableStatement object + * simultaneously. + * + * @return true if a CallableStatement object + * can return multiple ResultSet objects + * simultaneously; false otherwise + * @exception SQLException if a datanase access error occurs + * @since 1.4 + */ + boolean supportsMultipleOpenResults() throws SQLException; + + /** + * Retrieves whether auto-generated keys can be retrieved after + * a statement has been executed + * + * @return true if auto-generated keys can be retrieved + * after a statement has executed; false otherwise + *

If true is returned, the JDBC driver must support the + * returning of auto-generated keys for at least SQL INSERT statements + *

+ * @exception SQLException if a database access error occurs + * @since 1.4 + */ + boolean supportsGetGeneratedKeys() throws SQLException; + + /** + * Retrieves a description of the user-defined type (UDT) hierarchies defined in a + * particular schema in this database. Only the immediate super type/ + * sub type relationship is modeled. + *

+ * Only supertype information for UDTs matching the catalog, + * schema, and type name is returned. The type name parameter + * may be a fully-qualified name. When the UDT name supplied is a + * fully-qualified name, the catalog and schemaPattern parameters are + * ignored. + *

+ * If a UDT does not have a direct super type, it is not listed here. + * A row of the ResultSet object returned by this method + * describes the designated UDT and a direct supertype. A row has the following + * columns: + *

    + *
  1. TYPE_CAT String => the UDT's catalog (may be null) + *
  2. TYPE_SCHEM String => UDT's schema (may be null) + *
  3. TYPE_NAME String => type name of the UDT + *
  4. SUPERTYPE_CAT String => the direct super type's catalog + * (may be null) + *
  5. SUPERTYPE_SCHEM String => the direct super type's schema + * (may be null) + *
  6. SUPERTYPE_NAME String => the direct super type's name + *
+ * + *

Note: If the driver does not support type hierarchies, an + * empty result set is returned. + * + * @param catalog a catalog name; "" retrieves those without a catalog; + * null means drop catalog name from the selection criteria + * @param schemaPattern a schema name pattern; "" retrieves those + * without a schema + * @param typeNamePattern a UDT name pattern; may be a fully-qualified + * name + * @return a ResultSet object in which a row gives information + * about the designated UDT + * @throws SQLException if a database access error occurs + * @see #getSearchStringEscape + * @since 1.4 + */ + ResultSet getSuperTypes(String catalog, String schemaPattern, + String typeNamePattern) throws SQLException; + + /** + * Retrieves a description of the table hierarchies defined in a particular + * schema in this database. + * + *

Only supertable information for tables matching the catalog, schema + * and table name are returned. The table name parameter may be a fully- + * qualified name, in which case, the catalog and schemaPattern parameters + * are ignored. If a table does not have a super table, it is not listed here. + * Supertables have to be defined in the same catalog and schema as the + * sub tables. Therefore, the type description does not need to include + * this information for the supertable. + * + *

Each type description has the following columns: + *

    + *
  1. TABLE_CAT String => the type's catalog (may be null) + *
  2. TABLE_SCHEM String => type's schema (may be null) + *
  3. TABLE_NAME String => type name + *
  4. SUPERTABLE_NAME String => the direct super type's name + *
+ * + *

Note: If the driver does not support type hierarchies, an + * empty result set is returned. + * + * @param catalog a catalog name; "" retrieves those without a catalog; + * null means drop catalog name from the selection criteria + * @param schemaPattern a schema name pattern; "" retrieves those + * without a schema + * @param tableNamePattern a table name pattern; may be a fully-qualified + * name + * @return a ResultSet object in which each row is a type description + * @throws SQLException if a database access error occurs + * @see #getSearchStringEscape + * @since 1.4 + */ + ResultSet getSuperTables(String catalog, String schemaPattern, + String tableNamePattern) throws SQLException; + + /** + * Indicates that NULL values might not be allowed. + *

+ * A possible value for the column + * NULLABLE in the ResultSet object + * returned by the method getAttributes. + */ + short attributeNoNulls = 0; + + /** + * Indicates that NULL values are definitely allowed. + *

+ * A possible value for the column NULLABLE + * in the ResultSet object + * returned by the method getAttributes. + */ + short attributeNullable = 1; + + /** + * Indicates that whether NULL values are allowed is not + * known. + *

+ * A possible value for the column NULLABLE + * in the ResultSet object + * returned by the method getAttributes. + */ + short attributeNullableUnknown = 2; + + /** + * Retrieves a description of the given attribute of the given type + * for a user-defined type (UDT) that is available in the given schema + * and catalog. + *

+ * Descriptions are returned only for attributes of UDTs matching the + * catalog, schema, type, and attribute name criteria. They are ordered by + * TYPE_CAT, TYPE_SCHEM, + * TYPE_NAME and ORDINAL_POSITION. This description + * does not contain inherited attributes. + *

+ * The ResultSet object that is returned has the following + * columns: + *

    + *
  1. TYPE_CAT String => type catalog (may be null) + *
  2. TYPE_SCHEM String => type schema (may be null) + *
  3. TYPE_NAME String => type name + *
  4. ATTR_NAME String => attribute name + *
  5. DATA_TYPE int => attribute type SQL type from java.sql.Types + *
  6. ATTR_TYPE_NAME String => Data source dependent type name. + * For a UDT, the type name is fully qualified. For a REF, the type name is + * fully qualified and represents the target type of the reference type. + *
  7. ATTR_SIZE int => column size. For char or date + * types this is the maximum number of characters; for numeric or + * decimal types this is precision. + *
  8. DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where + * DECIMAL_DIGITS is not applicable. + *
  9. NUM_PREC_RADIX int => Radix (typically either 10 or 2) + *
  10. NULLABLE int => whether NULL is allowed + *
      + *
    • attributeNoNulls - might not allow NULL values + *
    • attributeNullable - definitely allows NULL values + *
    • attributeNullableUnknown - nullability unknown + *
    + *
  11. REMARKS String => comment describing column (may be null) + *
  12. ATTR_DEF String => default value (may be null) + *
  13. SQL_DATA_TYPE int => unused + *
  14. SQL_DATETIME_SUB int => unused + *
  15. CHAR_OCTET_LENGTH int => for char types the + * maximum number of bytes in the column + *
  16. ORDINAL_POSITION int => index of the attribute in the UDT + * (starting at 1) + *
  17. IS_NULLABLE String => ISO rules are used to determine + * the nullability for a attribute. + *
      + *
    • YES --- if the attribute can include NULLs + *
    • NO --- if the attribute cannot include NULLs + *
    • empty string --- if the nullability for the + * attribute is unknown + *
    + *
  18. SCOPE_CATALOG String => catalog of table that is the + * scope of a reference attribute (null if DATA_TYPE isn't REF) + *
  19. SCOPE_SCHEMA String => schema of table that is the + * scope of a reference attribute (null if DATA_TYPE isn't REF) + *
  20. SCOPE_TABLE String => table name that is the scope of a + * reference attribute (null if the DATA_TYPE isn't REF) + *
  21. SOURCE_DATA_TYPE short => source type of a distinct type or user-generated + * Ref type,SQL type from java.sql.Types (null if DATA_TYPE + * isn't DISTINCT or user-generated REF) + *
+ * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param typeNamePattern a type name pattern; must match the + * type name as it is stored in the database + * @param attributeNamePattern an attribute name pattern; must match the attribute + * name as it is declared in the database + * @return a ResultSet object in which each row is an + * attribute description + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + * @since 1.4 + */ + ResultSet getAttributes(String catalog, String schemaPattern, + String typeNamePattern, String attributeNamePattern) + throws SQLException; + + /** + * Retrieves whether this database supports the given result set holdability. + * + * @param holdability one of the following constants: + * ResultSet.HOLD_CURSORS_OVER_COMMIT or + * ResultSet.CLOSE_CURSORS_AT_COMMIT + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + * @see Connection + * @since 1.4 + */ + boolean supportsResultSetHoldability(int holdability) throws SQLException; + + /** + * Retrieves this database's default holdability for ResultSet + * objects. + * + * @return the default holdability; either + * ResultSet.HOLD_CURSORS_OVER_COMMIT or + * ResultSet.CLOSE_CURSORS_AT_COMMIT + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getResultSetHoldability() throws SQLException; + + /** + * Retrieves the major version number of the underlying database. + * + * @return the underlying database's major version + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getDatabaseMajorVersion() throws SQLException; + + /** + * Retrieves the minor version number of the underlying database. + * + * @return underlying database's minor version + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getDatabaseMinorVersion() throws SQLException; + + /** + * Retrieves the major JDBC version number for this + * driver. + * + * @return JDBC version major number + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getJDBCMajorVersion() throws SQLException; + + /** + * Retrieves the minor JDBC version number for this + * driver. + * + * @return JDBC version minor number + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getJDBCMinorVersion() throws SQLException; + + /** + * A possible return value for the method + * DatabaseMetaData.getSQLStateType which is used to indicate + * whether the value returned by the method + * SQLException.getSQLState is an + * X/Open (now know as Open Group) SQL CLI SQLSTATE value. + *

+ * @since 1.4 + */ + int sqlStateXOpen = 1; + + /** + * A possible return value for the method + * DatabaseMetaData.getSQLStateType which is used to indicate + * whether the value returned by the method + * SQLException.getSQLState is an SQLSTATE value. + *

+ * @since 1.6 + */ + int sqlStateSQL = 2; + + /** + * A possible return value for the method + * DatabaseMetaData.getSQLStateType which is used to indicate + * whether the value returned by the method + * SQLException.getSQLState is an SQL99 SQLSTATE value. + *

+ * Note:This constant remains only for compatibility reasons. Developers + * should use the constant sqlStateSQL instead. + * + * @since 1.4 + */ + int sqlStateSQL99 = sqlStateSQL; + + /** + * Indicates whether the SQLSTATE returned by SQLException.getSQLState + * is X/Open (now known as Open Group) SQL CLI or SQL:2003. + * @return the type of SQLSTATE; one of: + * sqlStateXOpen or + * sqlStateSQL + * @throws SQLException if a database access error occurs + * @since 1.4 + */ + int getSQLStateType() throws SQLException; + + /** + * Indicates whether updates made to a LOB are made on a copy or directly + * to the LOB. + * @return true if updates are made to a copy of the LOB; + * false if updates are made directly to the LOB + * @throws SQLException if a database access error occurs + * @since 1.4 + */ + boolean locatorsUpdateCopy() throws SQLException; + + /** + * Retrieves whether this database supports statement pooling. + * + * @return true if so; false otherwise + * @throws SQLException if a database access error occurs + * @since 1.4 + */ + boolean supportsStatementPooling() throws SQLException; + + //------------------------- JDBC 4.0 ----------------------------------- + + /** + * Indicates whether or not this data source supports the SQL ROWID type, + * and if so the lifetime for which a RowId object remains valid. + *

+ * The returned int values have the following relationship: + *

+     *     ROWID_UNSUPPORTED < ROWID_VALID_OTHER < ROWID_VALID_TRANSACTION
+     *         < ROWID_VALID_SESSION < ROWID_VALID_FOREVER
+     * 
+ * so conditional logic such as + *
+     *     if (metadata.getRowIdLifetime() > DatabaseMetaData.ROWID_VALID_TRANSACTION)
+     * 
+ * can be used. Valid Forever means valid across all Sessions, and valid for + * a Session means valid across all its contained Transactions. + * + * @return the status indicating the lifetime of a RowId + * @throws SQLException if a database access error occurs + * @since 1.6 + */ + RowIdLifetime getRowIdLifetime() throws SQLException; + + /** + * Retrieves the schema names available in this database. The results + * are ordered by TABLE_CATALOG and + * TABLE_SCHEM. + * + *

The schema columns are: + *

    + *
  1. TABLE_SCHEM String => schema name + *
  2. TABLE_CATALOG String => catalog name (may be null) + *
+ * + * + * @param catalog a catalog name; must match the catalog name as it is stored + * in the database;"" retrieves those without a catalog; null means catalog + * name should not be used to narrow down the search. + * @param schemaPattern a schema name; must match the schema name as it is + * stored in the database; null means + * schema name should not be used to narrow down the search. + * @return a ResultSet object in which each row is a + * schema description + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + * @since 1.6 + */ + ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException; + + /** + * Retrieves whether this database supports invoking user-defined or vendor functions + * using the stored procedure escape syntax. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + * @since 1.6 + */ + boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException; + + /** + * Retrieves whether a SQLException while autoCommit is true inidcates + * that all open ResultSets are closed, even ones that are holdable. When a SQLException occurs while + * autocommit is true, it is vendor specific whether the JDBC driver responds with a commit operation, a + * rollback operation, or by doing neither a commit nor a rollback. A potential result of this difference + * is in whether or not holdable ResultSets are closed. + * + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + * @since 1.6 + */ + boolean autoCommitFailureClosesAllResultSets() throws SQLException; + /** + * Retrieves a list of the client info properties + * that the driver supports. The result set contains the following columns + *

+ *

    + *
  1. NAME String=> The name of the client info property
    + *
  2. MAX_LEN int=> The maximum length of the value for the property
    + *
  3. DEFAULT_VALUE String=> The default value of the property
    + *
  4. DESCRIPTION String=> A description of the property. This will typically + * contain information as to where this property is + * stored in the database. + *
+ *

+ * The ResultSet is sorted by the NAME column + *

+ * @return A ResultSet object; each row is a supported client info + * property + *

+ * @exception SQLException if a database access error occurs + *

+ * @since 1.6 + */ + ResultSet getClientInfoProperties() + throws SQLException; + + /** + * Retrieves a description of the system and user functions available + * in the given catalog. + *

+ * Only system and user function descriptions matching the schema and + * function name criteria are returned. They are ordered by + * FUNCTION_CAT, FUNCTION_SCHEM, + * FUNCTION_NAME and + * SPECIFIC_ NAME. + * + *

Each function description has the the following columns: + *

    + *
  1. FUNCTION_CAT String => function catalog (may be null) + *
  2. FUNCTION_SCHEM String => function schema (may be null) + *
  3. FUNCTION_NAME String => function name. This is the name + * used to invoke the function + *
  4. REMARKS String => explanatory comment on the function + *
  5. FUNCTION_TYPE short => kind of function: + *
      + *
    • functionResultUnknown - Cannot determine if a return value + * or table will be returned + *
    • functionNoTable- Does not return a table + *
    • functionReturnsTable - Returns a table + *
    + *
  6. SPECIFIC_NAME String => the name which uniquely identifies + * this function within its schema. This is a user specified, or DBMS + * generated, name that may be different then the FUNCTION_NAME + * for example with overload functions + *
+ *

+ * A user may not have permission to execute any of the functions that are + * returned by getFunctions + * + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param functionNamePattern a function name pattern; must match the + * function name as it is stored in the database + * @return ResultSet - each row is a function description + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + * @since 1.6 + */ + ResultSet getFunctions(String catalog, String schemaPattern, + String functionNamePattern) throws SQLException; + /** + * Retrieves a description of the given catalog's system or user + * function parameters and return type. + * + *

Only descriptions matching the schema, function and + * parameter name criteria are returned. They are ordered by + * FUNCTION_CAT, FUNCTION_SCHEM, + * FUNCTION_NAME and + * SPECIFIC_ NAME. Within this, the return value, + * if any, is first. Next are the parameter descriptions in call + * order. The column descriptions follow in column number order. + * + *

Each row in the ResultSet + * is a parameter description, column description or + * return type description with the following fields: + *

    + *
  1. FUNCTION_CAT String => function catalog (may be null) + *
  2. FUNCTION_SCHEM String => function schema (may be null) + *
  3. FUNCTION_NAME String => function name. This is the name + * used to invoke the function + *
  4. COLUMN_NAME String => column/parameter name + *
  5. COLUMN_TYPE Short => kind of column/parameter: + *
      + *
    • functionColumnUnknown - nobody knows + *
    • functionColumnIn - IN parameter + *
    • functionColumnInOut - INOUT parameter + *
    • functionColumnOut - OUT parameter + *
    • functionColumnReturn - function return value + *
    • functionColumnResult - Indicates that the parameter or column + * is a column in the ResultSet + *
    + *
  6. DATA_TYPE int => SQL type from java.sql.Types + *
  7. TYPE_NAME String => SQL type name, for a UDT type the + * type name is fully qualified + *
  8. PRECISION int => precision + *
  9. LENGTH int => length in bytes of data + *
  10. SCALE short => scale - null is returned for data types where + * SCALE is not applicable. + *
  11. RADIX short => radix + *
  12. NULLABLE short => can it contain NULL. + *
      + *
    • functionNoNulls - does not allow NULL values + *
    • functionNullable - allows NULL values + *
    • functionNullableUnknown - nullability unknown + *
    + *
  13. REMARKS String => comment describing column/parameter + *
  14. CHAR_OCTET_LENGTH int => the maximum length of binary + * and character based parameters or columns. For any other datatype the returned value + * is a NULL + *
  15. ORDINAL_POSITION int => the ordinal position, starting + * from 1, for the input and output parameters. A value of 0 + * is returned if this row describes the function's return value. + * For result set columns, it is the + * ordinal position of the column in the result set starting from 1. + *
  16. IS_NULLABLE String => ISO rules are used to determine + * the nullability for a parameter or column. + *
      + *
    • YES --- if the parameter or column can include NULLs + *
    • NO --- if the parameter or column cannot include NULLs + *
    • empty string --- if the nullability for the + * parameter or column is unknown + *
    + *
  17. SPECIFIC_NAME String => the name which uniquely identifies + * this function within its schema. This is a user specified, or DBMS + * generated, name that may be different then the FUNCTION_NAME + * for example with overload functions + *
+ * + *

The PRECISION column represents the specified column size for the given + * parameter or column. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. Null is returned for data types where the + * column size is not applicable. + * @param catalog a catalog name; must match the catalog name as it + * is stored in the database; "" retrieves those without a catalog; + * null means that the catalog name should not be used to narrow + * the search + * @param schemaPattern a schema name pattern; must match the schema name + * as it is stored in the database; "" retrieves those without a schema; + * null means that the schema name should not be used to narrow + * the search + * @param functionNamePattern a procedure name pattern; must match the + * function name as it is stored in the database + * @param columnNamePattern a parameter name pattern; must match the + * parameter or column name as it is stored in the database + * @return ResultSet - each row describes a + * user function parameter, column or return type + * + * @exception SQLException if a database access error occurs + * @see #getSearchStringEscape + * @since 1.6 + */ + ResultSet getFunctionColumns(String catalog, + String schemaPattern, + String functionNamePattern, + String columnNamePattern) throws SQLException; + + + /** + * Indicates that type of the parameter or column is unknown. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getFunctionColumns. + */ + int functionColumnUnknown = 0; + + /** + * Indicates that the parameter or column is an IN parameter. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getFunctionColumns. + * @since 1.6 + */ + int functionColumnIn = 1; + + /** + * Indicates that the parameter or column is an INOUT parameter. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getFunctionColumns. + * @since 1.6 + */ + int functionColumnInOut = 2; + + /** + * Indicates that the parameter or column is an OUT parameter. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getFunctionColumns. + * @since 1.6 + */ + int functionColumnOut = 3; + /** + * Indicates that the parameter or column is a return value. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getFunctionColumns. + * @since 1.6 + */ + int functionReturn = 4; + + /** + * Indicates that the parameter or column is a column in a result set. + *

+ * A possible value for the column + * COLUMN_TYPE + * in the ResultSet + * returned by the method getFunctionColumns. + * @since 1.6 + */ + int functionColumnResult = 5; + + + /** + * Indicates that NULL values are not allowed. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet object + * returned by the method getFunctionColumns. + * @since 1.6 + */ + int functionNoNulls = 0; + + /** + * Indicates that NULL values are allowed. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet object + * returned by the method getFunctionColumns. + * @since 1.6 + */ + int functionNullable = 1; + + /** + * Indicates that whether NULL values are allowed + * is unknown. + *

+ * A possible value for the column + * NULLABLE + * in the ResultSet object + * returned by the method getFunctionColumns. + * @since 1.6 + */ + int functionNullableUnknown = 2; + + /** + * Indicates that it is not known whether the function returns + * a result or a table. + *

+ * A possible value for column FUNCTION_TYPE in the + * ResultSet object returned by the method + * getFunctions. + * @since 1.6 + */ + int functionResultUnknown = 0; + + /** + * Indicates that the function does not return a table. + *

+ * A possible value for column FUNCTION_TYPE in the + * ResultSet object returned by the method + * getFunctions. + * @since 1.6 + */ + int functionNoTable = 1; + + /** + * Indicates that the function returns a table. + *

+ * A possible value for column FUNCTION_TYPE in the + * ResultSet object returned by the method + * getFunctions. + * @since 1.6 + */ + int functionReturnsTable = 2; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Date.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Date.java new file mode 100644 index 0000000000..c4142e4f8c --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Date.java @@ -0,0 +1,252 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + *

A thin wrapper around a millisecond value that allows + * JDBC to identify this as an SQL DATE value. A + * milliseconds value represents the number of milliseconds that + * have passed since January 1, 1970 00:00:00.000 GMT. + *

+ * To conform with the definition of SQL DATE, the + * millisecond values wrapped by a java.sql.Date instance + * must be 'normalized' by setting the + * hours, minutes, seconds, and milliseconds to zero in the particular + * time zone with which the instance is associated. + */ +public class Date extends java.util.Date { + + /** + * Constructs a Date object initialized with the given + * year, month, and day. + *

+ * The result is undefined if a given argument is out of bounds. + * + * @param year the year minus 1900; must be 0 to 8099. (Note that + * 8099 is 9999 minus 1900.) + * @param month 0 to 11 + * @param day 1 to 31 + * @deprecated instead use the constructor Date(long date) + */ + @Deprecated // Android added + public Date(int year, int month, int day) { + super(year, month, day); + } + + /** + * Constructs a Date object using the given milliseconds + * time value. If the given milliseconds value contains time + * information, the driver will set the time components to the + * time in the default time zone (the time zone of the Java virtual + * machine running the application) that corresponds to zero GMT. + * + * @param date milliseconds since January 1, 1970, 00:00:00 GMT not + * to exceed the milliseconds representation for the year 8099. + * A negative number indicates the number of milliseconds + * before January 1, 1970, 00:00:00 GMT. + */ + public Date(long date) { + // If the millisecond date value contains time info, mask it out. + super(date); + + } + + /** + * Sets an existing Date object + * using the given milliseconds time value. + * If the given milliseconds value contains time information, + * the driver will set the time components to the + * time in the default time zone (the time zone of the Java virtual + * machine running the application) that corresponds to zero GMT. + * + * @param date milliseconds since January 1, 1970, 00:00:00 GMT not + * to exceed the milliseconds representation for the year 8099. + * A negative number indicates the number of milliseconds + * before January 1, 1970, 00:00:00 GMT. + */ + public void setTime(long date) { + // If the millisecond date value contains time info, mask it out. + super.setTime(date); + } + + /** + * Converts a string in JDBC date escape format to + * a Date value. + * + * @param s a String object representing a date in + * in the format "yyyy-[m]m-[d]d". The leading zero for mm + * and dd may also be omitted. + * @return a java.sql.Date object representing the + * given date + * @throws IllegalArgumentException if the date given is not in the + * JDBC date escape format (yyyy-[m]m-[d]d) + */ + public static Date valueOf(String s) { + final int YEAR_LENGTH = 4; + final int MONTH_LENGTH = 2; + final int DAY_LENGTH = 2; + final int MAX_MONTH = 12; + final int MAX_DAY = 31; + int firstDash; + int secondDash; + Date d = null; + + if (s == null) { + throw new java.lang.IllegalArgumentException(); + } + + firstDash = s.indexOf('-'); + secondDash = s.indexOf('-', firstDash + 1); + + if ((firstDash > 0) && (secondDash > 0) && (secondDash < s.length() - 1)) { + String yyyy = s.substring(0, firstDash); + String mm = s.substring(firstDash + 1, secondDash); + String dd = s.substring(secondDash + 1); + if (yyyy.length() == YEAR_LENGTH && + (mm.length() >= 1 && mm.length() <= MONTH_LENGTH) && + (dd.length() >= 1 && dd.length() <= DAY_LENGTH)) { + int year = Integer.parseInt(yyyy); + int month = Integer.parseInt(mm); + int day = Integer.parseInt(dd); + + if ((month >= 1 && month <= MAX_MONTH) && (day >= 1 && day <= MAX_DAY)) { + d = new Date(year - 1900, month - 1, day); + } + } + } + if (d == null) { + throw new java.lang.IllegalArgumentException(); + } + + return d; + + } + + + /** + * Formats a date in the date escape format yyyy-mm-dd. + *

+ * @return a String in yyyy-mm-dd format + */ + public String toString () { + int year = super.getYear() + 1900; + int month = super.getMonth() + 1; + int day = super.getDate(); + + char buf[] = "2000-00-00".toCharArray(); + buf[0] = Character.forDigit(year/1000,10); + buf[1] = Character.forDigit((year/100)%10,10); + buf[2] = Character.forDigit((year/10)%10,10); + buf[3] = Character.forDigit(year%10,10); + buf[5] = Character.forDigit(month/10,10); + buf[6] = Character.forDigit(month%10,10); + buf[8] = Character.forDigit(day/10,10); + buf[9] = Character.forDigit(day%10,10); + + return new String(buf); + } + + // Override all the time operations inherited from java.util.Date; + + /** + * @deprecated This method is deprecated and should not be used because SQL Date + * values do not have a time component. + * + * @exception java.lang.IllegalArgumentException if this method is invoked + * @see #setHours + */ + @Deprecated // Android added - changed javadoc to include deprecation note. + public int getHours() { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL Date + * values do not have a time component. + * + * @exception java.lang.IllegalArgumentException if this method is invoked + * @see #setMinutes + */ + @Deprecated // Android added - changed javadoc to include deprecation note. + public int getMinutes() { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL Date + * values do not have a time component. + * + * @exception java.lang.IllegalArgumentException if this method is invoked + * @see #setSeconds + */ + @Deprecated // Android added - changed javadoc to include deprecation note. + public int getSeconds() { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL Date + * values do not have a time component. + * + * @exception java.lang.IllegalArgumentException if this method is invoked + * @see #getHours + */ + @Deprecated // Android added - changed javadoc to include deprecation note. + public void setHours(int i) { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL Date + * values do not have a time component. + * + * @exception java.lang.IllegalArgumentException if this method is invoked + * @see #getMinutes + */ + @Deprecated // Android added - changed javadoc to include deprecation note. + public void setMinutes(int i) { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL Date + * values do not have a time component. + * + * @exception java.lang.IllegalArgumentException if this method is invoked + * @see #getSeconds + */ + @Deprecated // Android added - changed javadoc to include deprecation note. + public void setSeconds(int i) { + throw new java.lang.IllegalArgumentException(); + } + + /** + * Private serial version unique ID to ensure serialization + * compatibility. + */ + static final long serialVersionUID = 1511598038487230103L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Driver.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Driver.java new file mode 100644 index 0000000000..a9bdc7d719 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Driver.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.util.logging.Logger; + +/** + * The interface that every driver class must implement. + *

The Java SQL framework allows for multiple database drivers. + * + *

Each driver should supply a class that implements + * the Driver interface. + * + *

The DriverManager will try to load as many drivers as it can + * find and then for any given connection request, it will ask each + * driver in turn to try to connect to the target URL. + * + *

It is strongly recommended that each Driver class should be + * small and standalone so that the Driver class can be loaded and + * queried without bringing in vast quantities of supporting code. + * + *

When a Driver class is loaded, it should create an instance of + * itself and register it with the DriverManager. This means that a + * user can load and register a driver by calling + *

+ *   Class.forName("foo.bah.Driver")
+ * 
+ * + * @see DriverManager + * @see Connection + */ +public interface Driver { + + /** + * Attempts to make a database connection to the given URL. + * The driver should return "null" if it realizes it is the wrong kind + * of driver to connect to the given URL. This will be common, as when + * the JDBC driver manager is asked to connect to a given URL it passes + * the URL to each loaded driver in turn. + * + *

The driver should throw an SQLException if it is the right + * driver to connect to the given URL but has trouble connecting to + * the database. + * + *

The java.util.Properties argument can be used to pass + * arbitrary string tag/value pairs as connection arguments. + * Normally at least "user" and "password" properties should be + * included in the Properties object. + * + * @param url the URL of the database to which to connect + * @param info a list of arbitrary string tag/value pairs as + * connection arguments. Normally at least a "user" and + * "password" property should be included. + * @return a Connection object that represents a + * connection to the URL + * @exception SQLException if a database access error occurs + */ + Connection connect(String url, java.util.Properties info) + throws SQLException; + + /** + * Retrieves whether the driver thinks that it can open a connection + * to the given URL. Typically drivers will return true if they + * understand the subprotocol specified in the URL and false if + * they do not. + * + * @param url the URL of the database + * @return true if this driver understands the given URL; + * false otherwise + * @exception SQLException if a database access error occurs + */ + boolean acceptsURL(String url) throws SQLException; + + + /** + * Gets information about the possible properties for this driver. + *

+ * The getPropertyInfo method is intended to allow a generic + * GUI tool to discover what properties it should prompt + * a human for in order to get + * enough information to connect to a database. Note that depending on + * the values the human has supplied so far, additional values may become + * necessary, so it may be necessary to iterate though several calls + * to the getPropertyInfo method. + * + * @param url the URL of the database to which to connect + * @param info a proposed list of tag/value pairs that will be sent on + * connect open + * @return an array of DriverPropertyInfo objects describing + * possible properties. This array may be an empty array if + * no properties are required. + * @exception SQLException if a database access error occurs + */ + DriverPropertyInfo[] getPropertyInfo(String url, java.util.Properties info) + throws SQLException; + + + /** + * Retrieves the driver's major version number. Initially this should be 1. + * + * @return this driver's major version number + */ + int getMajorVersion(); + + /** + * Gets the driver's minor version number. Initially this should be 0. + * @return this driver's minor version number + */ + int getMinorVersion(); + + + /** + * Reports whether this driver is a genuine JDBC + * CompliantTM driver. + * A driver may only report true here if it passes the JDBC + * compliance tests; otherwise it is required to return false. + *

+ * JDBC compliance requires full support for the JDBC API and full support + * for SQL 92 Entry Level. It is expected that JDBC compliant drivers will + * be available for all the major commercial databases. + *

+ * This method is not intended to encourage the development of non-JDBC + * compliant drivers, but is a recognition of the fact that some vendors + * are interested in using the JDBC API and framework for lightweight + * databases that do not support full database functionality, or for + * special databases such as document information retrieval where a SQL + * implementation may not be feasible. + * @return true if this driver is JDBC Compliant; false + * otherwise + */ + boolean jdbcCompliant(); + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DriverPropertyInfo.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DriverPropertyInfo.java new file mode 100644 index 0000000000..6e78e0723f --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/DriverPropertyInfo.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + *

Driver properties for making a connection. The + * DriverPropertyInfo class is of interest only to advanced programmers + * who need to interact with a Driver via the method + * getDriverProperties to discover + * and supply properties for connections. + */ + +public class DriverPropertyInfo { + + /** + * Constructs a DriverPropertyInfo object with a given + * name and value. The description and choices + * are intialized to null and required is initialized + * to false. + * + * @param name the name of the property + * @param value the current value, which may be null + */ + public DriverPropertyInfo(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * The name of the property. + */ + public String name; + + /** + * A brief description of the property, which may be null. + */ + public String description = null; + + /** + * The required field is true if a value must be + * supplied for this property + * during Driver.connect and false otherwise. + */ + public boolean required = false; + + /** + * The value field specifies the current value of + * the property, based on a combination of the information + * supplied to the method getPropertyInfo, the + * Java environment, and the driver-supplied default values. This field + * may be null if no value is known. + */ + public String value = null; + + /** + * An array of possible values if the value for the field + * DriverPropertyInfo.value may be selected + * from a particular set of values; otherwise null. + */ + public String[] choices = null; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/NClob.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/NClob.java new file mode 100644 index 0000000000..a70ed6190a --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/NClob.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.sql.Clob; + +/** + * The mapping in the JavaTM programming language + * for the SQL NCLOB type. + * An SQL NCLOB is a built-in type + * that stores a Character Large Object using the National Character Set + * as a column value in a row of a database table. + *

The NClob interface extends the Clob interface + * which provides provides methods for getting the + * length of an SQL NCLOB value, + * for materializing a NCLOB value on the client, and for + * searching for a substring or NCLOB object within a + * NCLOB value. A NClob object, just like a Clob object, is valid for the duration + * of the transaction in which it was created. + * Methods in the interfaces {@link ResultSet}, + * {@link CallableStatement}, and {@link PreparedStatement}, such as + * getNClob and setNClob allow a programmer to + * access an SQL NCLOB value. In addition, this interface + * has methods for updating a NCLOB value. + *

+ * All methods on the NClob interface must be fully implemented if the + * JDBC driver supports the data type. + * + * @since 1.6 + */ + +public interface NClob extends Clob { } diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ParameterMetaData.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ParameterMetaData.java new file mode 100644 index 0000000000..84eafdca53 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ParameterMetaData.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * An object that can be used to get information about the types + * and properties for each parameter marker in a + * PreparedStatement object. For some queries and driver + * implementations, the data that would be returned by a ParameterMetaData + * object may not be available until the PreparedStatement has + * been executed. + *

+ *Some driver implementations may not be able to provide information about the + *types and properties for each parameter marker in a CallableStatement + *object. + * + * @since 1.4 + */ + +public interface ParameterMetaData extends Wrapper { + + /** + * Retrieves the number of parameters in the PreparedStatement + * object for which this ParameterMetaData object contains + * information. + * + * @return the number of parameters + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getParameterCount() throws SQLException; + + /** + * Retrieves whether null values are allowed in the designated parameter. + * + * @param param the first parameter is 1, the second is 2, ... + * @return the nullability status of the given parameter; one of + * ParameterMetaData.parameterNoNulls, + * ParameterMetaData.parameterNullable, or + * ParameterMetaData.parameterNullableUnknown + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int isNullable(int param) throws SQLException; + + /** + * The constant indicating that a + * parameter will not allow NULL values. + */ + int parameterNoNulls = 0; + + /** + * The constant indicating that a + * parameter will allow NULL values. + */ + int parameterNullable = 1; + + /** + * The constant indicating that the + * nullability of a parameter is unknown. + */ + int parameterNullableUnknown = 2; + + /** + * Retrieves whether values for the designated parameter can be signed numbers. + * + * @param param the first parameter is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + boolean isSigned(int param) throws SQLException; + + /** + * Retrieves the designated parameter's specified column size. + * + *

The returned value represents the maximum column size for the given parameter. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. 0 is returned for data types where the + * column size is not applicable. + * + * @param param the first parameter is 1, the second is 2, ... + * @return precision + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getPrecision(int param) throws SQLException; + + /** + * Retrieves the designated parameter's number of digits to right of the decimal point. + * 0 is returned for data types where the scale is not applicable. + * + * @param param the first parameter is 1, the second is 2, ... + * @return scale + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getScale(int param) throws SQLException; + + /** + * Retrieves the designated parameter's SQL type. + * + * @param param the first parameter is 1, the second is 2, ... + * @return SQL type from java.sql.Types + * @exception SQLException if a database access error occurs + * @since 1.4 + * @see Types + */ + int getParameterType(int param) throws SQLException; + + /** + * Retrieves the designated parameter's database-specific type name. + * + * @param param the first parameter is 1, the second is 2, ... + * @return type the name used by the database. If the parameter type is + * a user-defined type, then a fully-qualified type name is returned. + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + String getParameterTypeName(int param) throws SQLException; + + + /** + * Retrieves the fully-qualified name of the Java class whose instances + * should be passed to the method PreparedStatement.setObject. + * + * @param param the first parameter is 1, the second is 2, ... + * @return the fully-qualified name of the class in the Java programming + * language that would be used by the method + * PreparedStatement.setObject to set the value + * in the specified parameter. This is the class name used + * for custom mapping. + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + String getParameterClassName(int param) throws SQLException; + + /** + * The constant indicating that the mode of the parameter is unknown. + */ + int parameterModeUnknown = 0; + + /** + * The constant indicating that the parameter's mode is IN. + */ + int parameterModeIn = 1; + + /** + * The constant indicating that the parameter's mode is INOUT. + */ + int parameterModeInOut = 2; + + /** + * The constant indicating that the parameter's mode is OUT. + */ + int parameterModeOut = 4; + + /** + * Retrieves the designated parameter's mode. + * + * @param param the first parameter is 1, the second is 2, ... + * @return mode of the parameter; one of + * ParameterMetaData.parameterModeIn, + * ParameterMetaData.parameterModeOut, or + * ParameterMetaData.parameterModeInOut + * ParameterMetaData.parameterModeUnknown. + * @exception SQLException if a database access error occurs + * @since 1.4 + */ + int getParameterMode(int param) throws SQLException; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/PreparedStatement.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/PreparedStatement.java new file mode 100644 index 0000000000..07633900ed --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/PreparedStatement.java @@ -0,0 +1,1225 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.io.Reader; +import java.io.InputStream; + +/** + * An object that represents a precompiled SQL statement. + *

A SQL statement is precompiled and stored in a + * PreparedStatement object. This object can then be used to + * efficiently execute this statement multiple times. + * + *

Note: The setter methods (setShort, setString, + * and so on) for setting IN parameter values + * must specify types that are compatible with the defined SQL type of + * the input parameter. For instance, if the IN parameter has SQL type + * INTEGER, then the method setInt should be used. + * + *

If arbitrary parameter type conversions are required, the method + * setObject should be used with a target SQL type. + *

+ * In the following example of setting a parameter, con represents + * an active connection: + *

+ *   PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
+ *                                     SET SALARY = ? WHERE ID = ?");
+ *   pstmt.setBigDecimal(1, 153833.00)
+ *   pstmt.setInt(2, 110592)
+ * 
+ * + * @see Connection#prepareStatement + * @see ResultSet + */ + +public interface PreparedStatement extends Statement { + + /** + * Executes the SQL query in this PreparedStatement object + * and returns the ResultSet object generated by the query. + * + * @return a ResultSet object that contains the data produced by the + * query; never null + * @exception SQLException if a database access error occurs; + * this method is called on a closed PreparedStatement or the SQL + * statement does not return a ResultSet object + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + */ + ResultSet executeQuery() throws SQLException; + + /** + * Executes the SQL statement in this PreparedStatement object, + * which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or + * DELETE; or an SQL statement that returns nothing, + * such as a DDL statement. + * + * @return either (1) the row count for SQL Data Manipulation Language (DML) statements + * or (2) 0 for SQL statements that return nothing + * @exception SQLException if a database access error occurs; + * this method is called on a closed PreparedStatement + * or the SQL statement returns a ResultSet object + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + */ + int executeUpdate() throws SQLException; + + /** + * Sets the designated parameter to SQL NULL. + * + *

Note: You must specify the parameter's SQL type. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param sqlType the SQL type code defined in java.sql.Types + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @exception SQLFeatureNotSupportedException if sqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type + */ + void setNull(int parameterIndex, int sqlType) throws SQLException; + + /** + * Sets the designated parameter to the given Java boolean value. + * The driver converts this + * to an SQL BIT or BOOLEAN value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; + * if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setBoolean(int parameterIndex, boolean x) throws SQLException; + + /** + * Sets the designated parameter to the given Java byte value. + * The driver converts this + * to an SQL TINYINT value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setByte(int parameterIndex, byte x) throws SQLException; + + /** + * Sets the designated parameter to the given Java short value. + * The driver converts this + * to an SQL SMALLINT value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setShort(int parameterIndex, short x) throws SQLException; + + /** + * Sets the designated parameter to the given Java int value. + * The driver converts this + * to an SQL INTEGER value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setInt(int parameterIndex, int x) throws SQLException; + + /** + * Sets the designated parameter to the given Java long value. + * The driver converts this + * to an SQL BIGINT value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setLong(int parameterIndex, long x) throws SQLException; + + /** + * Sets the designated parameter to the given Java float value. + * The driver converts this + * to an SQL REAL value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setFloat(int parameterIndex, float x) throws SQLException; + + /** + * Sets the designated parameter to the given Java double value. + * The driver converts this + * to an SQL DOUBLE value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setDouble(int parameterIndex, double x) throws SQLException; + + /** + * Sets the designated parameter to the given java.math.BigDecimal value. + * The driver converts this to an SQL NUMERIC value when + * it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException; + + /** + * Sets the designated parameter to the given Java String value. + * The driver converts this + * to an SQL VARCHAR or LONGVARCHAR value + * (depending on the argument's + * size relative to the driver's limits on VARCHAR values) + * when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setString(int parameterIndex, String x) throws SQLException; + + /** + * Sets the designated parameter to the given Java array of bytes. The driver converts + * this to an SQL VARBINARY or LONGVARBINARY + * (depending on the argument's size relative to the driver's limits on + * VARBINARY values) when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setBytes(int parameterIndex, byte x[]) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Date value + * using the default time zone of the virtual machine that is running + * the application. + * The driver converts this + * to an SQL DATE value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setDate(int parameterIndex, java.sql.Date x) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Time value. + * The driver converts this + * to an SQL TIME value when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setTime(int parameterIndex, java.sql.Time x) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Timestamp value. + * The driver + * converts this to an SQL TIMESTAMP value when it sends it to the + * database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement */ + void setTimestamp(int parameterIndex, java.sql.Timestamp x) + throws SQLException; + + /** + * Sets the designated parameter to the given input stream, which will have + * the specified number of bytes. + * When a very large ASCII value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.InputStream. Data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from ASCII to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the Java input stream that contains the ASCII parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) + throws SQLException; + + /** + * Sets the designated parameter to the given input stream, which + * will have the specified number of bytes. + * + * When a very large Unicode value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.InputStream object. The data will be read from the + * stream as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from Unicode to the database char format. + * + *The byte format of the Unicode stream must be a Java UTF-8, as defined in the + *Java Virtual Machine Specification. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x a java.io.InputStream object that contains the + * Unicode parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @deprecated Deprecated. + */ + @Deprecated + void setUnicodeStream(int parameterIndex, java.io.InputStream x, + int length) throws SQLException; + + /** + * Sets the designated parameter to the given input stream, which will have + * the specified number of bytes. + * When a very large binary value is input to a LONGVARBINARY + * parameter, it may be more practical to send it via a + * java.io.InputStream object. The data will be read from the + * stream as needed until end-of-file is reached. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the java input stream which contains the binary parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void setBinaryStream(int parameterIndex, java.io.InputStream x, + int length) throws SQLException; + + /** + * Clears the current parameter values immediately. + *

In general, parameter values remain in force for repeated use of a + * statement. Setting a parameter value automatically clears its + * previous value. However, in some cases it is useful to immediately + * release the resources used by the current parameter values; this can + * be done by calling the method clearParameters. + * + * @exception SQLException if a database access error occurs or + * this method is called on a closed PreparedStatement + */ + void clearParameters() throws SQLException; + + //---------------------------------------------------------------------- + // Advanced features: + + /** + * Sets the value of the designated parameter with the given object. + * This method is like the method setObject + * above, except that it assumes a scale of zero. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the object containing the input parameter value + * @param targetSqlType the SQL type (as defined in java.sql.Types) to be + * sent to the database + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @exception SQLFeatureNotSupportedException if targetSqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type + * @see Types + */ + void setObject(int parameterIndex, Object x, int targetSqlType) + throws SQLException; + + /** + *

Sets the value of the designated parameter using the given object. + * The second parameter must be of type Object; therefore, the + * java.lang equivalent objects should be used for built-in types. + * + *

The JDBC specification specifies a standard mapping from + * Java Object types to SQL types. The given argument + * will be converted to the corresponding SQL type before being + * sent to the database. + * + *

Note that this method may be used to pass datatabase- + * specific abstract data types, by using a driver-specific Java + * type. + * + * If the object is of a class implementing the interface SQLData, + * the JDBC driver should call the method SQLData.writeSQL + * to write it to the SQL data stream. + * If, on the other hand, the object is of a class implementing + * Ref, Blob, Clob, NClob, + * Struct, java.net.URL, RowId, SQLXML + * or Array, the driver should pass it to the database as a + * value of the corresponding SQL type. + *

+ *Note: Not all databases allow for a non-typed Null to be sent to + * the backend. For maximum portability, the setNull or the + * setObject(int parameterIndex, Object x, int sqlType) + * method should be used + * instead of setObject(int parameterIndex, Object x). + *

+ * Note: This method throws an exception if there is an ambiguity, for example, if the + * object is of a class implementing more than one of the interfaces named above. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the object containing the input parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs; + * this method is called on a closed PreparedStatement + * or the type of the given object is ambiguous + */ + void setObject(int parameterIndex, Object x) throws SQLException; + + /** + * Executes the SQL statement in this PreparedStatement object, + * which may be any kind of SQL statement. + * Some prepared statements return multiple results; the execute + * method handles these complex statements as well as the simpler + * form of statements handled by the methods executeQuery + * and executeUpdate. + *

+ * The execute method returns a boolean to + * indicate the form of the first result. You must call either the method + * getResultSet or getUpdateCount + * to retrieve the result; you must call getMoreResults to + * move to any subsequent result(s). + * + * @return true if the first result is a ResultSet + * object; false if the first result is an update + * count or there is no result + * @exception SQLException if a database access error occurs; + * this method is called on a closed PreparedStatement + * or an argument is supplied to this method + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * @see Statement#execute + * @see Statement#getResultSet + * @see Statement#getUpdateCount + * @see Statement#getMoreResults + + */ + boolean execute() throws SQLException; + + //--------------------------JDBC 2.0----------------------------- + + /** + * Adds a set of parameters to this PreparedStatement + * object's batch of commands. + * + * @exception SQLException if a database access error occurs or + * this method is called on a closed PreparedStatement + * @see Statement#addBatch + * @since 1.2 + */ + void addBatch() throws SQLException; + + /** + * Sets the designated parameter to the given Reader + * object, which is the given number of characters long. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param reader the java.io.Reader object that contains the + * Unicode data + * @param length the number of characters in the stream + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @since 1.2 + */ + void setCharacterStream(int parameterIndex, + java.io.Reader reader, + int length) throws SQLException; + + /** + * Sets the designated parameter to the given + * REF(<structured-type>) value. + * The driver converts this to an SQL REF value when it + * sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x an SQL REF value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.2 + */ + void setRef (int parameterIndex, Ref x) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Blob object. + * The driver converts this to an SQL BLOB value when it + * sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x a Blob object that maps an SQL BLOB value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.2 + */ + void setBlob (int parameterIndex, Blob x) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Clob object. + * The driver converts this to an SQL CLOB value when it + * sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x a Clob object that maps an SQL CLOB value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.2 + */ + void setClob (int parameterIndex, Clob x) throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Array object. + * The driver converts this to an SQL ARRAY value when it + * sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x an Array object that maps an SQL ARRAY value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.2 + */ + void setArray (int parameterIndex, Array x) throws SQLException; + + /** + * Retrieves a ResultSetMetaData object that contains + * information about the columns of the ResultSet object + * that will be returned when this PreparedStatement object + * is executed. + *

+ * Because a PreparedStatement object is precompiled, it is + * possible to know about the ResultSet object that it will + * return without having to execute it. Consequently, it is possible + * to invoke the method getMetaData on a + * PreparedStatement object rather than waiting to execute + * it and then invoking the ResultSet.getMetaData method + * on the ResultSet object that is returned. + *

+ * NOTE: Using this method may be expensive for some drivers due + * to the lack of underlying DBMS support. + * + * @return the description of a ResultSet object's columns or + * null if the driver cannot return a + * ResultSetMetaData object + * @exception SQLException if a database access error occurs or + * this method is called on a closed PreparedStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + ResultSetMetaData getMetaData() throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Date value, + * using the given Calendar object. The driver uses + * the Calendar object to construct an SQL DATE value, + * which the driver then sends to the database. With + * a Calendar object, the driver can calculate the date + * taking into account a custom timezone. If no + * Calendar object is specified, the driver uses the default + * timezone, which is that of the virtual machine running the application. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @param cal the Calendar object the driver will use + * to construct the date + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @since 1.2 + */ + void setDate(int parameterIndex, java.sql.Date x, Calendar cal) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Time value, + * using the given Calendar object. The driver uses + * the Calendar object to construct an SQL TIME value, + * which the driver then sends to the database. With + * a Calendar object, the driver can calculate the time + * taking into account a custom timezone. If no + * Calendar object is specified, the driver uses the default + * timezone, which is that of the virtual machine running the application. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @param cal the Calendar object the driver will use + * to construct the time + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @since 1.2 + */ + void setTime(int parameterIndex, java.sql.Time x, Calendar cal) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.Timestamp value, + * using the given Calendar object. The driver uses + * the Calendar object to construct an SQL TIMESTAMP value, + * which the driver then sends to the database. With a + * Calendar object, the driver can calculate the timestamp + * taking into account a custom timezone. If no + * Calendar object is specified, the driver uses the default + * timezone, which is that of the virtual machine running the application. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @param cal the Calendar object the driver will use + * to construct the timestamp + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @since 1.2 + */ + void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) + throws SQLException; + + /** + * Sets the designated parameter to SQL NULL. + * This version of the method setNull should + * be used for user-defined types and REF type parameters. Examples + * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and + * named array types. + * + *

Note: To be portable, applications must give the + * SQL type code and the fully-qualified SQL type name when specifying + * a NULL user-defined or REF parameter. In the case of a user-defined type + * the name is the type name of the parameter itself. For a REF + * parameter, the name is the type name of the referenced type. If + * a JDBC driver does not need the type code or type name information, + * it may ignore it. + * + * Although it is intended for user-defined and Ref parameters, + * this method may be used to set a null parameter of any JDBC type. + * If the parameter does not have a user-defined or REF type, the given + * typeName is ignored. + * + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param sqlType a value from java.sql.Types + * @param typeName the fully-qualified name of an SQL user-defined type; + * ignored if the parameter is not a user-defined type or REF + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @exception SQLFeatureNotSupportedException if sqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type or if the JDBC driver does not support this method + * @since 1.2 + */ + void setNull (int parameterIndex, int sqlType, String typeName) + throws SQLException; + + //------------------------- JDBC 3.0 ----------------------------------- + + /** + * Sets the designated parameter to the given java.net.URL value. + * The driver converts this to an SQL DATALINK value + * when it sends it to the database. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the java.net.URL object to be set + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.4 + */ + void setURL(int parameterIndex, java.net.URL x) throws SQLException; + + /** + * Retrieves the number, types and properties of this + * PreparedStatement object's parameters. + * + * @return a ParameterMetaData object that contains information + * about the number, types and properties for each + * parameter marker of this PreparedStatement object + * @exception SQLException if a database access error occurs or + * this method is called on a closed PreparedStatement + * @see ParameterMetaData + * @since 1.4 + */ + ParameterMetaData getParameterMetaData() throws SQLException; + + //------------------------- JDBC 4.0 ----------------------------------- + + /** + * Sets the designated parameter to the given java.sql.RowId object. The + * driver converts this to a SQL ROWID value when it sends it + * to the database + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the parameter value + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * + * @since 1.6 + */ + void setRowId(int parameterIndex, RowId x) throws SQLException; + + + /** + * Sets the designated paramter to the given String object. + * The driver converts this to a SQL NCHAR or + * NVARCHAR or LONGNVARCHAR value + * (depending on the argument's + * size relative to the driver's limits on NVARCHAR values) + * when it sends it to the database. + * + * @param parameterIndex of the first parameter is 1, the second is 2, ... + * @param value the parameter value + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs; or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setNString(int parameterIndex, String value) throws SQLException; + + /** + * Sets the designated parameter to a Reader object. The + * Reader reads the data till end-of-file is reached. The + * driver does the necessary conversion from Java character format to + * the national character set in the database. + * @param parameterIndex of the first parameter is 1, the second is 2, ... + * @param value the parameter value + * @param length the number of characters in the parameter data. + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs; or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException; + + /** + * Sets the designated parameter to a java.sql.NClob object. The driver converts this to a + * SQL NCLOB value when it sends it to the database. + * @param parameterIndex of the first parameter is 1, the second is 2, ... + * @param value the parameter value + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs; or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setNClob(int parameterIndex, NClob value) throws SQLException; + + /** + * Sets the designated parameter to a Reader object. The reader must contain the number + * of characters specified by length otherwise a SQLException will be + * generated when the PreparedStatement is executed. + *This method differs from the setCharacterStream (int, Reader, int) method + * because it informs the driver that the parameter value should be sent to + * the server as a CLOB. When the setCharacterStream method is used, the + * driver may have to do extra work to determine whether the parameter + * data should be sent to the server as a LONGVARCHAR or a CLOB + * @param parameterIndex index of the first parameter is 1, the second is 2, ... + * @param reader An object that contains the data to set the parameter value to. + * @param length the number of characters in the parameter data. + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs; this method is called on + * a closed PreparedStatement or if the length specified is less than zero. + * + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setClob(int parameterIndex, Reader reader, long length) + throws SQLException; + + /** + * Sets the designated parameter to a InputStream object. The inputstream must contain the number + * of characters specified by length otherwise a SQLException will be + * generated when the PreparedStatement is executed. + * This method differs from the setBinaryStream (int, InputStream, int) + * method because it informs the driver that the parameter value should be + * sent to the server as a BLOB. When the setBinaryStream method is used, + * the driver may have to do extra work to determine whether the parameter + * data should be sent to the server as a LONGVARBINARY or a BLOB + * @param parameterIndex index of the first parameter is 1, + * the second is 2, ... + * @param inputStream An object that contains the data to set the parameter + * value to. + * @param length the number of bytes in the parameter data. + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs; + * this method is called on a closed PreparedStatement; + * if the length specified + * is less than zero or if the number of bytes in the inputstream does not match + * the specfied length. + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * + * @since 1.6 + */ + void setBlob(int parameterIndex, InputStream inputStream, long length) + throws SQLException; + /** + * Sets the designated parameter to a Reader object. The reader must contain the number + * of characters specified by length otherwise a SQLException will be + * generated when the PreparedStatement is executed. + * This method differs from the setCharacterStream (int, Reader, int) method + * because it informs the driver that the parameter value should be sent to + * the server as a NCLOB. When the setCharacterStream method is used, the + * driver may have to do extra work to determine whether the parameter + * data should be sent to the server as a LONGNVARCHAR or a NCLOB + * @param parameterIndex index of the first parameter is 1, the second is 2, ... + * @param reader An object that contains the data to set the parameter value to. + * @param length the number of characters in the parameter data. + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if the length specified is less than zero; + * if the driver does not support national character sets; + * if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * + * @since 1.6 + */ + void setNClob(int parameterIndex, Reader reader, long length) + throws SQLException; + + /** + * Sets the designated parameter to the given java.sql.SQLXML object. + * The driver converts this to an + * SQL XML value when it sends it to the database. + *

+ * + * @param parameterIndex index of the first parameter is 1, the second is 2, ... + * @param xmlObject a SQLXML object that maps an SQL XML value + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs; + * this method is called on a closed PreparedStatement + * or the java.xml.transform.Result, + * Writer or OutputStream has not been closed for + * the SQLXML object + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * + * @since 1.6 + */ + void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException; + + /** + *

Sets the value of the designated parameter with the given object. The second + * argument must be an object type; for integral values, the + * java.lang equivalent objects should be used. + * + * If the second argument is an InputStream then the stream must contain + * the number of bytes specified by scaleOrLength. If the second argument is a + * Reader then the reader must contain the number of characters specified + * by scaleOrLength. If these conditions are not true the driver will generate a + * SQLException when the prepared statement is executed. + * + *

The given Java object will be converted to the given targetSqlType + * before being sent to the database. + * + * If the object has a custom mapping (is of a class implementing the + * interface SQLData), + * the JDBC driver should call the method SQLData.writeSQL to + * write it to the SQL data stream. + * If, on the other hand, the object is of a class implementing + * Ref, Blob, Clob, NClob, + * Struct, java.net.URL, + * or Array, the driver should pass it to the database as a + * value of the corresponding SQL type. + * + *

Note that this method may be used to pass database-specific + * abstract data types. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the object containing the input parameter value + * @param targetSqlType the SQL type (as defined in java.sql.Types) to be + * sent to the database. The scale argument may further qualify this type. + * @param scaleOrLength for java.sql.Types.DECIMAL + * or java.sql.Types.NUMERIC types, + * this is the number of digits after the decimal point. For + * Java Object types InputStream and Reader, + * this is the length + * of the data in the stream or reader. For all other types, + * this value will be ignored. + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs; + * this method is called on a closed PreparedStatement or + * if the Java Object specified by x is an InputStream + * or Reader object and the value of the scale parameter is less + * than zero + * @exception SQLFeatureNotSupportedException if targetSqlType is + * a ARRAY, BLOB, CLOB, + * DATALINK, JAVA_OBJECT, NCHAR, + * NCLOB, NVARCHAR, LONGNVARCHAR, + * REF, ROWID, SQLXML + * or STRUCT data type and the JDBC driver does not support + * this data type + * @see Types + * + * @since 1.6 + */ + void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) + throws SQLException; + /** + * Sets the designated parameter to the given input stream, which will have + * the specified number of bytes. + * When a very large ASCII value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.InputStream. Data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from ASCII to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the Java input stream that contains the ASCII parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @since 1.6 + */ + void setAsciiStream(int parameterIndex, java.io.InputStream x, long length) + throws SQLException; + /** + * Sets the designated parameter to the given input stream, which will have + * the specified number of bytes. + * When a very large binary value is input to a LONGVARBINARY + * parameter, it may be more practical to send it via a + * java.io.InputStream object. The data will be read from the + * stream as needed until end-of-file is reached. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the java input stream which contains the binary parameter value + * @param length the number of bytes in the stream + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @since 1.6 + */ + void setBinaryStream(int parameterIndex, java.io.InputStream x, + long length) throws SQLException; + /** + * Sets the designated parameter to the given Reader + * object, which is the given number of characters long. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param reader the java.io.Reader object that contains the + * Unicode data + * @param length the number of characters in the stream + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @since 1.6 + */ + void setCharacterStream(int parameterIndex, + java.io.Reader reader, + long length) throws SQLException; + //----- + /** + * Sets the designated parameter to the given input stream. + * When a very large ASCII value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.InputStream. Data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from ASCII to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setAsciiStream which takes a length parameter. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the Java input stream that contains the ASCII parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setAsciiStream(int parameterIndex, java.io.InputStream x) + throws SQLException; + /** + * Sets the designated parameter to the given input stream. + * When a very large binary value is input to a LONGVARBINARY + * parameter, it may be more practical to send it via a + * java.io.InputStream object. The data will be read from the + * stream as needed until end-of-file is reached. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setBinaryStream which takes a length parameter. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param x the java input stream which contains the binary parameter value + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setBinaryStream(int parameterIndex, java.io.InputStream x) + throws SQLException; + /** + * Sets the designated parameter to the given Reader + * object. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The data will be read from the stream + * as needed until end-of-file is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setCharacterStream which takes a length parameter. + * + * @param parameterIndex the first parameter is 1, the second is 2, ... + * @param reader the java.io.Reader object that contains the + * Unicode data + * @exception SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setCharacterStream(int parameterIndex, + java.io.Reader reader) throws SQLException; + /** + * Sets the designated parameter to a Reader object. The + * Reader reads the data till end-of-file is reached. The + * driver does the necessary conversion from Java character format to + * the national character set in the database. + + *

Note: This stream object can either be a standard + * Java stream object or your own subclass that implements the + * standard interface. + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setNCharacterStream which takes a length parameter. + * + * @param parameterIndex of the first parameter is 1, the second is 2, ... + * @param value the parameter value + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; if a database access error occurs; or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setNCharacterStream(int parameterIndex, Reader value) throws SQLException; + + /** + * Sets the designated parameter to a Reader object. + * This method differs from the setCharacterStream (int, Reader) method + * because it informs the driver that the parameter value should be sent to + * the server as a CLOB. When the setCharacterStream method is used, the + * driver may have to do extra work to determine whether the parameter + * data should be sent to the server as a LONGVARCHAR or a CLOB + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setClob which takes a length parameter. + * + * @param parameterIndex index of the first parameter is 1, the second is 2, ... + * @param reader An object that contains the data to set the parameter value to. + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs; this method is called on + * a closed PreparedStatementor if parameterIndex does not correspond to a parameter + * marker in the SQL statement + * + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.6 + */ + void setClob(int parameterIndex, Reader reader) + throws SQLException; + + /** + * Sets the designated parameter to a InputStream object. + * This method differs from the setBinaryStream (int, InputStream) + * method because it informs the driver that the parameter value should be + * sent to the server as a BLOB. When the setBinaryStream method is used, + * the driver may have to do extra work to determine whether the parameter + * data should be sent to the server as a LONGVARBINARY or a BLOB + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setBlob which takes a length parameter. + * + * @param parameterIndex index of the first parameter is 1, + * the second is 2, ... + * @param inputStream An object that contains the data to set the parameter + * value to. + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; if a database access error occurs; + * this method is called on a closed PreparedStatement or + * if parameterIndex does not correspond + * to a parameter marker in the SQL statement, + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * + * @since 1.6 + */ + void setBlob(int parameterIndex, InputStream inputStream) + throws SQLException; + /** + * Sets the designated parameter to a Reader object. + * This method differs from the setCharacterStream (int, Reader) method + * because it informs the driver that the parameter value should be sent to + * the server as a NCLOB. When the setCharacterStream method is used, the + * driver may have to do extra work to determine whether the parameter + * data should be sent to the server as a LONGNVARCHAR or a NCLOB + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * setNClob which takes a length parameter. + * + * @param parameterIndex index of the first parameter is 1, the second is 2, ... + * @param reader An object that contains the data to set the parameter value to. + * @throws SQLException if parameterIndex does not correspond to a parameter + * marker in the SQL statement; + * if the driver does not support national character sets; + * if the driver can detect that a data conversion + * error could occur; if a database access error occurs or + * this method is called on a closed PreparedStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * + * @since 1.6 + */ + void setNClob(int parameterIndex, Reader reader) + throws SQLException; + + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Ref.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Ref.java new file mode 100644 index 0000000000..5918dd9d95 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Ref.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The mapping in the Java programming language of an SQL REF + * value, which is a reference to an SQL structured type value in the database. + *

+ * SQL REF values are stored in a table that contains + * instances of a referenceable SQL structured type, and each REF + * value is a unique identifier for one instance in that table. + * An SQL REF value may be used in place of the + * SQL structured type it references, either as a column value in a + * table or an attribute value in a structured type. + *

+ * Because an SQL REF value is a logical pointer to an + * SQL structured type, a Ref object is by default also a logical + * pointer. Thus, retrieving an SQL REF value as + * a Ref object does not materialize + * the attributes of the structured type on the client. + *

+ * A Ref object can be stored in the database using the + * PreparedStatement.setRef method. + *

+ * All methods on the Ref interface must be fully implemented if the + * JDBC driver supports the data type. + * + * @see Struct + * @since 1.2 + */ +public interface Ref { + + /** + * Retrieves the fully-qualified SQL name of the SQL structured type that + * this Ref object references. + * + * @return the fully-qualified SQL name of the referenced SQL structured type + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + String getBaseTypeName() throws SQLException; + + /** + * Retrieves the referenced object and maps it to a Java type + * using the given type map. + * + * @param map a java.util.Map object that contains + * the mapping to use (the fully-qualified name of the SQL + * structured type being referenced and the class object for + * SQLData implementation to which the SQL + * structured type will be mapped) + * @return a Java Object that is the custom mapping for + * the SQL structured type to which this Ref + * object refers + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + * @see #setObject + */ + Object getObject(java.util.Map> map) throws SQLException; + + + /** + * Retrieves the SQL structured type instance referenced by + * this Ref object. If the connection's type map has an entry + * for the structured type, the instance will be custom mapped to + * the Java class indicated in the type map. Otherwise, the + * structured type instance will be mapped to a Struct object. + * + * @return a Java Object that is the mapping for + * the SQL structured type to which this Ref + * object refers + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + * @see #setObject + */ + Object getObject() throws SQLException; + + /** + * Sets the structured type value that this Ref + * object references to the given instance of Object. + * The driver converts this to an SQL structured type when it + * sends it to the database. + * + * @param value an Object representing the SQL + * structured type instance that this + * Ref object will reference + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + * @see #getObject() + * @see #getObject(Map) + * @see PreparedStatement#setObject(int, Object) + * @see CallableStatement#setObject(String, Object) + */ + void setObject(Object value) throws SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ResultSet.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ResultSet.java new file mode 100644 index 0000000000..138c4eda61 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ResultSet.java @@ -0,0 +1,4082 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.io.Reader; +import java.io.InputStream; + +/** + * A table of data representing a database result set, which + * is usually generated by executing a statement that queries the database. + * + *

A ResultSet object maintains a cursor pointing + * to its current row of data. Initially the cursor is positioned + * before the first row. The next method moves the + * cursor to the next row, and because it returns false + * when there are no more rows in the ResultSet object, + * it can be used in a while loop to iterate through + * the result set. + *

+ * A default ResultSet object is not updatable and + * has a cursor that moves forward only. Thus, you can + * iterate through it only once and only from the first row to the + * last row. It is possible to + * produce ResultSet objects that are scrollable and/or + * updatable. The following code fragment, in which con + * is a valid Connection object, illustrates how to make + * a result set that is scrollable and insensitive to updates by others, and + * that is updatable. See ResultSet fields for other + * options. + *

+ *
+ *       Statement stmt = con.createStatement(
+ *                                      ResultSet.TYPE_SCROLL_INSENSITIVE,
+ *                                      ResultSet.CONCUR_UPDATABLE);
+ *       ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
+ *       // rs will be scrollable, will not show changes made by others,
+ *       // and will be updatable
+ *
+ * 
+ * The ResultSet interface provides + * getter methods (getBoolean, getLong, and so on) + * for retrieving column values from the current row. + * Values can be retrieved using either the index number of the + * column or the name of the column. In general, using the + * column index will be more efficient. Columns are numbered from 1. + * For maximum portability, result set columns within each row should be + * read in left-to-right order, and each column should be read only once. + * + *

For the getter methods, a JDBC driver attempts + * to convert the underlying data to the Java type specified in the + * getter method and returns a suitable Java value. The JDBC specification + * has a table showing the allowable mappings from SQL types to Java types + * that can be used by the ResultSet getter methods. + *

+ *

Column names used as input to getter methods are case + * insensitive. When a getter method is called with + * a column name and several columns have the same name, + * the value of the first matching column will be returned. + * The column name option is + * designed to be used when column names are used in the SQL + * query that generated the result set. + * For columns that are NOT explicitly named in the query, it + * is best to use column numbers. If column names are used, the + * programmer should take care to guarantee that they uniquely refer to + * the intended columns, which can be assured with the SQL AS clause. + *

+ * A set of updater methods were added to this interface + * in the JDBC 2.0 API (JavaTM 2 SDK, + * Standard Edition, version 1.2). The comments regarding parameters + * to the getter methods also apply to parameters to the + * updater methods. + *

+ * The updater methods may be used in two ways: + *

    + *
  1. to update a column value in the current row. In a scrollable + * ResultSet object, the cursor can be moved backwards + * and forwards, to an absolute position, or to a position + * relative to the current row. + * The following code fragment updates the NAME column + * in the fifth row of the ResultSet object + * rs and then uses the method updateRow + * to update the data source table from which rs was derived. + *
    + *
    + *       rs.absolute(5); // moves the cursor to the fifth row of rs
    + *       rs.updateString("NAME", "AINSWORTH"); // updates the
    + *          // NAME column of row 5 to be AINSWORTH
    + *       rs.updateRow(); // updates the row in the data source
    + *
    + * 
    + *
  2. to insert column values into the insert row. An updatable + * ResultSet object has a special row associated with + * it that serves as a staging area for building a row to be inserted. + * The following code fragment moves the cursor to the insert row, builds + * a three-column row, and inserts it into rs and into + * the data source table using the method insertRow. + *
    + *
    + *       rs.moveToInsertRow(); // moves cursor to the insert row
    + *       rs.updateString(1, "AINSWORTH"); // updates the
    + *          // first column of the insert row to be AINSWORTH
    + *       rs.updateInt(2,35); // updates the second column to be 35
    + *       rs.updateBoolean(3, true); // updates the third column to true
    + *       rs.insertRow();
    + *       rs.moveToCurrentRow();
    + *
    + * 
    + *
+ *

A ResultSet object is automatically closed when the + * Statement object that + * generated it is closed, re-executed, or used + * to retrieve the next result from a sequence of multiple results. + * + *

The number, types and properties of a ResultSet + * object's columns are provided by the ResultSetMetaData + * object returned by the ResultSet.getMetaData method. + * + * @see Statement#executeQuery + * @see Statement#getResultSet + * @see ResultSetMetaData + */ + +public interface ResultSet extends Wrapper, AutoCloseable { + + /** + * Moves the cursor froward one row from its current position. + * A ResultSet cursor is initially positioned + * before the first row; the first call to the method + * next makes the first row the current row; the + * second call makes the second row the current row, and so on. + *

+ * When a call to the next method returns false, + * the cursor is positioned after the last row. Any + * invocation of a ResultSet method which requires a + * current row will result in a SQLException being thrown. + * If the result set type is TYPE_FORWARD_ONLY, it is vendor specified + * whether their JDBC driver implementation will return false or + * throw an SQLException on a + * subsequent call to next. + * + *

If an input stream is open for the current row, a call + * to the method next will + * implicitly close it. A ResultSet object's + * warning chain is cleared when a new row is read. + * + * @return true if the new current row is valid; + * false if there are no more rows + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + */ + boolean next() throws SQLException; + + + /** + * Releases this ResultSet object's database and + * JDBC resources immediately instead of waiting for + * this to happen when it is automatically closed. + * + *

The closing of a ResultSet object does not close the Blob, + * Clob or NClob objects created by the ResultSet. Blob, + * Clob or NClob objects remain valid for at least the duration of the + * transaction in which they are creataed, unless their free method is invoked. + *

+ * When a ResultSet is closed, any ResultSetMetaData + * instances that were created by calling the getMetaData + * method remain accessible. + * + *

Note: A ResultSet object + * is automatically closed by the + * Statement object that generated it when + * that Statement object is closed, + * re-executed, or is used to retrieve the next result from a + * sequence of multiple results. + *

+ * Calling the method close on a ResultSet + * object that is already closed is a no-op. + *

+ *

+ * + * @exception SQLException if a database access error occurs + */ + void close() throws SQLException; + + /** + * Reports whether + * the last column read had a value of SQL NULL. + * Note that you must first call one of the getter methods + * on a column to try to read its value and then call + * the method wasNull to see if the value read was + * SQL NULL. + * + * @return true if the last column value read was SQL + * NULL and false otherwise + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + */ + boolean wasNull() throws SQLException; + + // Methods for accessing results by column index + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a String in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + String getString(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a boolean in the Java programming language. + * + *

If the designated column has a datatype of CHAR or VARCHAR + * and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT + * and contains a 0, a value of false is returned. If the designated column has a datatype + * of CHAR or VARCHAR + * and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT + * and contains a 1, a value of true is returned. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is false + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + boolean getBoolean(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a byte in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + byte getByte(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a short in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + short getShort(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * an int in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + int getInt(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a long in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + long getLong(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a float in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + float getFloat(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a double in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + double getDouble(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a java.sql.BigDecimal in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param scale the number of digits to the right of the decimal point + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @deprecated Deprecated + */ + @Deprecated // Android-added - also changed deprecated tag to contain text. + BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a byte array in the Java programming language. + * The bytes represent the raw values returned by the driver. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + byte[] getBytes(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a java.sql.Date object in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.sql.Date getDate(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a java.sql.Time object in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.sql.Time getTime(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a java.sql.Timestamp object in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a stream of ASCII characters. The value can then be read in chunks from the + * stream. This method is particularly + * suitable for retrieving large LONGVARCHAR values. + * The JDBC driver will + * do any necessary conversion from the database format into ASCII. + * + *

Note: All the data in the returned stream must be + * read prior to getting the value of any other column. The next + * call to a getter method implicitly closes the stream. Also, a + * stream may return 0 when the method + * InputStream.available + * is called whether there is data available or not. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return a Java input stream that delivers the database column value + * as a stream of one-byte ASCII characters; + * if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.io.InputStream getAsciiStream(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * as a stream of two-byte 3 characters. The first byte is + * the high byte; the second byte is the low byte. + * + * The value can then be read in chunks from the + * stream. This method is particularly + * suitable for retrieving large LONGVARCHARvalues. The + * JDBC driver will do any necessary conversion from the database + * format into Unicode. + * + *

Note: All the data in the returned stream must be + * read prior to getting the value of any other column. The next + * call to a getter method implicitly closes the stream. + * Also, a stream may return 0 when the method + * InputStream.available + * is called, whether there is data available or not. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return a Java input stream that delivers the database column value + * as a stream of two-byte Unicode characters; + * if the value is SQL NULL, the value returned is + * null + * + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @deprecated use getCharacterStream in place of + * getUnicodeStream + */ + java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a stream of + * uninterpreted bytes. The value can then be read in chunks from the + * stream. This method is particularly + * suitable for retrieving large LONGVARBINARY values. + * + *

Note: All the data in the returned stream must be + * read prior to getting the value of any other column. The next + * call to a getter method implicitly closes the stream. Also, a + * stream may return 0 when the method + * InputStream.available + * is called whether there is data available or not. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return a Java input stream that delivers the database column value + * as a stream of uninterpreted bytes; + * if the value is SQL NULL, the value returned is + * null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.io.InputStream getBinaryStream(int columnIndex) + throws SQLException; + + + // Methods for accessing results by column label + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a String in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + String getString(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a boolean in the Java programming language. + * + *

If the designated column has a datatype of CHAR or VARCHAR + * and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT + * and contains a 0, a value of false is returned. If the designated column has a datatype + * of CHAR or VARCHAR + * and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT + * and contains a 1, a value of true is returned. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is false + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + boolean getBoolean(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a byte in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + byte getByte(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a short in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + short getShort(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * an int in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + int getInt(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a long in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + long getLong(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a float in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + float getFloat(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a double in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is 0 + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + double getDouble(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a java.math.BigDecimal in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param scale the number of digits to the right of the decimal point + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @deprecated Deprecated + */ + @Deprecated // Android-added - also changed deprecated tag to contain text. + BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a byte array in the Java programming language. + * The bytes represent the raw values returned by the driver. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + byte[] getBytes(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a java.sql.Date object in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.sql.Date getDate(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a java.sql.Time object in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; + * if the value is SQL NULL, + * the value returned is null + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.sql.Time getTime(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a java.sql.Timestamp object in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.sql.Timestamp getTimestamp(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a stream of + * ASCII characters. The value can then be read in chunks from the + * stream. This method is particularly + * suitable for retrieving large LONGVARCHAR values. + * The JDBC driver will + * do any necessary conversion from the database format into ASCII. + * + *

Note: All the data in the returned stream must be + * read prior to getting the value of any other column. The next + * call to a getter method implicitly closes the stream. Also, a + * stream may return 0 when the method available + * is called whether there is data available or not. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a Java input stream that delivers the database column value + * as a stream of one-byte ASCII characters. + * If the value is SQL NULL, + * the value returned is null. + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.io.InputStream getAsciiStream(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a stream of two-byte + * Unicode characters. The first byte is the high byte; the second + * byte is the low byte. + * + * The value can then be read in chunks from the + * stream. This method is particularly + * suitable for retrieving large LONGVARCHAR values. + * The JDBC technology-enabled driver will + * do any necessary conversion from the database format into Unicode. + * + *

Note: All the data in the returned stream must be + * read prior to getting the value of any other column. The next + * call to a getter method implicitly closes the stream. + * Also, a stream may return 0 when the method + * InputStream.available is called, whether there + * is data available or not. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a Java input stream that delivers the database column value + * as a stream of two-byte Unicode characters. + * If the value is SQL NULL, the value returned + * is null. + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @deprecated use getCharacterStream instead + */ + java.io.InputStream getUnicodeStream(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a stream of uninterpreted + * bytes. + * The value can then be read in chunks from the + * stream. This method is particularly + * suitable for retrieving large LONGVARBINARY + * values. + * + *

Note: All the data in the returned stream must be + * read prior to getting the value of any other column. The next + * call to a getter method implicitly closes the stream. Also, a + * stream may return 0 when the method available + * is called whether there is data available or not. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a Java input stream that delivers the database column value + * as a stream of uninterpreted bytes; + * if the value is SQL NULL, the result is null + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + java.io.InputStream getBinaryStream(String columnLabel) + throws SQLException; + + + // Advanced features: + + /** + * Retrieves the first warning reported by calls on this + * ResultSet object. + * Subsequent warnings on this ResultSet object + * will be chained to the SQLWarning object that + * this method returns. + * + *

The warning chain is automatically cleared each time a new + * row is read. This method may not be called on a ResultSet + * object that has been closed; doing so will cause an + * SQLException to be thrown. + *

+ * Note: This warning chain only covers warnings caused + * by ResultSet methods. Any warning caused by + * Statement methods + * (such as reading OUT parameters) will be chained on the + * Statement object. + * + * @return the first SQLWarning object reported or + * null if there are none + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + */ + SQLWarning getWarnings() throws SQLException; + + /** + * Clears all warnings reported on this ResultSet object. + * After this method is called, the method getWarnings + * returns null until a new warning is + * reported for this ResultSet object. + * + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + */ + void clearWarnings() throws SQLException; + + /** + * Retrieves the name of the SQL cursor used by this ResultSet + * object. + * + *

In SQL, a result table is retrieved through a cursor that is + * named. The current row of a result set can be updated or deleted + * using a positioned update/delete statement that references the + * cursor name. To insure that the cursor has the proper isolation + * level to support update, the cursor's SELECT statement + * should be of the form SELECT FOR UPDATE. If + * FOR UPDATE is omitted, the positioned updates may fail. + * + *

The JDBC API supports this SQL feature by providing the name of the + * SQL cursor used by a ResultSet object. + * The current row of a ResultSet object + * is also the current row of this SQL cursor. + * + * @return the SQL name for this ResultSet object's cursor + * @exception SQLException if a database access error occurs or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + */ + String getCursorName() throws SQLException; + + /** + * Retrieves the number, types and properties of + * this ResultSet object's columns. + * + * @return the description of this ResultSet object's columns + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + */ + ResultSetMetaData getMetaData() throws SQLException; + + /** + *

Gets the value of the designated column in the current row + * of this ResultSet object as + * an Object in the Java programming language. + * + *

This method will return the value of the given column as a + * Java object. The type of the Java object will be the default + * Java object type corresponding to the column's SQL type, + * following the mapping for built-in types specified in the JDBC + * specification. If the value is an SQL NULL, + * the driver returns a Java null. + * + *

This method may also be used to read database-specific + * abstract data types. + * + * In the JDBC 2.0 API, the behavior of method + * getObject is extended to materialize + * data of SQL user-defined types. + *

+ * If Connection.getTypeMap does not throw a + * SQLFeatureNotSupportedException, + * then when a column contains a structured or distinct value, + * the behavior of this method is as + * if it were a call to: getObject(columnIndex, + * this.getStatement().getConnection().getTypeMap()). + * + * If Connection.getTypeMap does throw a + * SQLFeatureNotSupportedException, + * then structured values are not supported, and distinct values + * are mapped to the default Java class as determined by the + * underlying SQL type of the DISTINCT type. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return a java.lang.Object holding the column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + Object getObject(int columnIndex) throws SQLException; + + /** + *

Gets the value of the designated column in the current row + * of this ResultSet object as + * an Object in the Java programming language. + * + *

This method will return the value of the given column as a + * Java object. The type of the Java object will be the default + * Java object type corresponding to the column's SQL type, + * following the mapping for built-in types specified in the JDBC + * specification. If the value is an SQL NULL, + * the driver returns a Java null. + *

+ * This method may also be used to read database-specific + * abstract data types. + *

+ * In the JDBC 2.0 API, the behavior of the method + * getObject is extended to materialize + * data of SQL user-defined types. When a column contains + * a structured or distinct value, the behavior of this method is as + * if it were a call to: getObject(columnIndex, + * this.getStatement().getConnection().getTypeMap()). + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a java.lang.Object holding the column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + */ + Object getObject(String columnLabel) throws SQLException; + + //---------------------------------------------------------------- + + /** + * Maps the given ResultSet column label to its + * ResultSet column index. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column index of the given column name + * @exception SQLException if the ResultSet object + * does not contain a column labeled columnLabel, a database access error occurs + * or this method is called on a closed result set + */ + int findColumn(String columnLabel) throws SQLException; + + + //--------------------------JDBC 2.0----------------------------------- + + //--------------------------------------------------------------------- + // Getters and Setters + //--------------------------------------------------------------------- + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a + * java.io.Reader object. + * @return a java.io.Reader object that contains the column + * value; if the value is SQL NULL, the value returned is + * null in the Java programming language. + * @param columnIndex the first column is 1, the second is 2, ... + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + * @since 1.2 + */ + java.io.Reader getCharacterStream(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a + * java.io.Reader object. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a java.io.Reader object that contains the column + * value; if the value is SQL NULL, the value returned is + * null in the Java programming language + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + * @since 1.2 + */ + java.io.Reader getCharacterStream(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a + * java.math.BigDecimal with full precision. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value (full precision); + * if the value is SQL NULL, the value returned is + * null in the Java programming language. + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs or this method is + * called on a closed result set + * @since 1.2 + */ + BigDecimal getBigDecimal(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a + * java.math.BigDecimal with full precision. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value (full precision); + * if the value is SQL NULL, the value returned is + * null in the Java programming language. + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs or this method is + * called on a closed result set + * @since 1.2 + * + */ + BigDecimal getBigDecimal(String columnLabel) throws SQLException; + + //--------------------------------------------------------------------- + // Traversal/Positioning + //--------------------------------------------------------------------- + + /** + * Retrieves whether the cursor is before the first row in + * this ResultSet object. + *

+ * Note:Support for the isBeforeFirst method + * is optional for ResultSets with a result + * set type of TYPE_FORWARD_ONLY + * + * @return true if the cursor is before the first row; + * false if the cursor is at any other position or the + * result set contains no rows + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean isBeforeFirst() throws SQLException; + + /** + * Retrieves whether the cursor is after the last row in + * this ResultSet object. + *

+ * Note:Support for the isAfterLast method + * is optional for ResultSets with a result + * set type of TYPE_FORWARD_ONLY + * + * @return true if the cursor is after the last row; + * false if the cursor is at any other position or the + * result set contains no rows + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean isAfterLast() throws SQLException; + + /** + * Retrieves whether the cursor is on the first row of + * this ResultSet object. + *

+ * Note:Support for the isFirst method + * is optional for ResultSets with a result + * set type of TYPE_FORWARD_ONLY + * + * @return true if the cursor is on the first row; + * false otherwise + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean isFirst() throws SQLException; + + /** + * Retrieves whether the cursor is on the last row of + * this ResultSet object. + * Note: Calling the method isLast may be expensive + * because the JDBC driver + * might need to fetch ahead one row in order to determine + * whether the current row is the last row in the result set. + *

+ * Note: Support for the isLast method + * is optional for ResultSets with a result + * set type of TYPE_FORWARD_ONLY + * @return true if the cursor is on the last row; + * false otherwise + * @exception SQLException if a database access error occurs or this method is + * called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean isLast() throws SQLException; + + /** + * Moves the cursor to the front of + * this ResultSet object, just before the + * first row. This method has no effect if the result set contains no rows. + * + * @exception SQLException if a database access error + * occurs; this method is called on a closed result set or the + * result set type is TYPE_FORWARD_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void beforeFirst() throws SQLException; + + /** + * Moves the cursor to the end of + * this ResultSet object, just after the + * last row. This method has no effect if the result set contains no rows. + * @exception SQLException if a database access error + * occurs; this method is called on a closed result set + * or the result set type is TYPE_FORWARD_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void afterLast() throws SQLException; + + /** + * Moves the cursor to the first row in + * this ResultSet object. + * + * @return true if the cursor is on a valid row; + * false if there are no rows in the result set + * @exception SQLException if a database access error + * occurs; this method is called on a closed result set + * or the result set type is TYPE_FORWARD_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean first() throws SQLException; + + /** + * Moves the cursor to the last row in + * this ResultSet object. + * + * @return true if the cursor is on a valid row; + * false if there are no rows in the result set + * @exception SQLException if a database access error + * occurs; this method is called on a closed result set + * or the result set type is TYPE_FORWARD_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean last() throws SQLException; + + /** + * Retrieves the current row number. The first row is number 1, the + * second number 2, and so on. + *

+ * Note:Support for the getRow method + * is optional for ResultSets with a result + * set type of TYPE_FORWARD_ONLY + * + * @return the current row number; 0 if there is no current row + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + int getRow() throws SQLException; + + /** + * Moves the cursor to the given row number in + * this ResultSet object. + * + *

If the row number is positive, the cursor moves to + * the given row number with respect to the + * beginning of the result set. The first row is row 1, the second + * is row 2, and so on. + * + *

If the given row number is negative, the cursor moves to + * an absolute row position with respect to + * the end of the result set. For example, calling the method + * absolute(-1) positions the + * cursor on the last row; calling the method absolute(-2) + * moves the cursor to the next-to-last row, and so on. + * + *

If the row number specified is zero, the cursor is moved to + * before the first row. + * + *

An attempt to position the cursor beyond the first/last row in + * the result set leaves the cursor before the first row or after + * the last row. + * + *

Note: Calling absolute(1) is the same + * as calling first(). Calling absolute(-1) + * is the same as calling last(). + * + * @param row the number of the row to which the cursor should move. + * A value of zero indicates that the cursor will be positioned + * before the first row; a positive number indicates the row number + * counting from the beginning of the result set; a negative number + * indicates the row number counting from the end of the result set + * @return true if the cursor is moved to a position in this + * ResultSet object; + * false if the cursor is before the first row or after the + * last row + * @exception SQLException if a database access error + * occurs; this method is called on a closed result set + * or the result set type is TYPE_FORWARD_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean absolute( int row ) throws SQLException; + + /** + * Moves the cursor a relative number of rows, either positive or negative. + * Attempting to move beyond the first/last row in the + * result set positions the cursor before/after the + * the first/last row. Calling relative(0) is valid, but does + * not change the cursor position. + * + *

Note: Calling the method relative(1) + * is identical to calling the method next() and + * calling the method relative(-1) is identical + * to calling the method previous(). + * + * @param rows an int specifying the number of rows to + * move from the current row; a positive number moves the cursor + * forward; a negative number moves the cursor backward + * @return true if the cursor is on a row; + * false otherwise + * @exception SQLException if a database access error occurs; this method + * is called on a closed result set or the result set type is + * TYPE_FORWARD_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean relative( int rows ) throws SQLException; + + /** + * Moves the cursor to the previous row in this + * ResultSet object. + *

+ * When a call to the previous method returns false, + * the cursor is positioned before the first row. Any invocation of a + * ResultSet method which requires a current row will result in a + * SQLException being thrown. + *

+ * If an input stream is open for the current row, a call to the method + * previous will implicitly close it. A ResultSet + * object's warning change is cleared when a new row is read. + *

+ * + * @return true if the cursor is now positioned on a valid row; + * false if the cursor is positioned before the first row + * @exception SQLException if a database access error + * occurs; this method is called on a closed result set + * or the result set type is TYPE_FORWARD_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean previous() throws SQLException; + + //--------------------------------------------------------------------- + // Properties + //--------------------------------------------------------------------- + + /** + * The constant indicating that the rows in a result set will be + * processed in a forward direction; first-to-last. + * This constant is used by the method setFetchDirection + * as a hint to the driver, which the driver may ignore. + * @since 1.2 + */ + int FETCH_FORWARD = 1000; + + /** + * The constant indicating that the rows in a result set will be + * processed in a reverse direction; last-to-first. + * This constant is used by the method setFetchDirection + * as a hint to the driver, which the driver may ignore. + * @since 1.2 + */ + int FETCH_REVERSE = 1001; + + /** + * The constant indicating that the order in which rows in a + * result set will be processed is unknown. + * This constant is used by the method setFetchDirection + * as a hint to the driver, which the driver may ignore. + */ + int FETCH_UNKNOWN = 1002; + + /** + * Gives a hint as to the direction in which the rows in this + * ResultSet object will be processed. + * The initial value is determined by the + * Statement object + * that produced this ResultSet object. + * The fetch direction may be changed at any time. + * + * @param direction an int specifying the suggested + * fetch direction; one of ResultSet.FETCH_FORWARD, + * ResultSet.FETCH_REVERSE, or + * ResultSet.FETCH_UNKNOWN + * @exception SQLException if a database access error occurs; this + * method is called on a closed result set or + * the result set type is TYPE_FORWARD_ONLY and the fetch + * direction is not FETCH_FORWARD + * @since 1.2 + * @see Statement#setFetchDirection + * @see #getFetchDirection + */ + void setFetchDirection(int direction) throws SQLException; + + /** + * Retrieves the fetch direction for this + * ResultSet object. + * + * @return the current fetch direction for this ResultSet object + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + * @see #setFetchDirection + */ + int getFetchDirection() throws SQLException; + + /** + * Gives the JDBC driver a hint as to the number of rows that should + * be fetched from the database when more rows are needed for this + * ResultSet object. + * If the fetch size specified is zero, the JDBC driver + * ignores the value and is free to make its own best guess as to what + * the fetch size should be. The default value is set by the + * Statement object + * that created the result set. The fetch size may be changed at any time. + * + * @param rows the number of rows to fetch + * @exception SQLException if a database access error occurs; this method + * is called on a closed result set or the + * condition rows >= 0 is not satisfied + * @since 1.2 + * @see #getFetchSize + */ + void setFetchSize(int rows) throws SQLException; + + /** + * Retrieves the fetch size for this + * ResultSet object. + * + * @return the current fetch size for this ResultSet object + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + * @see #setFetchSize + */ + int getFetchSize() throws SQLException; + + /** + * The constant indicating the type for a ResultSet object + * whose cursor may move only forward. + * @since 1.2 + */ + int TYPE_FORWARD_ONLY = 1003; + + /** + * The constant indicating the type for a ResultSet object + * that is scrollable but generally not sensitive to changes to the data + * that underlies the ResultSet. + * @since 1.2 + */ + int TYPE_SCROLL_INSENSITIVE = 1004; + + /** + * The constant indicating the type for a ResultSet object + * that is scrollable and generally sensitive to changes to the data + * that underlies the ResultSet. + * @since 1.2 + */ + int TYPE_SCROLL_SENSITIVE = 1005; + + /** + * Retrieves the type of this ResultSet object. + * The type is determined by the Statement object + * that created the result set. + * + * @return ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, + * or ResultSet.TYPE_SCROLL_SENSITIVE + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + int getType() throws SQLException; + + /** + * The constant indicating the concurrency mode for a + * ResultSet object that may NOT be updated. + * @since 1.2 + */ + int CONCUR_READ_ONLY = 1007; + + /** + * The constant indicating the concurrency mode for a + * ResultSet object that may be updated. + * @since 1.2 + */ + int CONCUR_UPDATABLE = 1008; + + /** + * Retrieves the concurrency mode of this ResultSet object. + * The concurrency used is determined by the + * Statement object that created the result set. + * + * @return the concurrency type, either + * ResultSet.CONCUR_READ_ONLY + * or ResultSet.CONCUR_UPDATABLE + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + int getConcurrency() throws SQLException; + + //--------------------------------------------------------------------- + // Updates + //--------------------------------------------------------------------- + + /** + * Retrieves whether the current row has been updated. The value returned + * depends on whether or not the result set can detect updates. + *

+ * Note: Support for the rowUpdated method is optional with a result set + * concurrency of CONCUR_READ_ONLY + * @return true if the current row is detected to + * have been visibly updated by the owner or another; false otherwise + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see DatabaseMetaData#updatesAreDetected + * @since 1.2 + */ + boolean rowUpdated() throws SQLException; + + /** + * Retrieves whether the current row has had an insertion. + * The value returned depends on whether or not this + * ResultSet object can detect visible inserts. + *

+ * Note: Support for the rowInserted method is optional with a result set + * concurrency of CONCUR_READ_ONLY + * @return true if the current row is detected to + * have been inserted; false otherwise + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * + * @see DatabaseMetaData#insertsAreDetected + * @since 1.2 + */ + boolean rowInserted() throws SQLException; + + /** + * Retrieves whether a row has been deleted. A deleted row may leave + * a visible "hole" in a result set. This method can be used to + * detect holes in a result set. The value returned depends on whether + * or not this ResultSet object can detect deletions. + *

+ * Note: Support for the rowDeleted method is optional with a result set + * concurrency of CONCUR_READ_ONLY + * @return true if the current row is detected to + * have been deleted by the owner or another; false otherwise + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * + * @see DatabaseMetaData#deletesAreDetected + * @since 1.2 + */ + boolean rowDeleted() throws SQLException; + + /** + * Updates the designated column with a null value. + * + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow + * or insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateNull(int columnIndex) throws SQLException; + + /** + * Updates the designated column with a boolean value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateBoolean(int columnIndex, boolean x) throws SQLException; + + /** + * Updates the designated column with a byte value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateByte(int columnIndex, byte x) throws SQLException; + + /** + * Updates the designated column with a short value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateShort(int columnIndex, short x) throws SQLException; + + /** + * Updates the designated column with an int value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateInt(int columnIndex, int x) throws SQLException; + + /** + * Updates the designated column with a long value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateLong(int columnIndex, long x) throws SQLException; + + /** + * Updates the designated column with a float value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateFloat(int columnIndex, float x) throws SQLException; + + /** + * Updates the designated column with a double value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateDouble(int columnIndex, double x) throws SQLException; + + /** + * Updates the designated column with a java.math.BigDecimal + * value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException; + + /** + * Updates the designated column with a String value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateString(int columnIndex, String x) throws SQLException; + + /** + * Updates the designated column with a byte array value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateBytes(int columnIndex, byte x[]) throws SQLException; + + /** + * Updates the designated column with a java.sql.Date value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateDate(int columnIndex, java.sql.Date x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Time value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateTime(int columnIndex, java.sql.Time x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Timestamp + * value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateTimestamp(int columnIndex, java.sql.Timestamp x) + throws SQLException; + + /** + * Updates the designated column with an ascii stream value, which will have + * the specified number of bytes. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateAsciiStream(int columnIndex, + java.io.InputStream x, + int length) throws SQLException; + + /** + * Updates the designated column with a binary stream value, which will have + * the specified number of bytes. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateBinaryStream(int columnIndex, + java.io.InputStream x, + int length) throws SQLException; + + /** + * Updates the designated column with a character stream value, which will have + * the specified number of bytes. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateCharacterStream(int columnIndex, + java.io.Reader x, + int length) throws SQLException; + + /** + * Updates the designated column with an Object value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + *

+ * If the second argument is an InputStream then the stream must contain + * the number of bytes specified by scaleOrLength. If the second argument is a + * Reader then the reader must contain the number of characters specified + * by scaleOrLength. If these conditions are not true the driver will generate a + * SQLException when the statement is executed. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @param scaleOrLength for an object of java.math.BigDecimal , + * this is the number of digits after the decimal point. For + * Java Object types InputStream and Reader, + * this is the length + * of the data in the stream or reader. For all other types, + * this value will be ignored. + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateObject(int columnIndex, Object x, int scaleOrLength) + throws SQLException; + + /** + * Updates the designated column with an Object value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateObject(int columnIndex, Object x) throws SQLException; + + /** + * Updates the designated column with a null value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateNull(String columnLabel) throws SQLException; + + /** + * Updates the designated column with a boolean value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateBoolean(String columnLabel, boolean x) throws SQLException; + + /** + * Updates the designated column with a byte value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateByte(String columnLabel, byte x) throws SQLException; + + /** + * Updates the designated column with a short value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateShort(String columnLabel, short x) throws SQLException; + + /** + * Updates the designated column with an int value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateInt(String columnLabel, int x) throws SQLException; + + /** + * Updates the designated column with a long value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateLong(String columnLabel, long x) throws SQLException; + + /** + * Updates the designated column with a float value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateFloat(String columnLabel, float x) throws SQLException; + + /** + * Updates the designated column with a double value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateDouble(String columnLabel, double x) throws SQLException; + + /** + * Updates the designated column with a java.sql.BigDecimal + * value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException; + + /** + * Updates the designated column with a String value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateString(String columnLabel, String x) throws SQLException; + + /** + * Updates the designated column with a byte array value. + * + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow + * or insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateBytes(String columnLabel, byte x[]) throws SQLException; + + /** + * Updates the designated column with a java.sql.Date value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateDate(String columnLabel, java.sql.Date x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Time value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateTime(String columnLabel, java.sql.Time x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Timestamp + * value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateTimestamp(String columnLabel, java.sql.Timestamp x) + throws SQLException; + + /** + * Updates the designated column with an ascii stream value, which will have + * the specified number of bytes. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateAsciiStream(String columnLabel, + java.io.InputStream x, + int length) throws SQLException; + + /** + * Updates the designated column with a binary stream value, which will have + * the specified number of bytes. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateBinaryStream(String columnLabel, + java.io.InputStream x, + int length) throws SQLException; + + /** + * Updates the designated column with a character stream value, which will have + * the specified number of bytes. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader the java.io.Reader object containing + * the new column value + * @param length the length of the stream + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateCharacterStream(String columnLabel, + java.io.Reader reader, + int length) throws SQLException; + + /** + * Updates the designated column with an Object value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + *

+ * If the second argument is an InputStream then the stream must contain + * the number of bytes specified by scaleOrLength. If the second argument is a + * Reader then the reader must contain the number of characters specified + * by scaleOrLength. If these conditions are not true the driver will generate a + * SQLException when the statement is executed. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @param scaleOrLength for an object of java.math.BigDecimal , + * this is the number of digits after the decimal point. For + * Java Object types InputStream and Reader, + * this is the length + * of the data in the stream or reader. For all other types, + * this value will be ignored. + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateObject(String columnLabel, Object x, int scaleOrLength) + throws SQLException; + + /** + * Updates the designated column with an Object value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateObject(String columnLabel, Object x) throws SQLException; + + /** + * Inserts the contents of the insert row into this + * ResultSet object and into the database. + * The cursor must be on the insert row when this method is called. + * + * @exception SQLException if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY, + * this method is called on a closed result set, + * if this method is called when the cursor is not on the insert row, + * or if not all of non-nullable columns in + * the insert row have been given a non-null value + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void insertRow() throws SQLException; + + /** + * Updates the underlying database with the new contents of the + * current row of this ResultSet object. + * This method cannot be called when the cursor is on the insert row. + * + * @exception SQLException if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY; + * this method is called on a closed result set or + * if this method is called when the cursor is on the insert row + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void updateRow() throws SQLException; + + /** + * Deletes the current row from this ResultSet object + * and from the underlying database. This method cannot be called when + * the cursor is on the insert row. + * + * @exception SQLException if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY; + * this method is called on a closed result set + * or if this method is called when the cursor is on the insert row + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void deleteRow() throws SQLException; + + /** + * Refreshes the current row with its most recent value in + * the database. This method cannot be called when + * the cursor is on the insert row. + * + *

The refreshRow method provides a way for an + * application to + * explicitly tell the JDBC driver to refetch a row(s) from the + * database. An application may want to call refreshRow when + * caching or prefetching is being done by the JDBC driver to + * fetch the latest value of a row from the database. The JDBC driver + * may actually refresh multiple rows at once if the fetch size is + * greater than one. + * + *

All values are refetched subject to the transaction isolation + * level and cursor sensitivity. If refreshRow is called after + * calling an updater method, but before calling + * the method updateRow, then the + * updates made to the row are lost. Calling the method + * refreshRow frequently will likely slow performance. + * + * @exception SQLException if a database access error + * occurs; this method is called on a closed result set; + * the result set type is TYPE_FORWARD_ONLY or if this + * method is called when the cursor is on the insert row + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method or this method is not supported for the specified result + * set type and result set concurrency. + * @since 1.2 + */ + void refreshRow() throws SQLException; + + /** + * Cancels the updates made to the current row in this + * ResultSet object. + * This method may be called after calling an + * updater method(s) and before calling + * the method updateRow to roll back + * the updates made to a row. If no updates have been made or + * updateRow has already been called, this method has no + * effect. + * + * @exception SQLException if a database access error + * occurs; this method is called on a closed result set; + * the result set concurrency is CONCUR_READ_ONLY + * or if this method is called when the cursor is + * on the insert row + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void cancelRowUpdates() throws SQLException; + + /** + * Moves the cursor to the insert row. The current cursor position is + * remembered while the cursor is positioned on the insert row. + * + * The insert row is a special row associated with an updatable + * result set. It is essentially a buffer where a new row may + * be constructed by calling the updater methods prior to + * inserting the row into the result set. + * + * Only the updater, getter, + * and insertRow methods may be + * called when the cursor is on the insert row. All of the columns in + * a result set must be given a value each time this method is + * called before calling insertRow. + * An updater method must be called before a + * getter method can be called on a column value. + * + * @exception SQLException if a database access error occurs; this + * method is called on a closed result set + * or the result set concurrency is CONCUR_READ_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void moveToInsertRow() throws SQLException; + + /** + * Moves the cursor to the remembered cursor position, usually the + * current row. This method has no effect if the cursor is not on + * the insert row. + * + * @exception SQLException if a database access error occurs; this + * method is called on a closed result set + * or the result set concurrency is CONCUR_READ_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void moveToCurrentRow() throws SQLException; + + /** + * Retrieves the Statement object that produced this + * ResultSet object. + * If the result set was generated some other way, such as by a + * DatabaseMetaData method, this method may return + * null. + * + * @return the Statment object that produced + * this ResultSet object or null + * if the result set was produced some other way + * @exception SQLException if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + Statement getStatement() throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as an Object + * in the Java programming language. + * If the value is an SQL NULL, + * the driver returns a Java null. + * This method uses the given Map object + * for the custom mapping of the + * SQL structured or distinct type that is being retrieved. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param map a java.util.Map object that contains the mapping + * from SQL type names to classes in the Java programming language + * @return an Object in the Java programming language + * representing the SQL value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object getObject(int columnIndex, java.util.Map> map) + throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a Ref object + * in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return a Ref object representing an SQL REF + * value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Ref getRef(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a Blob object + * in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return a Blob object representing the SQL + * BLOB value in the specified column + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Blob getBlob(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a Clob object + * in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return a Clob object representing the SQL + * CLOB value in the specified column + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Clob getClob(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as an Array object + * in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return an Array object representing the SQL + * ARRAY value in the specified column + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Array getArray(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as an Object + * in the Java programming language. + * If the value is an SQL NULL, + * the driver returns a Java null. + * This method uses the specified Map object for + * custom mapping if appropriate. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param map a java.util.Map object that contains the mapping + * from SQL type names to classes in the Java programming language + * @return an Object representing the SQL value in the + * specified column + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object getObject(String columnLabel, java.util.Map> map) + throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a Ref object + * in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a Ref object representing the SQL REF + * value in the specified column + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Ref getRef(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a Blob object + * in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a Blob object representing the SQL BLOB + * value in the specified column + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Blob getBlob(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a Clob object + * in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a Clob object representing the SQL CLOB + * value in the specified column + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Clob getClob(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as an Array object + * in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return an Array object representing the SQL ARRAY value in + * the specified column + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Array getArray(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a java.sql.Date object + * in the Java programming language. + * This method uses the given calendar to construct an appropriate millisecond + * value for the date if the underlying database does not store + * timezone information. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param cal the java.util.Calendar object + * to use in constructing the date + * @return the column value as a java.sql.Date object; + * if the value is SQL NULL, + * the value returned is null in the Java programming language + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a java.sql.Date object + * in the Java programming language. + * This method uses the given calendar to construct an appropriate millisecond + * value for the date if the underlying database does not store + * timezone information. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param cal the java.util.Calendar object + * to use in constructing the date + * @return the column value as a java.sql.Date object; + * if the value is SQL NULL, + * the value returned is null in the Java programming language + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + java.sql.Date getDate(String columnLabel, Calendar cal) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a java.sql.Time object + * in the Java programming language. + * This method uses the given calendar to construct an appropriate millisecond + * value for the time if the underlying database does not store + * timezone information. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param cal the java.util.Calendar object + * to use in constructing the time + * @return the column value as a java.sql.Time object; + * if the value is SQL NULL, + * the value returned is null in the Java programming language + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a java.sql.Time object + * in the Java programming language. + * This method uses the given calendar to construct an appropriate millisecond + * value for the time if the underlying database does not store + * timezone information. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param cal the java.util.Calendar object + * to use in constructing the time + * @return the column value as a java.sql.Time object; + * if the value is SQL NULL, + * the value returned is null in the Java programming language + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + java.sql.Time getTime(String columnLabel, Calendar cal) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a java.sql.Timestamp object + * in the Java programming language. + * This method uses the given calendar to construct an appropriate millisecond + * value for the timestamp if the underlying database does not store + * timezone information. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param cal the java.util.Calendar object + * to use in constructing the timestamp + * @return the column value as a java.sql.Timestamp object; + * if the value is SQL NULL, + * the value returned is null in the Java programming language + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) + throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a java.sql.Timestamp object + * in the Java programming language. + * This method uses the given calendar to construct an appropriate millisecond + * value for the timestamp if the underlying database does not store + * timezone information. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param cal the java.util.Calendar object + * to use in constructing the date + * @return the column value as a java.sql.Timestamp object; + * if the value is SQL NULL, + * the value returned is null in the Java programming language + * @exception SQLException if the columnLabel is not valid or + * if a database access error occurs + * or this method is called on a closed result set + * @since 1.2 + */ + java.sql.Timestamp getTimestamp(String columnLabel, Calendar cal) + throws SQLException; + + //-------------------------- JDBC 3.0 ---------------------------------------- + + /** + * The constant indicating that open ResultSet objects with this + * holdability will remain open when the current transaction is commited. + * + * @since 1.4 + */ + int HOLD_CURSORS_OVER_COMMIT = 1; + + /** + * The constant indicating that open ResultSet objects with this + * holdability will be closed when the current transaction is commited. + * + * @since 1.4 + */ + int CLOSE_CURSORS_AT_COMMIT = 2; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a java.net.URL + * object in the Java programming language. + * + * @param columnIndex the index of the column 1 is the first, 2 is the second,... + * @return the column value as a java.net.URL object; + * if the value is SQL NULL, + * the value returned is null in the Java programming language + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; this method + * is called on a closed result set or if a URL is malformed + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + java.net.URL getURL(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a java.net.URL + * object in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value as a java.net.URL object; + * if the value is SQL NULL, + * the value returned is null in the Java programming language + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; this method + * is called on a closed result set or if a URL is malformed + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + java.net.URL getURL(String columnLabel) throws SQLException; + + /** + * Updates the designated column with a java.sql.Ref value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void updateRef(int columnIndex, java.sql.Ref x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Ref value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void updateRef(String columnLabel, java.sql.Ref x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Blob value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Blob value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void updateBlob(String columnLabel, java.sql.Blob x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Clob value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void updateClob(int columnIndex, java.sql.Clob x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Clob value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void updateClob(String columnLabel, java.sql.Clob x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Array value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void updateArray(int columnIndex, java.sql.Array x) throws SQLException; + + /** + * Updates the designated column with a java.sql.Array value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void updateArray(String columnLabel, java.sql.Array x) throws SQLException; + + //------------------------- JDBC 4.0 ----------------------------------- + + /** + * Retrieves the value of the designated column in the current row of this + * ResultSet object as a java.sql.RowId object in the Java + * programming language. + * + * @param columnIndex the first column is 1, the second 2, ... + * @return the column value; if the value is a SQL NULL the + * value returned is null + * @throws SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + RowId getRowId(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row of this + * ResultSet object as a java.sql.RowId object in the Java + * programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value ; if the value is a SQL NULL the + * value returned is null + * @throws SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + RowId getRowId(String columnLabel) throws SQLException; + + /** + * Updates the designated column with a RowId value. The updater + * methods are used to update column values in the current row or the insert + * row. The updater methods do not update the underlying database; instead + * the updateRow or insertRow methods are called + * to update the database. + * + * @param columnIndex the first column is 1, the second 2, ... + * @param x the column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateRowId(int columnIndex, RowId x) throws SQLException; + + /** + * Updates the designated column with a RowId value. The updater + * methods are used to update column values in the current row or the insert + * row. The updater methods do not update the underlying database; instead + * the updateRow or insertRow methods are called + * to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateRowId(String columnLabel, RowId x) throws SQLException; + + /** + * Retrieves the holdability of this ResultSet object + * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT + * @throws SQLException if a database access error occurs + * or this method is called on a closed result set + * @since 1.6 + */ + int getHoldability() throws SQLException; + + /** + * Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the + * method close has been called on it, or if it is automatically closed. + * + * @return true if this ResultSet object is closed; false if it is still open + * @throws SQLException if a database access error occurs + * @since 1.6 + */ + boolean isClosed() throws SQLException; + + /** + * Updates the designated column with a String value. + * It is intended for use when updating NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second 2, ... + * @param nString the value for the column to be updated + * @throws SQLException if the columnIndex is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set; + * the result set concurrency is CONCUR_READ_ONLY + * or if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNString(int columnIndex, String nString) throws SQLException; + + /** + * Updates the designated column with a String value. + * It is intended for use when updating NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param nString the value for the column to be updated + * @throws SQLException if the columnLabel is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set; + * the result set concurrency is CONCUR_READ_ONLY + * or if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNString(String columnLabel, String nString) throws SQLException; + + /** + * Updates the designated column with a java.sql.NClob value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second 2, ... + * @param nClob the value for the column to be updated + * @throws SQLException if the columnIndex is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set; + * if a database access error occurs or + * the result set concurrency is CONCUR_READ_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNClob(int columnIndex, NClob nClob) throws SQLException; + + /** + * Updates the designated column with a java.sql.NClob value. + * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param nClob the value for the column to be updated + * @throws SQLException if the columnLabel is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set; + * if a database access error occurs or + * the result set concurrency is CONCUR_READ_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNClob(String columnLabel, NClob nClob) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a NClob object + * in the Java programming language. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return a NClob object representing the SQL + * NCLOB value in the specified column + * @exception SQLException if the columnIndex is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set + * or if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + NClob getNClob(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a NClob object + * in the Java programming language. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a NClob object representing the SQL NCLOB + * value in the specified column + * @exception SQLException if the columnLabel is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set + * or if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + NClob getNClob(String columnLabel) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row of + * this ResultSet as a + * java.sql.SQLXML object in the Java programming language. + * @param columnIndex the first column is 1, the second is 2, ... + * @return a SQLXML object that maps an SQL XML value + * @throws SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + SQLXML getSQLXML(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row of + * this ResultSet as a + * java.sql.SQLXML object in the Java programming language. + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a SQLXML object that maps an SQL XML value + * @throws SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + SQLXML getSQLXML(String columnLabel) throws SQLException; + /** + * Updates the designated column with a java.sql.SQLXML value. + * The updater + * methods are used to update column values in the current row or the insert + * row. The updater methods do not update the underlying database; instead + * the updateRow or insertRow methods are called + * to update the database. + *

+ * + * @param columnIndex the first column is 1, the second 2, ... + * @param xmlObject the value for the column to be updated + * @throws SQLException if the columnIndex is not valid; + * if a database access error occurs; this method + * is called on a closed result set; + * the java.xml.transform.Result, + * Writer or OutputStream has not been closed + * for the SQLXML object; + * if there is an error processing the XML value or + * the result set concurrency is CONCUR_READ_ONLY. The getCause method + * of the exception may provide a more detailed exception, for example, if the + * stream does not contain valid XML. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException; + /** + * Updates the designated column with a java.sql.SQLXML value. + * The updater + * methods are used to update column values in the current row or the insert + * row. The updater methods do not update the underlying database; instead + * the updateRow or insertRow methods are called + * to update the database. + *

+ * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param xmlObject the column value + * @throws SQLException if the columnLabel is not valid; + * if a database access error occurs; this method + * is called on a closed result set; + * the java.xml.transform.Result, + * Writer or OutputStream has not been closed + * for the SQLXML object; + * if there is an error processing the XML value or + * the result set concurrency is CONCUR_READ_ONLY. The getCause method + * of the exception may provide a more detailed exception, for example, if the + * stream does not contain valid XML. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a String in the Java programming language. + * It is intended for use when + * accessing NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + String getNString(int columnIndex) throws SQLException; + + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as + * a String in the Java programming language. + * It is intended for use when + * accessing NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return the column value; if the value is SQL NULL, the + * value returned is null + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + String getNString(String columnLabel) throws SQLException; + + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a + * java.io.Reader object. + * It is intended for use when + * accessing NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + * + * @return a java.io.Reader object that contains the column + * value; if the value is SQL NULL, the value returned is + * null in the Java programming language. + * @param columnIndex the first column is 1, the second is 2, ... + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + java.io.Reader getNCharacterStream(int columnIndex) throws SQLException; + + /** + * Retrieves the value of the designated column in the current row + * of this ResultSet object as a + * java.io.Reader object. + * It is intended for use when + * accessing NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @return a java.io.Reader object that contains the column + * value; if the value is SQL NULL, the value returned is + * null in the Java programming language + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + java.io.Reader getNCharacterStream(String columnLabel) throws SQLException; + + /** + * Updates the designated column with a character stream value, which will have + * the specified number of bytes. The + * driver does the necessary conversion from Java character format to + * the national character set in the database. + * It is intended for use when + * updating NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNCharacterStream(int columnIndex, + java.io.Reader x, + long length) throws SQLException; + + /** + * Updates the designated column with a character stream value, which will have + * the specified number of bytes. The + * driver does the necessary conversion from Java character format to + * the national character set in the database. + * It is intended for use when + * updating NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader the java.io.Reader object containing + * the new column value + * @param length the length of the stream + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNCharacterStream(String columnLabel, + java.io.Reader reader, + long length) throws SQLException; + /** + * Updates the designated column with an ascii stream value, which will have + * the specified number of bytes. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateAsciiStream(int columnIndex, + java.io.InputStream x, + long length) throws SQLException; + + /** + * Updates the designated column with a binary stream value, which will have + * the specified number of bytes. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateBinaryStream(int columnIndex, + java.io.InputStream x, + long length) throws SQLException; + + /** + * Updates the designated column with a character stream value, which will have + * the specified number of bytes. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateCharacterStream(int columnIndex, + java.io.Reader x, + long length) throws SQLException; + /** + * Updates the designated column with an ascii stream value, which will have + * the specified number of bytes. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateAsciiStream(String columnLabel, + java.io.InputStream x, + long length) throws SQLException; + + /** + * Updates the designated column with a binary stream value, which will have + * the specified number of bytes. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @param length the length of the stream + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateBinaryStream(String columnLabel, + java.io.InputStream x, + long length) throws SQLException; + + /** + * Updates the designated column with a character stream value, which will have + * the specified number of bytes. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader the java.io.Reader object containing + * the new column value + * @param length the length of the stream + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateCharacterStream(String columnLabel, + java.io.Reader reader, + long length) throws SQLException; + /** + * Updates the designated column using the given input stream, which + * will have the specified number of bytes. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param inputStream An object that contains the data to set the parameter + * value to. + * @param length the number of bytes in the parameter data. + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException; + + /** + * Updates the designated column using the given input stream, which + * will have the specified number of bytes. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param inputStream An object that contains the data to set the parameter + * value to. + * @param length the number of bytes in the parameter data. + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException; + + /** + * Updates the designated column using the given Reader + * object, which is the given number of characters long. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param reader An object that contains the data to set the parameter value to. + * @param length the number of characters in the parameter data. + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateClob(int columnIndex, Reader reader, long length) throws SQLException; + + /** + * Updates the designated column using the given Reader + * object, which is the given number of characters long. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader An object that contains the data to set the parameter value to. + * @param length the number of characters in the parameter data. + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateClob(String columnLabel, Reader reader, long length) throws SQLException; + /** + * Updates the designated column using the given Reader + * object, which is the given number of characters long. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnIndex the first column is 1, the second 2, ... + * @param reader An object that contains the data to set the parameter value to. + * @param length the number of characters in the parameter data. + * @throws SQLException if the columnIndex is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set, + * if a database access error occurs or + * the result set concurrency is CONCUR_READ_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNClob(int columnIndex, Reader reader, long length) throws SQLException; + + /** + * Updates the designated column using the given Reader + * object, which is the given number of characters long. + * When a very large UNICODE value is input to a LONGVARCHAR + * parameter, it may be more practical to send it via a + * java.io.Reader object. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader An object that contains the data to set the parameter value to. + * @param length the number of characters in the parameter data. + * @throws SQLException if the columnLabel is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set; + * if a database access error occurs or + * the result set concurrency is CONCUR_READ_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNClob(String columnLabel, Reader reader, long length) throws SQLException; + + //--- + + /** + * Updates the designated column with a character stream value. + * The data will be read from the stream + * as needed until end-of-stream is reached. The + * driver does the necessary conversion from Java character format to + * the national character set in the database. + * It is intended for use when + * updating NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateNCharacterStream which takes a length parameter. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNCharacterStream(int columnIndex, + java.io.Reader x) throws SQLException; + + /** + * Updates the designated column with a character stream value. + * The data will be read from the stream + * as needed until end-of-stream is reached. The + * driver does the necessary conversion from Java character format to + * the national character set in the database. + * It is intended for use when + * updating NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateNCharacterStream which takes a length parameter. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader the java.io.Reader object containing + * the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNCharacterStream(String columnLabel, + java.io.Reader reader) throws SQLException; + /** + * Updates the designated column with an ascii stream value. + * The data will be read from the stream + * as needed until end-of-stream is reached. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateAsciiStream which takes a length parameter. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateAsciiStream(int columnIndex, + java.io.InputStream x) throws SQLException; + + /** + * Updates the designated column with a binary stream value. + * The data will be read from the stream + * as needed until end-of-stream is reached. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateBinaryStream which takes a length parameter. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateBinaryStream(int columnIndex, + java.io.InputStream x) throws SQLException; + + /** + * Updates the designated column with a character stream value. + * The data will be read from the stream + * as needed until end-of-stream is reached. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateCharacterStream which takes a length parameter. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param x the new column value + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateCharacterStream(int columnIndex, + java.io.Reader x) throws SQLException; + /** + * Updates the designated column with an ascii stream value. + * The data will be read from the stream + * as needed until end-of-stream is reached. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateAsciiStream which takes a length parameter. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateAsciiStream(String columnLabel, + java.io.InputStream x) throws SQLException; + + /** + * Updates the designated column with a binary stream value. + * The data will be read from the stream + * as needed until end-of-stream is reached. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateBinaryStream which takes a length parameter. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param x the new column value + * @exception SQLException if the columnLabel is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateBinaryStream(String columnLabel, + java.io.InputStream x) throws SQLException; + + /** + * Updates the designated column with a character stream value. + * The data will be read from the stream + * as needed until end-of-stream is reached. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateCharacterStream which takes a length parameter. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader the java.io.Reader object containing + * the new column value + * @exception SQLException if the columnLabel is not valid; if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateCharacterStream(String columnLabel, + java.io.Reader reader) throws SQLException; + /** + * Updates the designated column using the given input stream. The data will be read from the stream + * as needed until end-of-stream is reached. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateBlob which takes a length parameter. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param inputStream An object that contains the data to set the parameter + * value to. + * @exception SQLException if the columnIndex is not valid; if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateBlob(int columnIndex, InputStream inputStream) throws SQLException; + + /** + * Updates the designated column using the given input stream. The data will be read from the stream + * as needed until end-of-stream is reached. + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateBlob which takes a length parameter. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param inputStream An object that contains the data to set the parameter + * value to. + * @exception SQLException if the columnLabel is not valid; if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateBlob(String columnLabel, InputStream inputStream) throws SQLException; + + /** + * Updates the designated column using the given Reader + * object. + * The data will be read from the stream + * as needed until end-of-stream is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateClob which takes a length parameter. + * + * @param columnIndex the first column is 1, the second is 2, ... + * @param reader An object that contains the data to set the parameter value to. + * @exception SQLException if the columnIndex is not valid; + * if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateClob(int columnIndex, Reader reader) throws SQLException; + + /** + * Updates the designated column using the given Reader + * object. + * The data will be read from the stream + * as needed until end-of-stream is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateClob which takes a length parameter. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader An object that contains the data to set the parameter value to. + * @exception SQLException if the columnLabel is not valid; if a database access error occurs; + * the result set concurrency is CONCUR_READ_ONLY + * or this method is called on a closed result set + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateClob(String columnLabel, Reader reader) throws SQLException; + /** + * Updates the designated column using the given Reader + * + * The data will be read from the stream + * as needed until end-of-stream is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateNClob which takes a length parameter. + * + * @param columnIndex the first column is 1, the second 2, ... + * @param reader An object that contains the data to set the parameter value to. + * @throws SQLException if the columnIndex is not valid; + * if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set, + * if a database access error occurs or + * the result set concurrency is CONCUR_READ_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNClob(int columnIndex, Reader reader) throws SQLException; + + /** + * Updates the designated column using the given Reader + * object. + * The data will be read from the stream + * as needed until end-of-stream is reached. The JDBC driver will + * do any necessary conversion from UNICODE to the database char format. + * + *

+ * The updater methods are used to update column values in the + * current row or the insert row. The updater methods do not + * update the underlying database; instead the updateRow or + * insertRow methods are called to update the database. + * + *

Note: Consult your JDBC driver documentation to determine if + * it might be more efficient to use a version of + * updateNClob which takes a length parameter. + * + * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column + * @param reader An object that contains the data to set the parameter value to. + * @throws SQLException if the columnLabel is not valid; if the driver does not support national + * character sets; if the driver can detect that a data conversion + * error could occur; this method is called on a closed result set; + * if a database access error occurs or + * the result set concurrency is CONCUR_READ_ONLY + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void updateNClob(String columnLabel, Reader reader) throws SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ResultSetMetaData.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ResultSetMetaData.java new file mode 100644 index 0000000000..c1dd474b56 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/ResultSetMetaData.java @@ -0,0 +1,277 @@ +/* + * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * An object that can be used to get information about the types + * and properties of the columns in a ResultSet object. + * The following code fragment creates the ResultSet object rs, + * creates the ResultSetMetaData object rsmd, and uses rsmd + * to find out how many columns rs has and whether the first column in rs + * can be used in a WHERE clause. + *

+ *
+ *     ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
+ *     ResultSetMetaData rsmd = rs.getMetaData();
+ *     int numberOfColumns = rsmd.getColumnCount();
+ *     boolean b = rsmd.isSearchable(1);
+ *
+ * 
+ */ + +public interface ResultSetMetaData extends Wrapper { + + /** + * Returns the number of columns in this ResultSet object. + * + * @return the number of columns + * @exception SQLException if a database access error occurs + */ + int getColumnCount() throws SQLException; + + /** + * Indicates whether the designated column is automatically numbered. + * + * @param column the first column is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isAutoIncrement(int column) throws SQLException; + + /** + * Indicates whether a column's case matters. + * + * @param column the first column is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isCaseSensitive(int column) throws SQLException; + + /** + * Indicates whether the designated column can be used in a where clause. + * + * @param column the first column is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isSearchable(int column) throws SQLException; + + /** + * Indicates whether the designated column is a cash value. + * + * @param column the first column is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isCurrency(int column) throws SQLException; + + /** + * Indicates the nullability of values in the designated column. + * + * @param column the first column is 1, the second is 2, ... + * @return the nullability status of the given column; one of columnNoNulls, + * columnNullable or columnNullableUnknown + * @exception SQLException if a database access error occurs + */ + int isNullable(int column) throws SQLException; + + /** + * The constant indicating that a + * column does not allow NULL values. + */ + int columnNoNulls = 0; + + /** + * The constant indicating that a + * column allows NULL values. + */ + int columnNullable = 1; + + /** + * The constant indicating that the + * nullability of a column's values is unknown. + */ + int columnNullableUnknown = 2; + + /** + * Indicates whether values in the designated column are signed numbers. + * + * @param column the first column is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isSigned(int column) throws SQLException; + + /** + * Indicates the designated column's normal maximum width in characters. + * + * @param column the first column is 1, the second is 2, ... + * @return the normal maximum number of characters allowed as the width + * of the designated column + * @exception SQLException if a database access error occurs + */ + int getColumnDisplaySize(int column) throws SQLException; + + /** + * Gets the designated column's suggested title for use in printouts and + * displays. The suggested title is usually specified by the SQL AS + * clause. If a SQL AS is not specified, the value returned from + * getColumnLabel will be the same as the value returned by the + * getColumnName method. + * + * @param column the first column is 1, the second is 2, ... + * @return the suggested column title + * @exception SQLException if a database access error occurs + */ + String getColumnLabel(int column) throws SQLException; + + /** + * Get the designated column's name. + * + * @param column the first column is 1, the second is 2, ... + * @return column name + * @exception SQLException if a database access error occurs + */ + String getColumnName(int column) throws SQLException; + + /** + * Get the designated column's table's schema. + * + * @param column the first column is 1, the second is 2, ... + * @return schema name or "" if not applicable + * @exception SQLException if a database access error occurs + */ + String getSchemaName(int column) throws SQLException; + + /** + * Get the designated column's specified column size. + * For numeric data, this is the maximum precision. For character data, this is the length in characters. + * For datetime datatypes, this is the length in characters of the String representation (assuming the + * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, + * this is the length in bytes. 0 is returned for data types where the + * column size is not applicable. + * + * @param column the first column is 1, the second is 2, ... + * @return precision + * @exception SQLException if a database access error occurs + */ + int getPrecision(int column) throws SQLException; + + /** + * Gets the designated column's number of digits to right of the decimal point. + * 0 is returned for data types where the scale is not applicable. + * + * @param column the first column is 1, the second is 2, ... + * @return scale + * @exception SQLException if a database access error occurs + */ + int getScale(int column) throws SQLException; + + /** + * Gets the designated column's table name. + * + * @param column the first column is 1, the second is 2, ... + * @return table name or "" if not applicable + * @exception SQLException if a database access error occurs + */ + String getTableName(int column) throws SQLException; + + /** + * Gets the designated column's table's catalog name. + * + * @param column the first column is 1, the second is 2, ... + * @return the name of the catalog for the table in which the given column + * appears or "" if not applicable + * @exception SQLException if a database access error occurs + */ + String getCatalogName(int column) throws SQLException; + + /** + * Retrieves the designated column's SQL type. + * + * @param column the first column is 1, the second is 2, ... + * @return SQL type from java.sql.Types + * @exception SQLException if a database access error occurs + * @see Types + */ + int getColumnType(int column) throws SQLException; + + /** + * Retrieves the designated column's database-specific type name. + * + * @param column the first column is 1, the second is 2, ... + * @return type name used by the database. If the column type is + * a user-defined type, then a fully-qualified type name is returned. + * @exception SQLException if a database access error occurs + */ + String getColumnTypeName(int column) throws SQLException; + + /** + * Indicates whether the designated column is definitely not writable. + * + * @param column the first column is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isReadOnly(int column) throws SQLException; + + /** + * Indicates whether it is possible for a write on the designated column to succeed. + * + * @param column the first column is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isWritable(int column) throws SQLException; + + /** + * Indicates whether a write on the designated column will definitely succeed. + * + * @param column the first column is 1, the second is 2, ... + * @return true if so; false otherwise + * @exception SQLException if a database access error occurs + */ + boolean isDefinitelyWritable(int column) throws SQLException; + + //--------------------------JDBC 2.0----------------------------------- + + /** + *

Returns the fully-qualified name of the Java class whose instances + * are manufactured if the method ResultSet.getObject + * is called to retrieve a value + * from the column. ResultSet.getObject may return a subclass of the + * class returned by this method. + * + * @param column the first column is 1, the second is 2, ... + * @return the fully-qualified name of the class in the Java programming + * language that would be used by the method + * ResultSet.getObject to retrieve the value in the specified + * column. This is the class name used for custom mapping. + * @exception SQLException if a database access error occurs + * @since 1.2 + */ + String getColumnClassName(int column) throws SQLException; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/RowId.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/RowId.java new file mode 100644 index 0000000000..11e79b3c6a --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/RowId.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * + * The representation (mapping) in the Java programming language of an SQL ROWID + * value. An SQL ROWID is a built-in type, a value of which can be thought of as + * an address for its identified row in a database table. Whether that address + * is logical or, in any respects, physical is determined by its originating data + * source. + *

+ * Methods in the interfaces ResultSet, CallableStatement, + * and PreparedStatement, such as getRowId and setRowId + * allow a programmer to access a SQL ROWID value. The RowId + * interface provides a method + * for representing the value of the ROWID as a byte array or as a + * String. + *

+ * The method getRowIdLifetime in the interface DatabaseMetaData, + * can be used + * to determine if a RowId object remains valid for the duration of the transaction in + * which the RowId was created, the duration of the session in which + * the RowId was created, + * or, effectively, for as long as its identified row is not deleted. In addition + * to specifying the duration of its valid lifetime outside its originating data + * source, getRowIdLifetime specifies the duration of a ROWID + * value's valid lifetime + * within its originating data source. In this, it differs from a large object, + * because there is no limit on the valid lifetime of a large object within its + * originating data source. + *

+ * All methods on the RowId interface must be fully implemented if the + * JDBC driver supports the data type. + * + * @see java.sql.DatabaseMetaData + * @since 1.6 + */ + +public interface RowId { + /** + * Compares this RowId to the specified object. The result is + * true if and only if the argument is not null and is a RowId + * object that represents the same ROWID as this object. + *

+ * It is important + * to consider both the origin and the valid lifetime of a RowId + * when comparing it to another RowId. If both are valid, and + * both are from the same table on the same data source, then if they are equal + * they identify + * the same row; if one or more is no longer guaranteed to be valid, or if + * they originate from different data sources, or different tables on the + * same data source, they may be equal but still + * not identify the same row. + * + * @param obj the Object to compare this RowId object + * against. + * @return true if the RowIds are equal; false otherwise + * @since 1.6 + */ + boolean equals(Object obj); + + /** + * Returns an array of bytes representing the value of the SQL ROWID + * designated by this java.sql.RowId object. + * + * @return an array of bytes, whose length is determined by the driver supplying + * the connection, representing the value of the ROWID designated by this + * java.sql.RowId object. + */ + byte[] getBytes(); + + /** + * Returns a String representing the value of the SQL ROWID designated by this + * java.sql.RowId object. + *

+ *Like java.sql.Date.toString() + * returns the contents of its DATE as the String "2004-03-17" + * rather than as DATE literal in SQL (which would have been the String + * DATE "2004-03-17"), toString() + * returns the contents of its ROWID in a form specific to the driver supplying + * the connection, and possibly not as a ROWID literal. + * + * @return a String whose format is determined by the driver supplying the + * connection, representing the value of the ROWID designated + * by this java.sql.RowId object. + */ + String toString(); + + /** + * Returns a hash code value of this RowId object. + * + * @return a hash code for the RowId + */ + int hashCode(); + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/RowIdLifetime.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/RowIdLifetime.java new file mode 100644 index 0000000000..165577dec9 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/RowIdLifetime.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.util.*; + +/** + * Enumeration for RowId life-time values. + * + * @since 1.6 + */ + +public enum RowIdLifetime { + + /** + * Indicates that this data source does not support the ROWID type. + */ + ROWID_UNSUPPORTED, + + /** + * Indicates that the lifetime of a RowId from this data source is indeterminate; + * but not one of ROWID_VALID_TRANSACTION, ROWID_VALID_SESSION, or, + * ROWID_VALID_FOREVER. + */ + ROWID_VALID_OTHER, + + /** + * Indicates that the lifetime of a RowId from this data source is at least the + * containing session. + */ + ROWID_VALID_SESSION, + + /** + * Indicates that the lifetime of a RowId from this data source is at least the + * containing transaction. + */ + ROWID_VALID_TRANSACTION, + + /** + * Indicates that the lifetime of a RowId from this data source is, effectively, + * unlimited. + */ + ROWID_VALID_FOREVER +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLClientInfoException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLClientInfoException.java new file mode 100644 index 0000000000..131e407824 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLClientInfoException.java @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.sql; + +import java.util.Map; + +/** + * The subclass of {@link SQLException} is thrown when one or more client info properties + * could not be set on a Connection. In addition to the information provided + * by SQLException, a SQLClientInfoException provides a list of client info + * properties that were not set. + * + * Some databases do not allow multiple client info properties to be set + * atomically. For those databases, it is possible that some of the client + * info properties had been set even though the Connection.setClientInfo + * method threw an exception. An application can use the getFailedProperties + * method to retrieve a list of client info properties that were not set. The + * properties are identified by passing a + * Map<String,ClientInfoStatus> to + * the appropriate SQLClientInfoException constructor. + *

+ * @see ClientInfoStatus + * @see Connection#setClientInfo + * @since 1.6 + */ +public class SQLClientInfoException extends SQLException { + + + + + private Map failedProperties; + + /** + * Constructs a SQLClientInfoException Object. + * The reason, + * SQLState, and failedProperties list are initialized to + * null and the vendor code is initialized to 0. + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @since 1.6 + */ + public SQLClientInfoException() { + + this.failedProperties = null; + } + + /** + * Constructs a SQLClientInfoException object initialized with a + * given failedProperties. + * The reason and SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @param failedProperties A Map containing the property values that could not + * be set. The keys in the Map + * contain the names of the client info + * properties that could not be set and + * the values contain one of the reason codes + * defined in ClientInfoStatus + *

+ * @since 1.6 + */ + public SQLClientInfoException(Map failedProperties) { + + this.failedProperties = failedProperties; + } + + /** + * Constructs a SQLClientInfoException object initialized with + * a given cause and failedProperties. + * + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null and the vendor code is initialized to 0. + * + *

+ * + * @param failedProperties A Map containing the property values that could not + * be set. The keys in the Map + * contain the names of the client info + * properties that could not be set and + * the values contain one of the reason codes + * defined in ClientInfoStatus + * @param cause the (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + *

+ * @since 1.6 + */ + public SQLClientInfoException(Map failedProperties, + Throwable cause) { + + super(cause != null?cause.toString():null); + initCause(cause); + this.failedProperties = failedProperties; + } + + /** + * Constructs a SQLClientInfoException object initialized with a + * given reason and failedProperties. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @param reason a description of the exception + * @param failedProperties A Map containing the property values that could not + * be set. The keys in the Map + * contain the names of the client info + * properties that could not be set and + * the values contain one of the reason codes + * defined in ClientInfoStatus + *

+ * @since 1.6 + */ + public SQLClientInfoException(String reason, + Map failedProperties) { + + super(reason); + this.failedProperties = failedProperties; + } + + /** + * Constructs a SQLClientInfoException object initialized with a + * given reason, cause and + * failedProperties. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + *

+ * + * @param reason a description of the exception + * @param failedProperties A Map containing the property values that could not + * be set. The keys in the Map + * contain the names of the client info + * properties that could not be set and + * the values contain one of the reason codes + * defined in ClientInfoStatus + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + *

+ * @since 1.6 + */ + public SQLClientInfoException(String reason, + Map failedProperties, + Throwable cause) { + + super(reason); + initCause(cause); + this.failedProperties = failedProperties; + } + + /** + * Constructs a SQLClientInfoException object initialized with a + * given reason, SQLState and + * failedProperties. + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * + * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param failedProperties A Map containing the property values that could not + * be set. The keys in the Map + * contain the names of the client info + * properties that could not be set and + * the values contain one of the reason codes + * defined in ClientInfoStatus + *

+ * @since 1.6 + */ + public SQLClientInfoException(String reason, + String SQLState, + Map failedProperties) { + + super(reason, SQLState); + this.failedProperties = failedProperties; + } + + /** + * Constructs a SQLClientInfoException object initialized with a + * given reason, SQLState, cause + * and failedProperties. The vendor code is initialized to 0. + *

+ * + * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param failedProperties A Map containing the property values that could not + * be set. The keys in the Map + * contain the names of the client info + * properties that could not be set and + * the values contain one of the reason codes + * defined in ClientInfoStatus + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + *

+ * @since 1.6 + */ + public SQLClientInfoException(String reason, + String SQLState, + Map failedProperties, + Throwable cause) { + + super(reason, SQLState); + initCause(cause); + this.failedProperties = failedProperties; + } + + /** + * Constructs a SQLClientInfoException object initialized with a + * given reason, SQLState, + * vendorCode and failedProperties. + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param failedProperties A Map containing the property values that could not + * be set. The keys in the Map + * contain the names of the client info + * properties that could not be set and + * the values contain one of the reason codes + * defined in ClientInfoStatus + *

+ * @since 1.6 + */ + public SQLClientInfoException(String reason, + String SQLState, + int vendorCode, + Map failedProperties) { + + super(reason, SQLState, vendorCode); + this.failedProperties = failedProperties; + } + + /** + * Constructs a SQLClientInfoException object initialized with a + * given reason, SQLState, + * cause, vendorCode and + * failedProperties. + *

+ * + * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param failedProperties A Map containing the property values that could not + * be set. The keys in the Map + * contain the names of the client info + * properties that could not be set and + * the values contain one of the reason codes + * defined in ClientInfoStatus + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + *

+ * @since 1.6 + */ + public SQLClientInfoException(String reason, + String SQLState, + int vendorCode, + Map failedProperties, + Throwable cause) { + + super(reason, SQLState, vendorCode); + initCause(cause); + this.failedProperties = failedProperties; + } + + /** + * Returns the list of client info properties that could not be set. The + * keys in the Map contain the names of the client info + * properties that could not be set and the values contain one of the + * reason codes defined in ClientInfoStatus + *

+ * + * @return Map list containing the client info properties that could + * not be set + *

+ * @since 1.6 + */ + public Map getFailedProperties() { + + return this.failedProperties; + } + + private static final long serialVersionUID = -4319604256824655880L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLData.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLData.java new file mode 100644 index 0000000000..7d83c7374c --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLData.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The interface used for the custom mapping of an SQL user-defined type (UDT) to + * a class in the Java programming language. The class object for a class + * implementing the SQLData interface will be entered in the + * appropriate Connection object's type map along with the SQL + * name of the UDT for which it is a custom mapping. + *

+ * Typically, a SQLData implementation + * will define a field for each attribute of an SQL structured type or a + * single field for an SQL DISTINCT type. When the UDT is + * retrieved from a data source with the ResultSet.getObject + * method, it will be mapped as an instance of this class. A programmer + * can operate on this class instance just as on any other object in the + * Java programming language and then store any changes made to it by + * calling the PreparedStatement.setObject method, + * which will map it back to the SQL type. + *

+ * It is expected that the implementation of the class for a custom + * mapping will be done by a tool. In a typical implementation, the + * programmer would simply supply the name of the SQL UDT, the name of + * the class to which it is being mapped, and the names of the fields to + * which each of the attributes of the UDT is to be mapped. The tool will use + * this information to implement the SQLData.readSQL and + * SQLData.writeSQL methods. The readSQL method + * calls the appropriate SQLInput methods to read + * each attribute from an SQLInput object, and the + * writeSQL method calls SQLOutput methods + * to write each attribute back to the data source via an + * SQLOutput object. + *

+ * An application programmer will not normally call SQLData methods + * directly, and the SQLInput and SQLOutput methods + * are called internally by SQLData methods, not by application code. + * + * @since 1.2 + */ +public interface SQLData { + + /** + * Returns the fully-qualified + * name of the SQL user-defined type that this object represents. + * This method is called by the JDBC driver to get the name of the + * UDT instance that is being mapped to this instance of + * SQLData. + * + * @return the type name that was passed to the method readSQL + * when this object was constructed and populated + * @exception SQLException if there is a database access error + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + String getSQLTypeName() throws SQLException; + + /** + * Populates this object with data read from the database. + * The implementation of the method must follow this protocol: + *

    + *
  • It must read each of the attributes or elements of the SQL + * type from the given input stream. This is done + * by calling a method of the input stream to read each + * item, in the order that they appear in the SQL definition + * of the type. + *
  • The method readSQL then + * assigns the data to appropriate fields or + * elements (of this or other objects). + * Specifically, it must call the appropriate reader method + * (SQLInput.readString, SQLInput.readBigDecimal, + * and so on) method(s) to do the following: + * for a distinct type, read its single data element; + * for a structured type, read a value for each attribute of the SQL type. + *
+ * The JDBC driver initializes the input stream with a type map + * before calling this method, which is used by the appropriate + * SQLInput reader method on the stream. + * + * @param stream the SQLInput object from which to read the data for + * the value that is being custom mapped + * @param typeName the SQL type name of the value on the data stream + * @exception SQLException if there is a database access error + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see SQLInput + * @since 1.2 + */ + void readSQL (SQLInput stream, String typeName) throws SQLException; + + /** + * Writes this object to the given SQL data stream, converting it back to + * its SQL value in the data source. + * The implementation of the method must follow this protocol:
+ * It must write each of the attributes of the SQL type + * to the given output stream. This is done by calling a + * method of the output stream to write each item, in the order that + * they appear in the SQL definition of the type. + * Specifically, it must call the appropriate SQLOutput writer + * method(s) (writeInt, writeString, and so on) + * to do the following: for a Distinct Type, write its single data element; + * for a Structured Type, write a value for each attribute of the SQL type. + * + * @param stream the SQLOutput object to which to write the data for + * the value that was custom mapped + * @exception SQLException if there is a database access error + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @see SQLOutput + * @since 1.2 + */ + void writeSQL (SQLOutput stream) throws SQLException; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLDataException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLDataException.java new file mode 100644 index 0000000000..8dc1753a6b --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLDataException.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown when the SQLState class value + * is '22', or under vendor-specified conditions. This indicates + * various data errors, including but not limited to data conversion errors, + * division by 0, and invalid arguments to functions. + *

+ * Please consult your driver vendor documentation for the vendor-specified + * conditions for which this Exception may be thrown. + * @since 1.6 + */ +public class SQLDataException extends SQLNonTransientException { + + /** + * Constructs a SQLDataException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @since 1.6 + */ + public SQLDataException() { + super(); + } + + /** + * Constructs a SQLDataException object with a given + * reason. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @param reason a description of the exception + * @since 1.6 + */ + public SQLDataException(String reason) { + super(reason); + } + + /** + * Constructs a SQLDataException object with a given + * reason and SQLState. The + * vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLDataException(String reason, String SQLState) { + super(reason, SQLState); + } + + /** + * Constructs a SQLDataException object with a given + * reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLDataException(String reason, String SQLState, int vendorCode) { + super(reason, SQLState, vendorCode); + } + + /** + * Constructs a SQLDataException object with a given + * cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLDataException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLDataException object with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLDataException(String reason, Throwable cause) { + super(reason, cause); + } + + /** + * Constructs a SQLDataException object with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLDataException(String reason, String SQLState, Throwable cause) { + super(reason, SQLState, cause); + } + + /** + * Constructs a SQLDataException object with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLDataException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason, SQLState, vendorCode, cause); + } + + private static final long serialVersionUID = -6889123282670549800L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLFeatureNotSupportedException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLFeatureNotSupportedException.java new file mode 100644 index 0000000000..e9a38d672d --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLFeatureNotSupportedException.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown when the SQLState class value is '0A' + * ( the value is 'zero' A). + * This indicates that the JDBC driver does not support an optional JDBC feature. + * Optional JDBC features can fall into the fallowing categories: + *

+ *

    + *
  • no support for an optional feature + *
  • no support for an optional overloaded method + *
  • no support for an optional mode for a method. The mode for a method is + *determined based on constants passed as parameter values to a method + *
+ * + * @since 1.6 + */ +public class SQLFeatureNotSupportedException extends SQLNonTransientException { + + /** + * Constructs a SQLFeatureNotSupportedException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLFeatureNotSupportedException() { + super(); + } + + /** + * Constructs a SQLFeatureNotSupportedException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLFeatureNotSupportedException(String reason) { + super(reason); + } + + /** + * Constructs a SQLFeatureNotSupportedException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLFeatureNotSupportedException(String reason, String SQLState) { + super(reason,SQLState); + } + + /** + * Constructs a SQLFeatureNotSupportedException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLFeatureNotSupportedException(String reason, String SQLState, int vendorCode) { + super(reason,SQLState,vendorCode); + } + + /** + * Constructs a SQLFeatureNotSupportedException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval bythe getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLFeatureNotSupportedException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLFeatureNotSupportedException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLFeatureNotSupportedException(String reason, Throwable cause) { + super(reason,cause); + } + + /** + * Constructs a SQLFeatureNotSupportedException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLFeatureNotSupportedException(String reason, String SQLState, Throwable cause) { + super(reason,SQLState,cause); + } + + /** + * Constructs a SQLFeatureNotSupportedException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLFeatureNotSupportedException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason,SQLState,vendorCode,cause); + } + + private static final long serialVersionUID = -1026510870282316051L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLInput.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLInput.java new file mode 100644 index 0000000000..c607e83cbc --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLInput.java @@ -0,0 +1,424 @@ +/* + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * An input stream that contains a stream of values representing an + * instance of an SQL structured type or an SQL distinct type. + * This interface, used only for custom mapping, is used by the driver + * behind the scenes, and a programmer never directly invokes + * SQLInput methods. The reader methods + * (readLong, readBytes, and so on) + * provide a way for an implementation of the SQLData + * interface to read the values in an SQLInput object. + * And as described in SQLData, calls to reader methods must + * be made in the order that their corresponding attributes appear in the + * SQL definition of the type. + * The method wasNull is used to determine whether + * the last value read was SQL NULL. + *

When the method getObject is called with an + * object of a class implementing the interface SQLData, + * the JDBC driver calls the method SQLData.getSQLType + * to determine the SQL type of the user-defined type (UDT) + * being custom mapped. The driver + * creates an instance of SQLInput, populating it with the + * attributes of the UDT. The driver then passes the input + * stream to the method SQLData.readSQL, which in turn + * calls the SQLInput reader methods + * in its implementation for reading the + * attributes from the input stream. + * @since 1.2 + */ + +public interface SQLInput { + + + //================================================================ + // Methods for reading attributes from the stream of SQL data. + // These methods correspond to the column-accessor methods of + // java.sql.ResultSet. + //================================================================ + + /** + * Reads the next attribute in the stream and returns it as a String + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + String readString() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a boolean + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns false + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean readBoolean() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a byte + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns 0 + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + byte readByte() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a short + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns 0 + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + short readShort() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as an int + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns 0 + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + int readInt() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a long + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns 0 + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + long readLong() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a float + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns 0 + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + float readFloat() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a double + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns 0 + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + double readDouble() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a java.math.BigDecimal + * object in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + java.math.BigDecimal readBigDecimal() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as an array of bytes + * in the Java programming language. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + byte[] readBytes() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a java.sql.Date object. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + java.sql.Date readDate() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a java.sql.Time object. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + java.sql.Time readTime() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a java.sql.Timestamp object. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + java.sql.Timestamp readTimestamp() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a stream of Unicode characters. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + java.io.Reader readCharacterStream() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a stream of ASCII characters. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + java.io.InputStream readAsciiStream() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a stream of uninterpreted + * bytes. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + java.io.InputStream readBinaryStream() throws SQLException; + + //================================================================ + // Methods for reading items of SQL user-defined types from the stream. + //================================================================ + + /** + * Reads the datum at the head of the stream and returns it as an + * Object in the Java programming language. The + * actual type of the object returned is determined by the default type + * mapping, and any customizations present in this stream's type map. + * + *

A type map is registered with the stream by the JDBC driver before the + * stream is passed to the application. + * + *

When the datum at the head of the stream is an SQL NULL, + * the method returns null. If the datum is an SQL structured or distinct + * type, it determines the SQL type of the datum at the head of the stream. + * If the stream's type map has an entry for that SQL type, the driver + * constructs an object of the appropriate class and calls the method + * SQLData.readSQL on that object, which reads additional data from the + * stream, using the protocol described for that method. + * + * @return the datum at the head of the stream as an Object in the + * Java programming language;null if the datum is SQL NULL + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object readObject() throws SQLException; + + /** + * Reads an SQL REF value from the stream and returns it as a + * Ref object in the Java programming language. + * + * @return a Ref object representing the SQL REF value + * at the head of the stream; null if the value read is + * SQL NULL + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Ref readRef() throws SQLException; + + /** + * Reads an SQL BLOB value from the stream and returns it as a + * Blob object in the Java programming language. + * + * @return a Blob object representing data of the SQL BLOB value + * at the head of the stream; null if the value read is + * SQL NULL + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Blob readBlob() throws SQLException; + + /** + * Reads an SQL CLOB value from the stream and returns it as a + * Clob object in the Java programming language. + * + * @return a Clob object representing data of the SQL CLOB value + * at the head of the stream; null if the value read is + * SQL NULL + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Clob readClob() throws SQLException; + + /** + * Reads an SQL ARRAY value from the stream and returns it as an + * Array object in the Java programming language. + * + * @return an Array object representing data of the SQL + * ARRAY value at the head of the stream; null + * if the value read is SQL NULL + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Array readArray() throws SQLException; + + /** + * Retrieves whether the last value read was SQL NULL. + * + * @return true if the most recently read SQL value was SQL + * NULL; false otherwise + * @exception SQLException if a database access error occurs + * + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + boolean wasNull() throws SQLException; + + //---------------------------- JDBC 3.0 ------------------------- + + /** + * Reads an SQL DATALINK value from the stream and returns it as a + * java.net.URL object in the Java programming language. + * + * @return a java.net.URL object. + * @exception SQLException if a database access error occurs, + * or if a URL is malformed + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + java.net.URL readURL() throws SQLException; + + //---------------------------- JDBC 4.0 ------------------------- + + /** + * Reads an SQL NCLOB value from the stream and returns it as a + * NClob object in the Java programming language. + * + * @return a NClob object representing data of the SQL NCLOB value + * at the head of the stream; null if the value read is + * SQL NULL + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + NClob readNClob() throws SQLException; + + /** + * Reads the next attribute in the stream and returns it as a String + * in the Java programming language. It is intended for use when + * accessing NCHAR,NVARCHAR + * and LONGNVARCHAR columns. + * + * @return the attribute; if the value is SQL NULL, returns null + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + String readNString() throws SQLException; + + /** + * Reads an SQL XML value from the stream and returns it as a + * SQLXML object in the Java programming language. + * + * @return a SQLXML object representing data of the SQL XML value + * at the head of the stream; null if the value read is + * SQL NULL + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + SQLXML readSQLXML() throws SQLException; + + /** + * Reads an SQL ROWID value from the stream and returns it as a + * RowId object in the Java programming language. + * + * @return a RowId object representing data of the SQL ROWID value + * at the head of the stream; null if the value read is + * SQL NULL + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + RowId readRowId() throws SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLIntegrityConstraintViolationException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLIntegrityConstraintViolationException.java new file mode 100644 index 0000000000..0f92ac50df --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLIntegrityConstraintViolationException.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown when the SQLState class value + * is '23', or under vendor-specified conditions. + * This indicates that an integrity + * constraint (foreign key, primary key or unique key) has been violated. + *

+ * Please consult your driver vendor documentation for the vendor-specified + * conditions for which this Exception may be thrown. + * @since 1.6 + */ +public class SQLIntegrityConstraintViolationException extends SQLNonTransientException { + + /** + * Constructs a SQLIntegrityConstraintViolationException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLIntegrityConstraintViolationException() { + super(); + } + + /** + * Constructs a SQLIntegrityConstraintViolationException + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLIntegrityConstraintViolationException(String reason) { + super(reason); + } + + /** + * Constructs a SQLIntegrityConstraintViolationException + * object with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLIntegrityConstraintViolationException(String reason, String SQLState) { + super(reason,SQLState); + } + + /** + * Constructs a SQLIntegrityConstraintViolationException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode) { + super(reason,SQLState,vendorCode); + } + + /** + * Constructs an SQLIntegrityConstraintViolationException object with + * a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLIntegrityConstraintViolationException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLIntegrityConstraintViolationException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLIntegrityConstraintViolationException(String reason, Throwable cause) { + super(reason,cause); + } + + /** + * Constructs a SQLIntegrityConstraintViolationException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLIntegrityConstraintViolationException(String reason, String SQLState, Throwable cause) { + super(reason,SQLState, cause); + } + + /** + * Constructs a SQLIntegrityConstraintViolationException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason,SQLState,vendorCode,cause); + } + + private static final long serialVersionUID = 8033405298774849169L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLInvalidAuthorizationSpecException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLInvalidAuthorizationSpecException.java new file mode 100644 index 0000000000..0b4d206df9 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLInvalidAuthorizationSpecException.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown when the SQLState class value + * is '28', or under vendor-specified conditions. This indicates that + * the authorization credentials presented during connection establishment + * are not valid. + *

+ * Please consult your driver vendor documentation for the vendor-specified + * conditions for which this Exception may be thrown. + * @since 1.6 + */ +public class SQLInvalidAuthorizationSpecException extends SQLNonTransientException { + + /** + * Constructs a SQLInvalidAuthorizationSpecException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLInvalidAuthorizationSpecException() { + super(); + } + + /** + * Constructs a SQLInvalidAuthorizationSpecException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLInvalidAuthorizationSpecException(String reason) { + super(reason); + } + + /** + * Constructs a SQLInvalidAuthorizationSpecException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLInvalidAuthorizationSpecException(String reason, String SQLState) { + super(reason,SQLState); + } + + /** + * Constructs a SQLInvalidAuthorizationSpecException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLInvalidAuthorizationSpecException(String reason, String SQLState, int vendorCode) { + super(reason,SQLState,vendorCode); + } + + /** + * Constructs a SQLInvalidAuthorizationSpecException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLInvalidAuthorizationSpecException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLInvalidAuthorizationSpecException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLInvalidAuthorizationSpecException(String reason, Throwable cause) { + super(reason,cause); + } + + /** + * Constructs a SQLInvalidAuthorizationSpecException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLInvalidAuthorizationSpecException(String reason, String SQLState, Throwable cause) { + super(reason,SQLState,cause); + } + + /** + * Constructs a SQLInvalidAuthorizationSpecException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLInvalidAuthorizationSpecException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason,SQLState,vendorCode,cause); + } + + private static final long serialVersionUID = -64105250450891498L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLNonTransientConnectionException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLNonTransientConnectionException.java new file mode 100644 index 0000000000..036c881f20 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLNonTransientConnectionException.java @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown for the SQLState + * class value '08', or under vendor-specified conditions. This + * indicates that the connection operation that failed will not succeed if + * the operation is retried without the cause of the failure being corrected. + *

+ * Please consult your driver vendor documentation for the vendor-specified + * conditions for which this Exception may be thrown. + * @since 1.6 + */ +public class SQLNonTransientConnectionException extends java.sql.SQLNonTransientException { + + /** + * Constructs a SQLNonTransientConnectionException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @since 1.6 + */ + public SQLNonTransientConnectionException() { + super(); + } + + /** + * Constructs a SQLNonTransientConnectionException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLNonTransientConnectionException(String reason) { + super(reason); + } + + /** + * Constructs a SQLNonTransientConnectionException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLNonTransientConnectionException(String reason, String SQLState) { + super(reason,SQLState); + } + + /** + * Constructs a SQLNonTransientConnectionException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLNonTransientConnectionException(String reason, String SQLState, int vendorCode) { + super(reason,SQLState,vendorCode); + } + + /** + * Constructs a SQLNonTransientConnectionException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLNonTransientConnectionException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLTransientException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLNonTransientConnectionException(String reason, Throwable cause) { + super(reason,cause); + } + + /** + * Constructs a SQLNonTransientConnectionException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLNonTransientConnectionException(String reason, String SQLState, Throwable cause) { + super(reason,SQLState,cause); + } + + /** + * Constructs a SQLNonTransientConnectionException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLNonTransientConnectionException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason,SQLState,vendorCode,cause); + } + + private static final long serialVersionUID = -5852318857474782892L; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLNonTransientException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLNonTransientException.java new file mode 100644 index 0000000000..1e6889338b --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLNonTransientException.java @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown when an instance where a retry + * of the same operation would fail unless the cause of the SQLException + * is corrected. + *

+ * + * @since 1.6 + */ +public class SQLNonTransientException extends java.sql.SQLException { + + /** + * Constructs a SQLNonTransientException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @since 1.6 + */ + public SQLNonTransientException() { + super(); + } + + /** + * Constructs a SQLNonTransientException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * + * @param reason a description of the exception + * @since 1.6 + */ + public SQLNonTransientException(String reason) { + super(reason); + } + + /** + * Constructs a SQLNonTransientException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLNonTransientException(String reason, String SQLState) { + super(reason,SQLState); + } + + /** + * Constructs a SQLNonTransientException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLNonTransientException(String reason, String SQLState, int vendorCode) { + super(reason,SQLState,vendorCode); + } + + /** + * Constructs a SQLNonTransientException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLNonTransientException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLTransientException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLNonTransientException(String reason, Throwable cause) { + super(reason,cause); + + } + + /** + * Constructs a SQLNonTransientException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLNonTransientException(String reason, String SQLState, Throwable cause) { + super(reason,SQLState,cause); + } + + /** + * Constructs a SQLNonTransientException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLNonTransientException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason,SQLState,vendorCode,cause); + } + + private static final long serialVersionUID = -9104382843534716547L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLOutput.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLOutput.java new file mode 100644 index 0000000000..8aa1d14532 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLOutput.java @@ -0,0 +1,437 @@ +/* + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The output stream for writing the attributes of a user-defined + * type back to the database. This interface, used + * only for custom mapping, is used by the driver, and its + * methods are never directly invoked by a programmer. + *

When an object of a class implementing the interface + * SQLData is passed as an argument to an SQL statement, the + * JDBC driver calls the method SQLData.getSQLType to + * determine the kind of SQL + * datum being passed to the database. + * The driver then creates an instance of SQLOutput and + * passes it to the method SQLData.writeSQL. + * The method writeSQL in turn calls the + * appropriate SQLOutput writer methods + * writeBoolean, writeCharacterStream, and so on) + * to write data from the SQLData object to + * the SQLOutput output stream as the + * representation of an SQL user-defined type. + * @since 1.2 + */ + + public interface SQLOutput { + + //================================================================ + // Methods for writing attributes to the stream of SQL data. + // These methods correspond to the column-accessor methods of + // java.sql.ResultSet. + //================================================================ + + /** + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeString(String x) throws SQLException; + + /** + * Writes the next attribute to the stream as a Java boolean. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeBoolean(boolean x) throws SQLException; + + /** + * Writes the next attribute to the stream as a Java byte. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeByte(byte x) throws SQLException; + + /** + * Writes the next attribute to the stream as a Java short. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeShort(short x) throws SQLException; + + /** + * Writes the next attribute to the stream as a Java int. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeInt(int x) throws SQLException; + + /** + * Writes the next attribute to the stream as a Java long. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeLong(long x) throws SQLException; + + /** + * Writes the next attribute to the stream as a Java float. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeFloat(float x) throws SQLException; + + /** + * Writes the next attribute to the stream as a Java double. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeDouble(double x) throws SQLException; + + /** + * Writes the next attribute to the stream as a java.math.BigDecimal object. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeBigDecimal(java.math.BigDecimal x) throws SQLException; + + /** + * Writes the next attribute to the stream as an array of bytes. + * Writes the next attribute to the stream as a String + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeBytes(byte[] x) throws SQLException; + + /** + * Writes the next attribute to the stream as a java.sql.Date object. + * Writes the next attribute to the stream as a java.sql.Date object + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeDate(java.sql.Date x) throws SQLException; + + /** + * Writes the next attribute to the stream as a java.sql.Time object. + * Writes the next attribute to the stream as a java.sql.Date object + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeTime(java.sql.Time x) throws SQLException; + + /** + * Writes the next attribute to the stream as a java.sql.Timestamp object. + * Writes the next attribute to the stream as a java.sql.Date object + * in the Java programming language. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeTimestamp(java.sql.Timestamp x) throws SQLException; + + /** + * Writes the next attribute to the stream as a stream of Unicode characters. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeCharacterStream(java.io.Reader x) throws SQLException; + + /** + * Writes the next attribute to the stream as a stream of ASCII characters. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeAsciiStream(java.io.InputStream x) throws SQLException; + + /** + * Writes the next attribute to the stream as a stream of uninterpreted + * bytes. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeBinaryStream(java.io.InputStream x) throws SQLException; + + //================================================================ + // Methods for writing items of SQL user-defined types to the stream. + // These methods pass objects to the database as values of SQL + // Structured Types, Distinct Types, Constructed Types, and Locator + // Types. They decompose the Java object(s) and write leaf data + // items using the methods above. + //================================================================ + + /** + * Writes to the stream the data contained in the given + * SQLData object. + * When the SQLData object is null, this + * method writes an SQL NULL to the stream. + * Otherwise, it calls the SQLData.writeSQL + * method of the given object, which + * writes the object's attributes to the stream. + * The implementation of the method SQLData.writeSQ + * calls the appropriate SQLOutput writer method(s) + * for writing each of the object's attributes in order. + * The attributes must be read from an SQLInput + * input stream and written to an SQLOutput + * output stream in the same order in which they were + * listed in the SQL definition of the user-defined type. + * + * @param x the object representing data of an SQL structured or + * distinct type + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeObject(SQLData x) throws SQLException; + + /** + * Writes an SQL REF value to the stream. + * + * @param x a Ref object representing data of an SQL + * REF value + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeRef(Ref x) throws SQLException; + + /** + * Writes an SQL BLOB value to the stream. + * + * @param x a Blob object representing data of an SQL + * BLOB value + * + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeBlob(Blob x) throws SQLException; + + /** + * Writes an SQL CLOB value to the stream. + * + * @param x a Clob object representing data of an SQL + * CLOB value + * + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeClob(Clob x) throws SQLException; + + /** + * Writes an SQL structured type value to the stream. + * + * @param x a Struct object representing data of an SQL + * structured type + * + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeStruct(Struct x) throws SQLException; + + /** + * Writes an SQL ARRAY value to the stream. + * + * @param x an Array object representing data of an SQL + * ARRAY type + * + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + void writeArray(Array x) throws SQLException; + + //--------------------------- JDBC 3.0 ------------------------ + + /** + * Writes a SQL DATALINK value to the stream. + * + * @param x a java.net.URL object representing the data + * of SQL DATALINK type + * + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.4 + */ + void writeURL(java.net.URL x) throws SQLException; + + //--------------------------- JDBC 4.0 ------------------------ + + /** + * Writes the next attribute to the stream as a String + * in the Java programming language. The driver converts this to a + * SQL NCHAR or + * NVARCHAR or LONGNVARCHAR value + * (depending on the argument's + * size relative to the driver's limits on NVARCHAR values) + * when it sends it to the stream. + * + * @param x the value to pass to the database + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void writeNString(String x) throws SQLException; + + /** + * Writes an SQL NCLOB value to the stream. + * + * @param x a NClob object representing data of an SQL + * NCLOB value + * + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void writeNClob(NClob x) throws SQLException; + + + /** + * Writes an SQL ROWID value to the stream. + * + * @param x a RowId object representing data of an SQL + * ROWID value + * + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void writeRowId(RowId x) throws SQLException; + + + /** + * Writes an SQL XML value to the stream. + * + * @param x a SQLXML object representing data of an SQL + * XML value + * + * @throws SQLException if a database access error occurs, + * the java.xml.transform.Result, + * Writer or OutputStream has not been closed for the SQLXML object or + * if there is an error processing the XML value. The getCause method + * of the exception may provide a more detailed exception, for example, if the + * stream does not contain valid XML. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void writeSQLXML(SQLXML x) throws SQLException; + + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLPermission.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLPermission.java new file mode 100644 index 0000000000..050f7636a1 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLPermission.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.security.*; + +/** + * Legacy security code; do not use. + */ + +public final class SQLPermission extends BasicPermission { + + public SQLPermission(String name) { + super(""); + } + + public SQLPermission(String name, String actions) { + super("", ""); + } +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLRecoverableException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLRecoverableException.java new file mode 100644 index 0000000000..08de9d7798 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLRecoverableException.java @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown in situations where a + * previously failed operation might be able to succeed if the application performs + * some recovery steps and retries the entire transaction or in the case of a + * distributed transaction, the transaction branch. At a minimum, + * the recovery operation must include closing the current connection and getting + * a new connection. + *

+ * + * @since 1.6 + */ +public class SQLRecoverableException extends java.sql.SQLException { + + /** + * Constructs a SQLRecoverableException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLRecoverableException() { + super(); + } + + /** + * Constructs a SQLRecoverableException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLRecoverableException(String reason) { + super(reason); + } + + /** + * Constructs a SQLRecoverableException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLRecoverableException(String reason, String SQLState) { + super(reason, SQLState); + } + + /** + * Constructs a SQLRecoverableException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLRecoverableException(String reason, String SQLState, int vendorCode) { + super(reason, SQLState, vendorCode); + } + + /** + * Constructs a SQLRecoverableException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLRecoverableException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLRecoverableException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLRecoverableException(String reason, Throwable cause) { + super(reason, cause); + } + + /** + * Constructs a SQLRecoverableException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLRecoverableException(String reason, String SQLState, Throwable cause) { + super(reason, SQLState, cause); + } + + /** + * Constructs a SQLRecoverableException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLRecoverableException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason, SQLState, vendorCode, cause); + } + + private static final long serialVersionUID = -4144386502923131579L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLSyntaxErrorException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLSyntaxErrorException.java new file mode 100644 index 0000000000..b65dec722c --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLSyntaxErrorException.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown when the SQLState class value + * is '42', or under vendor-specified conditions. This indicates that the + * in-progress query has violated SQL syntax rules. + *

+ * Please consult your driver vendor documentation for the vendor-specified + * conditions for which this Exception may be thrown. + * @since 1.6 + */ +public class SQLSyntaxErrorException extends SQLNonTransientException { + + /** + * Constructs a SQLSyntaxErrorException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLSyntaxErrorException() { + super(); + } + + /** + * Constructs a SQLSyntaxErrorException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLSyntaxErrorException(String reason) { + super(reason); + } + + /** + * Constructs a SQLSyntaxErrorException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLSyntaxErrorException(String reason, String SQLState) { + super(reason, SQLState); + } + + /** + * Constructs a SQLSyntaxErrorException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLSyntaxErrorException(String reason, String SQLState, int vendorCode) { + super(reason, SQLState, vendorCode); + } + + /** + * Constructs a SQLSyntaxErrorException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval bythe getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLSyntaxErrorException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLSyntaxErrorException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLSyntaxErrorException(String reason, Throwable cause) { + super(reason, cause); + } + + /** + * Constructs a SQLSyntaxErrorException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLSyntaxErrorException(String reason, String SQLState, Throwable cause) { + super(reason, SQLState, cause); + } + + /** + * Constructs a SQLSyntaxErrorException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLSyntaxErrorException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason, SQLState, vendorCode, cause); + } + + private static final long serialVersionUID = -1843832610477496053L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTimeoutException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTimeoutException.java new file mode 100644 index 0000000000..57abd3be18 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTimeoutException.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + *

The subclass of {@link SQLException} thrown when the timeout specified by Statement + * has expired. + *

This exception does not correspond to a standard SQLState. + * + * @since 1.6 + */ + +public class SQLTimeoutException extends SQLTransientException { + /** + * Constructs a SQLTimeoutException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLTimeoutException() { + super(); + } + + /** + * Constructs a SQLTimeoutException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLTimeoutException(String reason) { + super(reason); + } + + /** + * Constructs a SQLTimeoutException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLTimeoutException(String reason, String SQLState) { + super(reason, SQLState); + } + + /** + * Constructs a SQLTimeoutException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLTimeoutException(String reason, String SQLState, int vendorCode) { + super(reason, SQLState, vendorCode); + } + + /** + * Constructs a SQLTimeoutException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTimeoutException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLTimeoutException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTimeoutException(String reason, Throwable cause) { + super(reason, cause); + } + + /** + * Constructs a SQLTimeoutException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTimeoutException(String reason, String SQLState, Throwable cause) { + super(reason, SQLState, cause); + } + + /** + * Constructs a SQLTimeoutException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTimeoutException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason, SQLState, vendorCode, cause); + } + + private static final long serialVersionUID = -4487171280562520262L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransactionRollbackException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransactionRollbackException.java new file mode 100644 index 0000000000..90eb702994 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransactionRollbackException.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} thrown when the SQLState class value + * is '40', or under vendor-specified conditions. This indicates that the + * current statement was automatically rolled back by the database because + * of deadlock or other transaction serialization failures. + *

+ * Please consult your driver vendor documentation for the vendor-specified + * conditions for which this Exception may be thrown. + * @since 1.6 + */ +public class SQLTransactionRollbackException extends SQLTransientException { + /** + * Constructs a SQLTransactionRollbackException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLTransactionRollbackException() { + super(); + } + + /** + * Constructs a SQLTransactionRollbackException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLTransactionRollbackException(String reason) { + super(reason); + } + + /** + * Constructs a SQLTransactionRollbackException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLTransactionRollbackException(String reason, String SQLState) { + super(reason, SQLState); + } + + /** + * Constructs a SQLTransactionRollbackException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLTransactionRollbackException(String reason, String SQLState, int vendorCode) { + super(reason, SQLState, vendorCode); + } + + /** + * Constructs a SQLTransactionRollbackException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransactionRollbackException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLTransactionRollbackException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransactionRollbackException(String reason, Throwable cause) { + super(reason, cause); + } + + /** + * Constructs a SQLTransactionRollbackException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransactionRollbackException(String reason, String SQLState, Throwable cause) { + super(reason, SQLState, cause); + } + + /** + * Constructs a SQLTransactionRollbackException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransactionRollbackException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason, SQLState, vendorCode, cause); + } + + private static final long serialVersionUID = 5246680841170837229L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransientConnectionException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransientConnectionException.java new file mode 100644 index 0000000000..cebc67d67d --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransientConnectionException.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} for the SQLState class + * value '08', or under vendor-specified conditions. This indicates + * that the connection operation that failed might be able to succeed if + * the operation is retried without any application-level changes. + *

+ * Please consult your driver vendor documentation for the vendor-specified + * conditions for which this Exception may be thrown. + * @since 1.6 + */ +public class SQLTransientConnectionException extends java.sql.SQLTransientException { + + /** + * Constructs a SQLTransientConnectionException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLTransientConnectionException() { + super(); + } + + /** + * Constructs a SQLTransientConnectionException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLTransientConnectionException(String reason) { + super(reason); + } + + /** + * Constructs a SQLTransientConnectionException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLTransientConnectionException(String reason, String SQLState) { + super(reason,SQLState); + } + + /** + * Constructs a SQLTransientConnectionException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLTransientConnectionException(String reason, String SQLState, int vendorCode) { + super(reason,SQLState,vendorCode); + } + + /** + * Constructs a SQLTransientConnectionException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransientConnectionException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLTransientConnectionException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException(which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransientConnectionException(String reason, Throwable cause) { + super(reason,cause); + } + + /** + * Constructs a SQLTransientConnectionException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransientConnectionException(String reason, String SQLState, Throwable cause) { + super(reason,SQLState,cause); + } + + /** + * Constructs a SQLTransientConnectionException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransientConnectionException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason,SQLState,vendorCode,cause); + } + + private static final long serialVersionUID = -2520155553543391200L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransientException.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransientException.java new file mode 100644 index 0000000000..644be1b276 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLTransientException.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The subclass of {@link SQLException} is thrown in situations where a + * previoulsy failed operation might be able to succeed when the operation is + * retried without any intervention by application-level functionality. + *

+ * + * @since 1.6 + */ +public class SQLTransientException extends java.sql.SQLException { + + /** + * Constructs a SQLTransientException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @since 1.6 + */ + public SQLTransientException() { + super(); + } + + /** + * Constructs a SQLTransientException object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @since 1.6 + */ + public SQLTransientException(String reason) { + super(reason); + } + + /** + * Constructs a SQLTransientException object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @since 1.6 + */ + public SQLTransientException(String reason, String SQLState) { + super(reason,SQLState); + } + + /** + * Constructs a SQLTransientException object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor specific exception code + * @since 1.6 + */ + public SQLTransientException(String reason, String SQLState, int vendorCode) { + super(reason,SQLState,vendorCode); + } + + /** + * Constructs a SQLTransientException object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransientException(Throwable cause) { + super(cause); + } + + /** + * Constructs a SQLTransientException object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransientException(String reason, Throwable cause) { + super(reason,cause); + } + + /** + * Constructs a SQLTransientException object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransientException(String reason, String SQLState, Throwable cause) { + super(reason,SQLState,cause); + } + + /** + * Constructs a SQLTransientException object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLTransientException(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason,SQLState,vendorCode,cause); + } + + private static final long serialVersionUID = -9042733978262274539L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLWarning.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLWarning.java new file mode 100644 index 0000000000..3c88ba011c --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLWarning.java @@ -0,0 +1,217 @@ +/* + * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + *

An exception that provides information on database access + * warnings. Warnings are silently chained to the object whose method + * caused it to be reported. + *

+ * Warnings may be retrieved from Connection, Statement, + * and ResultSet objects. Trying to retrieve a warning on a + * connection after it has been closed will cause an exception to be thrown. + * Similarly, trying to retrieve a warning on a statement after it has been + * closed or on a result set after it has been closed will cause + * an exception to be thrown. Note that closing a statement also + * closes a result set that it might have produced. + * + * @see Connection#getWarnings + * @see Statement#getWarnings + * @see ResultSet#getWarnings + */ +public class SQLWarning extends SQLException { + + /** + * Constructs a SQLWarning object + * with a given reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the warning + * @param SQLState an XOPEN or SQL:2003 code identifying the warning + * @param vendorCode a database vendor-specific warning code + */ + public SQLWarning(String reason, String SQLState, int vendorCode) { + super(reason, SQLState, vendorCode); + DriverManager.println("SQLWarning: reason(" + reason + + ") SQLState(" + SQLState + + ") vendor code(" + vendorCode + ")"); + } + + + /** + * Constructs a SQLWarning object + * with a given reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the warning + * @param SQLState an XOPEN or SQL:2003 code identifying the warning + */ + public SQLWarning(String reason, String SQLState) { + super(reason, SQLState); + DriverManager.println("SQLWarning: reason(" + reason + + ") SQLState(" + SQLState + ")"); + } + + /** + * Constructs a SQLWarning object + * with a given reason. The SQLState + * is initialized to null and the vender code is initialized + * to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the warning + */ + public SQLWarning(String reason) { + super(reason); + DriverManager.println("SQLWarning: reason(" + reason + ")"); + } + + /** + * Constructs a SQLWarning object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ */ + public SQLWarning() { + super(); + DriverManager.println("SQLWarning: "); + } + + /** + * Constructs a SQLWarning object + * with a given cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLWarning (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + */ + public SQLWarning(Throwable cause) { + super(cause); + DriverManager.println("SQLWarning"); + } + + /** + * Constructs a SQLWarning object + * with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the warning + * @param cause the underlying reason for this SQLWarning + * (which is saved for later retrieval by the getCause() method); + * may be null indicating the cause is non-existent or unknown. + */ + public SQLWarning(String reason, Throwable cause) { + super(reason,cause); + DriverManager.println("SQLWarning : reason("+ reason + ")"); + } + + /** + * Constructs a SQLWarning object + * with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the warning + * @param SQLState an XOPEN or SQL:2003 code identifying the warning + * @param cause the underlying reason for this SQLWarning (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + */ + public SQLWarning(String reason, String SQLState, Throwable cause) { + super(reason,SQLState,cause); + DriverManager.println("SQLWarning: reason(" + reason + + ") SQLState(" + SQLState + ")"); + } + + /** + * Constructs aSQLWarning object + * with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the warning + * @param SQLState an XOPEN or SQL:2003 code identifying the warning + * @param vendorCode a database vendor-specific warning code + * @param cause the underlying reason for this SQLWarning (which is saved for later retrieval by the getCause() method); may be null indicating + * the cause is non-existent or unknown. + */ + public SQLWarning(String reason, String SQLState, int vendorCode, Throwable cause) { + super(reason,SQLState,vendorCode,cause); + DriverManager.println("SQLWarning: reason(" + reason + + ") SQLState(" + SQLState + + ") vendor code(" + vendorCode + ")"); + + } + /** + * Retrieves the warning chained to this SQLWarning object by + * setNextWarning. + * + * @return the next SQLException in the chain; null if none + * @see #setNextWarning + */ + public SQLWarning getNextWarning() { + try { + return ((SQLWarning)getNextException()); + } catch (ClassCastException ex) { + // The chained value isn't a SQLWarning. + // This is a programming error by whoever added it to + // the SQLWarning chain. We throw a Java "Error". + throw new Error("SQLWarning chain holds value that is not a SQLWarning"); + } + } + + /** + * Adds a SQLWarning object to the end of the chain. + * + * @param w the new end of the SQLException chain + * @see #getNextWarning + */ + public void setNextWarning(SQLWarning w) { + setNextException(w); + } + + private static final long serialVersionUID = 3917336774604784856L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLXML.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLXML.java new file mode 100644 index 0000000000..88e3baada7 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/SQLXML.java @@ -0,0 +1,425 @@ +/* + * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; + +/** + * The mapping in the JavaTM programming language for the SQL XML type. + * XML is a built-in type that stores an XML value + * as a column value in a row of a database table. + * By default drivers implement an SQLXML object as + * a logical pointer to the XML data + * rather than the data itself. + * An SQLXML object is valid for the duration of the transaction in which it was created. + *

+ * The SQLXML interface provides methods for accessing the XML value + * as a String, a Reader or Writer, or as a Stream. The XML value + * may also be accessed through a Source or set as a Result, which + * are used with XML Parser APIs such as DOM, SAX, and StAX, as + * well as with XSLT transforms and XPath evaluations. + *

+ * Methods in the interfaces ResultSet, CallableStatement, and PreparedStatement, + * such as getSQLXML allow a programmer to access an XML value. + * In addition, this interface has methods for updating an XML value. + *

+ * The XML value of the SQLXML instance may be obtained as a BinaryStream using + *

+ *   SQLXML sqlxml = resultSet.getSQLXML(column);
+ *   InputStream binaryStream = sqlxml.getBinaryStream();
+ * 
+ * For example, to parse an XML value with a DOM parser: + *
+ *   DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ *   Document result = parser.parse(binaryStream);
+ * 
+ * or to parse an XML value with a SAX parser to your handler: + *
+ *   SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+ *   parser.parse(binaryStream, myHandler);
+ * 
+ * or to parse an XML value with a StAX parser: + *
+ *   XMLInputFactory factory = XMLInputFactory.newInstance();
+ *   XMLStreamReader streamReader = factory.createXMLStreamReader(binaryStream);
+ * 
+ *

+ * Because databases may use an optimized representation for the XML, + * accessing the value through getSource() and + * setResult() can lead to improved processing performance + * without serializing to a stream representation and parsing the XML. + *

+ * For example, to obtain a DOM Document Node: + *

+ *   DOMSource domSource = sqlxml.getSource(DOMSource.class);
+ *   Document document = (Document) domSource.getNode();
+ * 
+ * or to set the value to a DOM Document Node to myNode: + *
+ *   DOMResult domResult = sqlxml.setResult(DOMResult.class);
+ *   domResult.setNode(myNode);
+ * 
+ * or, to send SAX events to your handler: + *
+ *   SAXSource saxSource = sqlxml.getSource(SAXSource.class);
+ *   XMLReader xmlReader = saxSource.getXMLReader();
+ *   xmlReader.setContentHandler(myHandler);
+ *   xmlReader.parse(saxSource.getInputSource());
+ * 
+ * or, to set the result value from SAX events: + *
+ *   SAXResult saxResult = sqlxml.setResult(SAXResult.class);
+ *   ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
+ *   contentHandler.startDocument();
+ *   // set the XML elements and attributes into the result
+ *   contentHandler.endDocument();
+ * 
+ * or, to obtain StAX events: + *
+ *   StAXSource staxSource = sqlxml.getSource(StAXSource.class);
+ *   XMLStreamReader streamReader = staxSource.getXMLStreamReader();
+ * 
+ * or, to set the result value from StAX events: + *
+ *   StAXResult staxResult = sqlxml.setResult(StAXResult.class);
+ *   XMLStreamWriter streamWriter = staxResult.getXMLStreamWriter();
+ * 
+ * or, to perform XSLT transformations on the XML value using the XSLT in xsltFile + * output to file resultFile: + *
+ *   File xsltFile = new File("a.xslt");
+ *   File myFile = new File("result.xml");
+ *   Transformer xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
+ *   Source source = sqlxml.getSource(null);
+ *   Result result = new StreamResult(myFile);
+ *   xslt.transform(source, result);
+ * 
+ * or, to evaluate an XPath expression on the XML value: + *
+ *   XPath xpath = XPathFactory.newInstance().newXPath();
+ *   DOMSource domSource = sqlxml.getSource(DOMSource.class);
+ *   Document document = (Document) domSource.getNode();
+ *   String expression = "/foo/@bar";
+ *   String barValue = xpath.evaluate(expression, document);
+ * 
+ * To set the XML value to be the result of an XSLT transform: + *
+ *   File sourceFile = new File("source.xml");
+ *   Transformer xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
+ *   Source streamSource = new StreamSource(sourceFile);
+ *   Result result = sqlxml.setResult(null);
+ *   xslt.transform(streamSource, result);
+ * 
+ * Any Source can be transformed to a Result using the identity transform + * specified by calling newTransformer(): + *
+ *   Transformer identity = TransformerFactory.newInstance().newTransformer();
+ *   Source source = sqlxml.getSource(null);
+ *   File myFile = new File("result.xml");
+ *   Result result = new StreamResult(myFile);
+ *   identity.transform(source, result);
+ * 
+ * To write the contents of a Source to standard output: + *
+ *   Transformer identity = TransformerFactory.newInstance().newTransformer();
+ *   Source source = sqlxml.getSource(null);
+ *   Result result = new StreamResult(System.out);
+ *   identity.transform(source, result);
+ * 
+ * To create a DOMSource from a DOMResult: + *
+ *    DOMSource domSource = new DOMSource(domResult.getNode());
+ * 
+ *

+ * Incomplete or invalid XML values may cause an SQLException when + * set or the exception may occur when execute() occurs. All streams + * must be closed before execute() occurs or an SQLException will be thrown. + *

+ * Reading and writing XML values to or from an SQLXML object can happen at most once. + * The conceptual states of readable and not readable determine if one + * of the reading APIs will return a value or throw an exception. + * The conceptual states of writable and not writable determine if one + * of the writing APIs will set a value or throw an exception. + *

+ * The state moves from readable to not readable once free() or any of the + * reading APIs are called: getBinaryStream(), getCharacterStream(), getSource(), and getString(). + * Implementations may also change the state to not writable when this occurs. + *

+ * The state moves from writable to not writeable once free() or any of the + * writing APIs are called: setBinaryStream(), setCharacterStream(), setResult(), and setString(). + * Implementations may also change the state to not readable when this occurs. + *

+ *

+ * All methods on the SQLXML interface must be fully implemented if the + * JDBC driver supports the data type. + * + * @see javax.xml.parsers + * @see javax.xml.stream + * @see javax.xml.transform + * @see javax.xml.xpath + * @since 1.6 + */ +public interface SQLXML +{ + /** + * This method closes this object and releases the resources that it held. + * The SQL XML object becomes invalid and neither readable or writeable + * when this method is called. + * + * After free has been called, any attempt to invoke a + * method other than free will result in a SQLException + * being thrown. If free is called multiple times, the subsequent + * calls to free are treated as a no-op. + * @throws SQLException if there is an error freeing the XML value. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void free() throws SQLException; + + /** + * Retrieves the XML value designated by this SQLXML instance as a stream. + * The bytes of the input stream are interpreted according to appendix F of the XML 1.0 specification. + * The behavior of this method is the same as ResultSet.getBinaryStream() + * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. + *

+ * The SQL XML object becomes not readable when this method is called and + * may also become not writable depending on implementation. + * + * @return a stream containing the XML data. + * @throws SQLException if there is an error processing the XML value. + * An exception is thrown if the state is not readable. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + InputStream getBinaryStream() throws SQLException; + + /** + * Retrieves a stream that can be used to write the XML value that this SQLXML instance represents. + * The stream begins at position 0. + * The bytes of the stream are interpreted according to appendix F of the XML 1.0 specification + * The behavior of this method is the same as ResultSet.updateBinaryStream() + * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. + *

+ * The SQL XML object becomes not writeable when this method is called and + * may also become not readable depending on implementation. + * + * @return a stream to which data can be written. + * @throws SQLException if there is an error processing the XML value. + * An exception is thrown if the state is not writable. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + OutputStream setBinaryStream() throws SQLException; + + /** + * Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object. + * The format of this stream is defined by org.xml.sax.InputSource, + * where the characters in the stream represent the unicode code points for + * XML according to section 2 and appendix B of the XML 1.0 specification. + * Although an encoding declaration other than unicode may be present, + * the encoding of the stream is unicode. + * The behavior of this method is the same as ResultSet.getCharacterStream() + * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. + *

+ * The SQL XML object becomes not readable when this method is called and + * may also become not writable depending on implementation. + * + * @return a stream containing the XML data. + * @throws SQLException if there is an error processing the XML value. + * The getCause() method of the exception may provide a more detailed exception, for example, + * if the stream does not contain valid characters. + * An exception is thrown if the state is not readable. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + Reader getCharacterStream() throws SQLException; + + /** + * Retrieves a stream to be used to write the XML value that this SQLXML instance represents. + * The format of this stream is defined by org.xml.sax.InputSource, + * where the characters in the stream represent the unicode code points for + * XML according to section 2 and appendix B of the XML 1.0 specification. + * Although an encoding declaration other than unicode may be present, + * the encoding of the stream is unicode. + * The behavior of this method is the same as ResultSet.updateCharacterStream() + * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. + *

+ * The SQL XML object becomes not writeable when this method is called and + * may also become not readable depending on implementation. + * + * @return a stream to which data can be written. + * @throws SQLException if there is an error processing the XML value. + * The getCause() method of the exception may provide a more detailed exception, for example, + * if the stream does not contain valid characters. + * An exception is thrown if the state is not writable. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + Writer setCharacterStream() throws SQLException; + + /** + * Returns a string representation of the XML value designated by this SQLXML instance. + * The format of this String is defined by org.xml.sax.InputSource, + * where the characters in the stream represent the unicode code points for + * XML according to section 2 and appendix B of the XML 1.0 specification. + * Although an encoding declaration other than unicode may be present, + * the encoding of the String is unicode. + * The behavior of this method is the same as ResultSet.getString() + * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. + *

+ * The SQL XML object becomes not readable when this method is called and + * may also become not writable depending on implementation. + * + * @return a string representation of the XML value designated by this SQLXML instance. + * @throws SQLException if there is an error processing the XML value. + * The getCause() method of the exception may provide a more detailed exception, for example, + * if the stream does not contain valid characters. + * An exception is thrown if the state is not readable. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + String getString() throws SQLException; + + /** + * Sets the XML value designated by this SQLXML instance to the given String representation. + * The format of this String is defined by org.xml.sax.InputSource, + * where the characters in the stream represent the unicode code points for + * XML according to section 2 and appendix B of the XML 1.0 specification. + * Although an encoding declaration other than unicode may be present, + * the encoding of the String is unicode. + * The behavior of this method is the same as ResultSet.updateString() + * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. + *

+ * The SQL XML object becomes not writeable when this method is called and + * may also become not readable depending on implementation. + * + * @param value the XML value + * @throws SQLException if there is an error processing the XML value. + * The getCause() method of the exception may provide a more detailed exception, for example, + * if the stream does not contain valid characters. + * An exception is thrown if the state is not writable. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + void setString(String value) throws SQLException; + + /** + * Returns a Source for reading the XML value designated by this SQLXML instance. + * Sources are used as inputs to XML parsers and XSLT transformers. + *

+ * Sources for XML parsers will have namespace processing on by default. + * The systemID of the Source is implementation dependent. + *

+ * The SQL XML object becomes not readable when this method is called and + * may also become not writable depending on implementation. + *

+ * Note that SAX is a callback architecture, so a returned + * SAXSource should then be set with a content handler that will + * receive the SAX events from parsing. The content handler + * will receive callbacks based on the contents of the XML. + *

+   *   SAXSource saxSource = sqlxml.getSource(SAXSource.class);
+   *   XMLReader xmlReader = saxSource.getXMLReader();
+   *   xmlReader.setContentHandler(myHandler);
+   *   xmlReader.parse(saxSource.getInputSource());
+   * 
+ * + * @param sourceClass The class of the source, or null. + * If the class is null, a vendor specifc Source implementation will be returned. + * The following classes are supported at a minimum: + *
+   *   javax.xml.transform.dom.DOMSource - returns a DOMSource
+   *   javax.xml.transform.sax.SAXSource - returns a SAXSource
+   *   javax.xml.transform.stax.StAXSource - returns a StAXSource
+   *   javax.xml.transform.stream.StreamSource - returns a StreamSource
+   * 
+ * @return a Source for reading the XML value. + * @throws SQLException if there is an error processing the XML value + * or if this feature is not supported. + * The getCause() method of the exception may provide a more detailed exception, for example, + * if an XML parser exception occurs. + * An exception is thrown if the state is not readable. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + T getSource(Class sourceClass) throws SQLException; + + /** + * Returns a Result for setting the XML value designated by this SQLXML instance. + *

+ * The systemID of the Result is implementation dependent. + *

+ * The SQL XML object becomes not writeable when this method is called and + * may also become not readable depending on implementation. + *

+ * Note that SAX is a callback architecture and the returned + * SAXResult has a content handler assigned that will receive the + * SAX events based on the contents of the XML. Call the content + * handler with the contents of the XML document to assign the values. + *

+   *   SAXResult saxResult = sqlxml.setResult(SAXResult.class);
+   *   ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
+   *   contentHandler.startDocument();
+   *   // set the XML elements and attributes into the result
+   *   contentHandler.endDocument();
+   * 
+ * + * @param resultClass The class of the result, or null. + * If resultClass is null, a vendor specific Result implementation will be returned. + * The following classes are supported at a minimum: + *
+   *   javax.xml.transform.dom.DOMResult - returns a DOMResult
+   *   javax.xml.transform.sax.SAXResult - returns a SAXResult
+   *   javax.xml.transform.stax.StAXResult - returns a StAXResult
+   *   javax.xml.transform.stream.StreamResult - returns a StreamResult
+   * 
+ * @return Returns a Result for setting the XML value. + * @throws SQLException if there is an error processing the XML value + * or if this feature is not supported. + * The getCause() method of the exception may provide a more detailed exception, for example, + * if an XML parser exception occurs. + * An exception is thrown if the state is not writable. + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.6 + */ + T setResult(Class resultClass) throws SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Savepoint.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Savepoint.java new file mode 100644 index 0000000000..07d1ae1580 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Savepoint.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * The representation of a savepoint, which is a point within + * the current transaction that can be referenced from the + * Connection.rollback method. When a transaction + * is rolled back to a savepoint all changes made after that + * savepoint are undone. + *

+ * Savepoints can be either named or unnamed. Unnamed savepoints + * are identified by an ID generated by the underlying data source. + * + * @since 1.4 + */ + +public interface Savepoint { + + /** + * Retrieves the generated ID for the savepoint that this + * Savepoint object represents. + * @return the numeric ID of this savepoint + * @exception SQLException if this is a named savepoint + * @since 1.4 + */ + int getSavepointId() throws SQLException; + + /** + * Retrieves the name of the savepoint that this Savepoint + * object represents. + * @return the name of this savepoint + * @exception SQLException if this is an un-named savepoint + * @since 1.4 + */ + String getSavepointName() throws SQLException; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Statement.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Statement.java new file mode 100644 index 0000000000..40cd97cd00 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Statement.java @@ -0,0 +1,1033 @@ +/* + * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + *

The object used for executing a static SQL statement + * and returning the results it produces. + *

+ * By default, only one ResultSet object per Statement + * object can be open at the same time. Therefore, if the reading of one + * ResultSet object is interleaved + * with the reading of another, each must have been generated by + * different Statement objects. All execution methods in the + * Statement interface implicitly close a statment's current + * ResultSet object if an open one exists. + * + * @see Connection#createStatement + * @see ResultSet + */ +public interface Statement extends Wrapper, AutoCloseable { + + /** + * Executes the given SQL statement, which returns a single + * ResultSet object. + *

+ * Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql an SQL statement to be sent to the database, typically a + * static SQL SELECT statement + * @return a ResultSet object that contains the data produced + * by the given query; never null + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, the given + * SQL statement produces anything other than a single + * ResultSet object, the method is called on a + * PreparedStatement or CallableStatement + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + */ + ResultSet executeQuery(String sql) throws SQLException; + + /** + * Executes the given SQL statement, which may be an INSERT, + * UPDATE, or DELETE statement or an + * SQL statement that returns nothing, such as an SQL DDL statement. + *

+ * Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or + * DELETE; or an SQL statement that returns nothing, + * such as a DDL statement. + * + * @return either (1) the row count for SQL Data Manipulation Language (DML) statements + * or (2) 0 for SQL statements that return nothing + * + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, the given + * SQL statement produces a ResultSet object, the method is called on a + * PreparedStatement or CallableStatement + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + */ + int executeUpdate(String sql) throws SQLException; + + /** + * Releases this Statement object's database + * and JDBC resources immediately instead of waiting for + * this to happen when it is automatically closed. + * It is generally good practice to release resources as soon as + * you are finished with them to avoid tying up database + * resources. + *

+ * Calling the method close on a Statement + * object that is already closed has no effect. + *

+ * Note:When a Statement object is + * closed, its current ResultSet object, if one exists, is + * also closed. + * + * @exception SQLException if a database access error occurs + */ + void close() throws SQLException; + + //---------------------------------------------------------------------- + + /** + * Retrieves the maximum number of bytes that can be + * returned for character and binary column values in a ResultSet + * object produced by this Statement object. + * This limit applies only to BINARY, VARBINARY, + * LONGVARBINARY, CHAR, VARCHAR, + * NCHAR, NVARCHAR, LONGNVARCHAR + * and LONGVARCHAR columns. If the limit is exceeded, the + * excess data is silently discarded. + * + * @return the current column size limit for columns storing character and + * binary values; zero means there is no limit + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @see #setMaxFieldSize + */ + int getMaxFieldSize() throws SQLException; + + /** + * Sets the limit for the maximum number of bytes that can be returned for + * character and binary column values in a ResultSet + * object produced by this Statement object. + * + * This limit applies + * only to BINARY, VARBINARY, + * LONGVARBINARY, CHAR, VARCHAR, + * NCHAR, NVARCHAR, LONGNVARCHAR and + * LONGVARCHAR fields. If the limit is exceeded, the excess data + * is silently discarded. For maximum portability, use values + * greater than 256. + * + * @param max the new column size limit in bytes; zero means there is no limit + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement + * or the condition max >= 0 is not satisfied + * @see #getMaxFieldSize + */ + void setMaxFieldSize(int max) throws SQLException; + + /** + * Retrieves the maximum number of rows that a + * ResultSet object produced by this + * Statement object can contain. If this limit is exceeded, + * the excess rows are silently dropped. + * + * @return the current maximum number of rows for a ResultSet + * object produced by this Statement object; + * zero means there is no limit + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @see #setMaxRows + */ + int getMaxRows() throws SQLException; + + /** + * Sets the limit for the maximum number of rows that any + * ResultSet object generated by this Statement + * object can contain to the given number. + * If the limit is exceeded, the excess + * rows are silently dropped. + * + * @param max the new max rows limit; zero means there is no limit + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement + * or the condition max >= 0 is not satisfied + * @see #getMaxRows + */ + void setMaxRows(int max) throws SQLException; + + /** + * Sets escape processing on or off. + * If escape scanning is on (the default), the driver will do + * escape substitution before sending the SQL statement to the database. + * + * Note: Since prepared statements have usually been parsed prior + * to making this call, disabling escape processing for + * PreparedStatements objects will have no effect. + * + * @param enable true to enable escape processing; + * false to disable it + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + */ + void setEscapeProcessing(boolean enable) throws SQLException; + + /** + * Retrieves the number of seconds the driver will + * wait for a Statement object to execute. + * If the limit is exceeded, a + * SQLException is thrown. + * + * @return the current query timeout limit in seconds; zero means there is + * no limit + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @see #setQueryTimeout + */ + int getQueryTimeout() throws SQLException; + + /** + * Sets the number of seconds the driver will wait for a + * Statement object to execute to the given number of seconds. + *By default there is no limit on the amount of time allowed for a running + * statement to complete. If the limit is exceeded, an + * SQLTimeoutException is thrown. + * A JDBC driver must apply this limit to the execute, + * executeQuery and executeUpdate methods. + *

+ * Note: JDBC driver implementations may also apply this + * limit to {@code ResultSet} methods + * (consult your driver vendor documentation for details). + *

+ * Note: In the case of {@code Statement} batching, it is + * implementation defined as to whether the time-out is applied to + * individual SQL commands added via the {@code addBatch} method or to + * the entire batch of SQL commands invoked by the {@code executeBatch} + * method (consult your driver vendor documentation for details). + * + * @param seconds the new query timeout limit in seconds; zero means + * there is no limit + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement + * or the condition seconds >= 0 is not satisfied + * @see #getQueryTimeout + */ + void setQueryTimeout(int seconds) throws SQLException; + + /** + * Cancels this Statement object if both the DBMS and + * driver support aborting an SQL statement. + * This method can be used by one thread to cancel a statement that + * is being executed by another thread. + * + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + */ + void cancel() throws SQLException; + + /** + * Retrieves the first warning reported by calls on this Statement object. + * Subsequent Statement object warnings will be chained to this + * SQLWarning object. + * + *

The warning chain is automatically cleared each time + * a statement is (re)executed. This method may not be called on a closed + * Statement object; doing so will cause an SQLException + * to be thrown. + * + *

Note: If you are processing a ResultSet object, any + * warnings associated with reads on that ResultSet object + * will be chained on it rather than on the Statement + * object that produced it. + * + * @return the first SQLWarning object or null + * if there are no warnings + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + */ + SQLWarning getWarnings() throws SQLException; + + /** + * Clears all the warnings reported on this Statement + * object. After a call to this method, + * the method getWarnings will return + * null until a new warning is reported for this + * Statement object. + * + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + */ + void clearWarnings() throws SQLException; + + /** + * Sets the SQL cursor name to the given String, which + * will be used by subsequent Statement object + * execute methods. This name can then be + * used in SQL positioned update or delete statements to identify the + * current row in the ResultSet object generated by this + * statement. If the database does not support positioned update/delete, + * this method is a noop. To insure that a cursor has the proper isolation + * level to support updates, the cursor's SELECT statement + * should have the form SELECT FOR UPDATE. If + * FOR UPDATE is not present, positioned updates may fail. + * + *

Note: By definition, the execution of positioned updates and + * deletes must be done by a different Statement object than + * the one that generated the ResultSet object being used for + * positioning. Also, cursor names must be unique within a connection. + * + * @param name the new cursor name, which must be unique within + * a connection + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + */ + void setCursorName(String name) throws SQLException; + + //----------------------- Multiple Results -------------------------- + + /** + * Executes the given SQL statement, which may return multiple results. + * In some (uncommon) situations, a single SQL statement may return + * multiple result sets and/or update counts. Normally you can ignore + * this unless you are (1) executing a stored procedure that you know may + * return multiple results or (2) you are dynamically executing an + * unknown SQL string. + *

+ * The execute method executes an SQL statement and indicates the + * form of the first result. You must then use the methods + * getResultSet or getUpdateCount + * to retrieve the result, and getMoreResults to + * move to any subsequent result(s). + *

+ *Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql any SQL statement + * @return true if the first result is a ResultSet + * object; false if it is an update count or there are + * no results + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, + * the method is called on a + * PreparedStatement or CallableStatement + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * @see #getResultSet + * @see #getUpdateCount + * @see #getMoreResults + */ + boolean execute(String sql) throws SQLException; + + /** + * Retrieves the current result as a ResultSet object. + * This method should be called only once per result. + * + * @return the current result as a ResultSet object or + * null if the result is an update count or there are no more results + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @see #execute + */ + ResultSet getResultSet() throws SQLException; + + /** + * Retrieves the current result as an update count; + * if the result is a ResultSet object or there are no more results, -1 + * is returned. This method should be called only once per result. + * + * @return the current result as an update count; -1 if the current result is a + * ResultSet object or there are no more results + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @see #execute + */ + int getUpdateCount() throws SQLException; + + /** + * Moves to this Statement object's next result, returns + * true if it is a ResultSet object, and + * implicitly closes any current ResultSet + * object(s) obtained with the method getResultSet. + * + *

There are no more results when the following is true: + *

+     *     // stmt is a Statement object
+     *     ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
+     * 
+ * + * @return true if the next result is a ResultSet + * object; false if it is an update count or there are + * no more results + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @see #execute + */ + boolean getMoreResults() throws SQLException; + + + //--------------------------JDBC 2.0----------------------------- + + + /** + * Gives the driver a hint as to the direction in which + * rows will be processed in ResultSet + * objects created using this Statement object. The + * default value is ResultSet.FETCH_FORWARD. + *

+ * Note that this method sets the default fetch direction for + * result sets generated by this Statement object. + * Each result set has its own methods for getting and setting + * its own fetch direction. + * + * @param direction the initial direction for processing rows + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement + * or the given direction + * is not one of ResultSet.FETCH_FORWARD, + * ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN + * @since 1.2 + * @see #getFetchDirection + */ + void setFetchDirection(int direction) throws SQLException; + + /** + * Retrieves the direction for fetching rows from + * database tables that is the default for result sets + * generated from this Statement object. + * If this Statement object has not set + * a fetch direction by calling the method setFetchDirection, + * the return value is implementation-specific. + * + * @return the default fetch direction for result sets generated + * from this Statement object + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @since 1.2 + * @see #setFetchDirection + */ + int getFetchDirection() throws SQLException; + + /** + * Gives the JDBC driver a hint as to the number of rows that should + * be fetched from the database when more rows are needed for + * ResultSet objects genrated by this Statement. + * If the value specified is zero, then the hint is ignored. + * The default value is zero. + * + * @param rows the number of rows to fetch + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement or the + * condition rows >= 0 is not satisfied. + * @since 1.2 + * @see #getFetchSize + */ + void setFetchSize(int rows) throws SQLException; + + /** + * Retrieves the number of result set rows that is the default + * fetch size for ResultSet objects + * generated from this Statement object. + * If this Statement object has not set + * a fetch size by calling the method setFetchSize, + * the return value is implementation-specific. + * + * @return the default fetch size for result sets generated + * from this Statement object + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @since 1.2 + * @see #setFetchSize + */ + int getFetchSize() throws SQLException; + + /** + * Retrieves the result set concurrency for ResultSet objects + * generated by this Statement object. + * + * @return either ResultSet.CONCUR_READ_ONLY or + * ResultSet.CONCUR_UPDATABLE + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @since 1.2 + */ + int getResultSetConcurrency() throws SQLException; + + /** + * Retrieves the result set type for ResultSet objects + * generated by this Statement object. + * + * @return one of ResultSet.TYPE_FORWARD_ONLY, + * ResultSet.TYPE_SCROLL_INSENSITIVE, or + * ResultSet.TYPE_SCROLL_SENSITIVE + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @since 1.2 + */ + int getResultSetType() throws SQLException; + + /** + * Adds the given SQL command to the current list of commmands for this + * Statement object. The commands in this list can be + * executed as a batch by calling the method executeBatch. + *

+ *Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql typically this is a SQL INSERT or + * UPDATE statement + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, the + * driver does not support batch updates, the method is called on a + * PreparedStatement or CallableStatement + * @see #executeBatch + * @see DatabaseMetaData#supportsBatchUpdates + * @since 1.2 + */ + void addBatch( String sql ) throws SQLException; + + /** + * Empties this Statement object's current list of + * SQL commands. + *

+ * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement or the + * driver does not support batch updates + * @see #addBatch + * @see DatabaseMetaData#supportsBatchUpdates + * @since 1.2 + */ + void clearBatch() throws SQLException; + + /** + * Submits a batch of commands to the database for execution and + * if all commands execute successfully, returns an array of update counts. + * The int elements of the array that is returned are ordered + * to correspond to the commands in the batch, which are ordered + * according to the order in which they were added to the batch. + * The elements in the array returned by the method executeBatch + * may be one of the following: + *

    + *
  1. A number greater than or equal to zero -- indicates that the + * command was processed successfully and is an update count giving the + * number of rows in the database that were affected by the command's + * execution + *
  2. A value of SUCCESS_NO_INFO -- indicates that the command was + * processed successfully but that the number of rows affected is + * unknown + *

    + * If one of the commands in a batch update fails to execute properly, + * this method throws a BatchUpdateException, and a JDBC + * driver may or may not continue to process the remaining commands in + * the batch. However, the driver's behavior must be consistent with a + * particular DBMS, either always continuing to process commands or never + * continuing to process commands. If the driver continues processing + * after a failure, the array returned by the method + * BatchUpdateException.getUpdateCounts + * will contain as many elements as there are commands in the batch, and + * at least one of the elements will be the following: + *

    + *

  3. A value of EXECUTE_FAILED -- indicates that the command failed + * to execute successfully and occurs only if a driver continues to + * process commands after a command fails + *
+ *

+ * The possible implementations and return values have been modified in + * the Java 2 SDK, Standard Edition, version 1.3 to + * accommodate the option of continuing to proccess commands in a batch + * update after a BatchUpdateException obejct has been thrown. + * + * @return an array of update counts containing one element for each + * command in the batch. The elements of the array are ordered according + * to the order in which commands were added to the batch. + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement or the + * driver does not support batch statements. Throws {@link BatchUpdateException} + * (a subclass of SQLException) if one of the commands sent to the + * database fails to execute properly or attempts to return a result set. + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * + * @see #addBatch + * @see DatabaseMetaData#supportsBatchUpdates + * @since 1.2 + */ + int[] executeBatch() throws SQLException; + + /** + * Retrieves the Connection object + * that produced this Statement object. + * @return the connection that produced this statement + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @since 1.2 + */ + Connection getConnection() throws SQLException; + + //--------------------------JDBC 3.0----------------------------- + + /** + * The constant indicating that the current ResultSet object + * should be closed when calling getMoreResults. + * + * @since 1.4 + */ + int CLOSE_CURRENT_RESULT = 1; + + /** + * The constant indicating that the current ResultSet object + * should not be closed when calling getMoreResults. + * + * @since 1.4 + */ + int KEEP_CURRENT_RESULT = 2; + + /** + * The constant indicating that all ResultSet objects that + * have previously been kept open should be closed when calling + * getMoreResults. + * + * @since 1.4 + */ + int CLOSE_ALL_RESULTS = 3; + + /** + * The constant indicating that a batch statement executed successfully + * but that no count of the number of rows it affected is available. + * + * @since 1.4 + */ + int SUCCESS_NO_INFO = -2; + + /** + * The constant indicating that an error occured while executing a + * batch statement. + * + * @since 1.4 + */ + int EXECUTE_FAILED = -3; + + /** + * The constant indicating that generated keys should be made + * available for retrieval. + * + * @since 1.4 + */ + int RETURN_GENERATED_KEYS = 1; + + /** + * The constant indicating that generated keys should not be made + * available for retrieval. + * + * @since 1.4 + */ + int NO_GENERATED_KEYS = 2; + + /** + * Moves to this Statement object's next result, deals with + * any current ResultSet object(s) according to the instructions + * specified by the given flag, and returns + * true if the next result is a ResultSet object. + * + *

There are no more results when the following is true: + *

+     *     // stmt is a Statement object
+     *     ((stmt.getMoreResults(current) == false) && (stmt.getUpdateCount() == -1))
+     * 
+ * + * @param current one of the following Statement + * constants indicating what should happen to current + * ResultSet objects obtained using the method + * getResultSet: + * Statement.CLOSE_CURRENT_RESULT, + * Statement.KEEP_CURRENT_RESULT, or + * Statement.CLOSE_ALL_RESULTS + * @return true if the next result is a ResultSet + * object; false if it is an update count or there are no + * more results + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement or the argument + * supplied is not one of the following: + * Statement.CLOSE_CURRENT_RESULT, + * Statement.KEEP_CURRENT_RESULT or + * Statement.CLOSE_ALL_RESULTS + *@exception SQLFeatureNotSupportedException if + * DatabaseMetaData.supportsMultipleOpenResults returns + * false and either + * Statement.KEEP_CURRENT_RESULT or + * Statement.CLOSE_ALL_RESULTS are supplied as + * the argument. + * @since 1.4 + * @see #execute + */ + boolean getMoreResults(int current) throws SQLException; + + /** + * Retrieves any auto-generated keys created as a result of executing this + * Statement object. If this Statement object did + * not generate any keys, an empty ResultSet + * object is returned. + * + *

Note:If the columns which represent the auto-generated keys were not specified, + * the JDBC driver implementation will determine the columns which best represent the auto-generated keys. + * + * @return a ResultSet object containing the auto-generated key(s) + * generated by the execution of this Statement object + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @since 1.4 + */ + ResultSet getGeneratedKeys() throws SQLException; + + /** + * Executes the given SQL statement and signals the driver with the + * given flag about whether the + * auto-generated keys produced by this Statement object + * should be made available for retrieval. The driver will ignore the + * flag if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or + * DELETE; or an SQL statement that returns nothing, + * such as a DDL statement. + * + * @param autoGeneratedKeys a flag indicating whether auto-generated keys + * should be made available for retrieval; + * one of the following constants: + * Statement.RETURN_GENERATED_KEYS + * Statement.NO_GENERATED_KEYS + * @return either (1) the row count for SQL Data Manipulation Language (DML) statements + * or (2) 0 for SQL statements that return nothing + * + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, the given + * SQL statement returns a ResultSet object, + * the given constant is not one of those allowed, the method is called on a + * PreparedStatement or CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method with a constant of Statement.RETURN_GENERATED_KEYS + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * @since 1.4 + */ + int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException; + + /** + * Executes the given SQL statement and signals the driver that the + * auto-generated keys indicated in the given array should be made available + * for retrieval. This array contains the indexes of the columns in the + * target table that contain the auto-generated keys that should be made + * available. The driver will ignore the array if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or + * DELETE; or an SQL statement that returns nothing, + * such as a DDL statement. + * + * @param columnIndexes an array of column indexes indicating the columns + * that should be returned from the inserted row + * @return either (1) the row count for SQL Data Manipulation Language (DML) statements + * or (2) 0 for SQL statements that return nothing + * + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, the SQL + * statement returns a ResultSet object,the second argument + * supplied to this method is not an + * int array whose elements are valid column indexes, the method is called on a + * PreparedStatement or CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * @since 1.4 + */ + int executeUpdate(String sql, int columnIndexes[]) throws SQLException; + + /** + * Executes the given SQL statement and signals the driver that the + * auto-generated keys indicated in the given array should be made available + * for retrieval. This array contains the names of the columns in the + * target table that contain the auto-generated keys that should be made + * available. The driver will ignore the array if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or + * DELETE; or an SQL statement that returns nothing, + * such as a DDL statement. + * @param columnNames an array of the names of the columns that should be + * returned from the inserted row + * @return either the row count for INSERT, UPDATE, + * or DELETE statements, or 0 for SQL statements + * that return nothing + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, the SQL + * statement returns a ResultSet object, the + * second argument supplied to this method is not a String array + * whose elements are valid column names, the method is called on a + * PreparedStatement or CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * @since 1.4 + */ + int executeUpdate(String sql, String columnNames[]) throws SQLException; + + /** + * Executes the given SQL statement, which may return multiple results, + * and signals the driver that any + * auto-generated keys should be made available + * for retrieval. The driver will ignore this signal if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * In some (uncommon) situations, a single SQL statement may return + * multiple result sets and/or update counts. Normally you can ignore + * this unless you are (1) executing a stored procedure that you know may + * return multiple results or (2) you are dynamically executing an + * unknown SQL string. + *

+ * The execute method executes an SQL statement and indicates the + * form of the first result. You must then use the methods + * getResultSet or getUpdateCount + * to retrieve the result, and getMoreResults to + * move to any subsequent result(s). + *

+ *Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql any SQL statement + * @param autoGeneratedKeys a constant indicating whether auto-generated + * keys should be made available for retrieval using the method + * getGeneratedKeys; one of the following constants: + * Statement.RETURN_GENERATED_KEYS or + * Statement.NO_GENERATED_KEYS + * @return true if the first result is a ResultSet + * object; false if it is an update count or there are + * no results + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, the second + * parameter supplied to this method is not + * Statement.RETURN_GENERATED_KEYS or + * Statement.NO_GENERATED_KEYS, + * the method is called on a + * PreparedStatement or CallableStatement + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method with a constant of Statement.RETURN_GENERATED_KEYS + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * @see #getResultSet + * @see #getUpdateCount + * @see #getMoreResults + * @see #getGeneratedKeys + * + * @since 1.4 + */ + boolean execute(String sql, int autoGeneratedKeys) throws SQLException; + + /** + * Executes the given SQL statement, which may return multiple results, + * and signals the driver that the + * auto-generated keys indicated in the given array should be made available + * for retrieval. This array contains the indexes of the columns in the + * target table that contain the auto-generated keys that should be made + * available. The driver will ignore the array if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * Under some (uncommon) situations, a single SQL statement may return + * multiple result sets and/or update counts. Normally you can ignore + * this unless you are (1) executing a stored procedure that you know may + * return multiple results or (2) you are dynamically executing an + * unknown SQL string. + *

+ * The execute method executes an SQL statement and indicates the + * form of the first result. You must then use the methods + * getResultSet or getUpdateCount + * to retrieve the result, and getMoreResults to + * move to any subsequent result(s). + *

+ * Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql any SQL statement + * @param columnIndexes an array of the indexes of the columns in the + * inserted row that should be made available for retrieval by a + * call to the method getGeneratedKeys + * @return true if the first result is a ResultSet + * object; false if it is an update count or there + * are no results + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement, the + * elements in the int array passed to this method + * are not valid column indexes, the method is called on a + * PreparedStatement or CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * @see #getResultSet + * @see #getUpdateCount + * @see #getMoreResults + * + * @since 1.4 + */ + boolean execute(String sql, int columnIndexes[]) throws SQLException; + + /** + * Executes the given SQL statement, which may return multiple results, + * and signals the driver that the + * auto-generated keys indicated in the given array should be made available + * for retrieval. This array contains the names of the columns in the + * target table that contain the auto-generated keys that should be made + * available. The driver will ignore the array if the SQL statement + * is not an INSERT statement, or an SQL statement able to return + * auto-generated keys (the list of such statements is vendor-specific). + *

+ * In some (uncommon) situations, a single SQL statement may return + * multiple result sets and/or update counts. Normally you can ignore + * this unless you are (1) executing a stored procedure that you know may + * return multiple results or (2) you are dynamically executing an + * unknown SQL string. + *

+ * The execute method executes an SQL statement and indicates the + * form of the first result. You must then use the methods + * getResultSet or getUpdateCount + * to retrieve the result, and getMoreResults to + * move to any subsequent result(s). + *

+ * Note:This method cannot be called on a + * PreparedStatement or CallableStatement. + * @param sql any SQL statement + * @param columnNames an array of the names of the columns in the inserted + * row that should be made available for retrieval by a call to the + * method getGeneratedKeys + * @return true if the next result is a ResultSet + * object; false if it is an update count or there + * are no more results + * @exception SQLException if a database access error occurs, + * this method is called on a closed Statement,the + * elements of the String array passed to this + * method are not valid column names, the method is called on a + * PreparedStatement or CallableStatement + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method + * @throws SQLTimeoutException when the driver has determined that the + * timeout value that was specified by the {@code setQueryTimeout} + * method has been exceeded and has at least attempted to cancel + * the currently running {@code Statement} + * @see #getResultSet + * @see #getUpdateCount + * @see #getMoreResults + * @see #getGeneratedKeys + * + * @since 1.4 + */ + boolean execute(String sql, String columnNames[]) throws SQLException; + + /** + * Retrieves the result set holdability for ResultSet objects + * generated by this Statement object. + * + * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or + * ResultSet.CLOSE_CURSORS_AT_COMMIT + * @exception SQLException if a database access error occurs or + * this method is called on a closed Statement + * + * @since 1.4 + */ + int getResultSetHoldability() throws SQLException; + + /** + * Retrieves whether this Statement object has been closed. A Statement is closed if the + * method close has been called on it, or if it is automatically closed. + * @return true if this Statement object is closed; false if it is still open + * @throws SQLException if a database access error occurs + * @since 1.6 + */ + boolean isClosed() throws SQLException; + + /** + * Requests that a Statement be pooled or not pooled. The value + * specified is a hint to the statement pool implementation indicating + * whether the applicaiton wants the statement to be pooled. It is up to + * the statement pool manager as to whether the hint is used. + *

+ * The poolable value of a statement is applicable to both internal + * statement caches implemented by the driver and external statement caches + * implemented by application servers and other applications. + *

+ * By default, a Statement is not poolable when created, and + * a PreparedStatement and CallableStatement + * are poolable when created. + *

+ * @param poolable requests that the statement be pooled if true and + * that the statement not be pooled if false + *

+ * @throws SQLException if this method is called on a closed + * Statement + *

+ * @since 1.6 + */ + void setPoolable(boolean poolable) + throws SQLException; + + /** + * Returns a value indicating whether the Statement + * is poolable or not. + *

+ * @return true if the Statement + * is poolable; false otherwise + *

+ * @throws SQLException if this method is called on a closed + * Statement + *

+ * @since 1.6 + *

+ * @see java.sql.Statement#setPoolable(boolean) setPoolable(boolean) + */ + boolean isPoolable() + throws SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Struct.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Struct.java new file mode 100644 index 0000000000..50261a6c89 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Struct.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + *

The standard mapping in the Java programming language for an SQL + * structured type. A Struct object contains a + * value for each attribute of the SQL structured type that + * it represents. + * By default, an instance ofStruct is valid as long as the + * application has a reference to it. + *

+ * All methods on the Struct interface must be fully implemented if the + * JDBC driver supports the data type. + * @since 1.2 + */ + +public interface Struct { + + /** + * Retrieves the SQL type name of the SQL structured type + * that this Struct object represents. + * + * @return the fully-qualified type name of the SQL structured + * type for which this Struct object + * is the generic representation + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + String getSQLTypeName() throws SQLException; + + /** + * Produces the ordered values of the attributes of the SQL + * structured type that this Struct object represents. + * As individual attributes are processed, this method uses the type map + * associated with the + * connection for customizations of the type mappings. + * If there is no + * entry in the connection's type map that matches the structured + * type that an attribute represents, + * the driver uses the standard mapping. + *

+ * Conceptually, this method calls the method + * getObject on each attribute + * of the structured type and returns a Java array containing + * the result. + * + * @return an array containing the ordered attribute values + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object[] getAttributes() throws SQLException; + + /** + * Produces the ordered values of the attributes of the SQL + * structured type that this Struct object represents. + * As individual attrbutes are proccessed, this method uses the given type map + * for customizations of the type mappings. + * If there is no + * entry in the given type map that matches the structured + * type that an attribute represents, + * the driver uses the standard mapping. This method never + * uses the type map associated with the connection. + *

+ * Conceptually, this method calls the method + * getObject on each attribute + * of the structured type and returns a Java array containing + * the result. + * + * @param map a mapping of SQL type names to Java classes + * @return an array containing the ordered attribute values + * @exception SQLException if a database access error occurs + * @exception SQLFeatureNotSupportedException if the JDBC driver does not support + * this method + * @since 1.2 + */ + Object[] getAttributes(java.util.Map> map) + throws SQLException; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Time.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Time.java new file mode 100644 index 0000000000..4960ce547e --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Time.java @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + *

A thin wrapper around the java.util.Date class that allows the JDBC + * API to identify this as an SQL TIME value. The Time + * class adds formatting and + * parsing operations to support the JDBC escape syntax for time + * values. + *

The date components should be set to the "zero epoch" + * value of January 1, 1970 and should not be accessed. + */ +public class Time extends java.util.Date { + + /** + * Constructs a Time object initialized with the + * given values for the hour, minute, and second. + * The driver sets the date components to January 1, 1970. + * Any method that attempts to access the date components of a + * Time object will throw a + * java.lang.IllegalArgumentException. + *

+ * The result is undefined if a given argument is out of bounds. + * + * @param hour 0 to 23 + * @param minute 0 to 59 + * @param second 0 to 59 + * + * @deprecated Use the constructor that takes a milliseconds value + * in place of this constructor + */ + @Deprecated + public Time(int hour, int minute, int second) { + super(70, 0, 1, hour, minute, second); + } + + /** + * Constructs a Time object using a milliseconds time value. + * + * @param time milliseconds since January 1, 1970, 00:00:00 GMT; + * a negative number is milliseconds before + * January 1, 1970, 00:00:00 GMT + */ + public Time(long time) { + super(time); + } + + /** + * Sets a Time object using a milliseconds time value. + * + * @param time milliseconds since January 1, 1970, 00:00:00 GMT; + * a negative number is milliseconds before + * January 1, 1970, 00:00:00 GMT + */ + public void setTime(long time) { + super.setTime(time); + } + + /** + * Converts a string in JDBC time escape format to a Time value. + * + * @param s time in format "hh:mm:ss" + * @return a corresponding Time object + */ + public static Time valueOf(String s) { + int hour; + int minute; + int second; + int firstColon; + int secondColon; + + if (s == null) throw new java.lang.IllegalArgumentException(); + + firstColon = s.indexOf(':'); + secondColon = s.indexOf(':', firstColon+1); + if ((firstColon > 0) & (secondColon > 0) & + (secondColon < s.length()-1)) { + hour = Integer.parseInt(s.substring(0, firstColon)); + minute = + Integer.parseInt(s.substring(firstColon+1, secondColon)); + second = Integer.parseInt(s.substring(secondColon+1)); + } else { + throw new java.lang.IllegalArgumentException(); + } + + return new Time(hour, minute, second); + } + + /** + * Formats a time in JDBC time escape format. + * + * @return a String in hh:mm:ss format + */ + public String toString () { + int hour = super.getHours(); + int minute = super.getMinutes(); + int second = super.getSeconds(); + String hourString; + String minuteString; + String secondString; + + if (hour < 10) { + hourString = "0" + hour; + } else { + hourString = Integer.toString(hour); + } + if (minute < 10) { + minuteString = "0" + minute; + } else { + minuteString = Integer.toString(minute); + } + if (second < 10) { + secondString = "0" + second; + } else { + secondString = Integer.toString(second); + } + return (hourString + ":" + minuteString + ":" + secondString); + } + + // Override all the date operations inherited from java.util.Date; + + /** + * @deprecated This method is deprecated and should not be used because SQL TIME + * values do not have a year component. + * + * @exception java.lang.IllegalArgumentException if this + * method is invoked + * @see #setYear + */ + // Android-changed javadoc, @deprecated tag now has a reason. + @Deprecated + public int getYear() { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL TIME + * values do not have a month component. + * + * @exception java.lang.IllegalArgumentException if this + * method is invoked + * @see #setMonth + */ + // Android-changed javadoc, @deprecated tag now has a reason. + @Deprecated + public int getMonth() { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL TIME + * values do not have a day component. + * + * @exception java.lang.IllegalArgumentException if this + * method is invoked + */ + // Android-changed javadoc, @deprecated tag now has a reason. + @Deprecated + public int getDay() { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL TIME + * values do not have a date component. + * + * @exception java.lang.IllegalArgumentException if this + * method is invoked + * @see #setDate + */ + // Android-changed javadoc, @deprecated tag now has a reason. + @Deprecated + public int getDate() { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL TIME + * values do not have a year component. + * + * @exception java.lang.IllegalArgumentException if this + * method is invoked + * @see #getYear + */ + // Android-changed javadoc, @deprecated tag now has a reason. + @Deprecated + public void setYear(int i) { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL TIME + * values do not have a month component. + * + * @exception java.lang.IllegalArgumentException if this + * method is invoked + * @see #getMonth + */ + // Android-changed javadoc, @deprecated tag now has a reason. + @Deprecated + public void setMonth(int i) { + throw new java.lang.IllegalArgumentException(); + } + + /** + * @deprecated This method is deprecated and should not be used because SQL TIME + * values do not have a date component. + * + * @exception java.lang.IllegalArgumentException if this + * method is invoked + * @see #getDate + */ + @Deprecated + public void setDate(int i) { + throw new java.lang.IllegalArgumentException(); + } + + /** + * Private serial version unique ID to ensure serialization + * compatibility. + */ + static final long serialVersionUID = 8397324403548013681L; +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Timestamp.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Timestamp.java new file mode 100644 index 0000000000..14f648b267 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Timestamp.java @@ -0,0 +1,532 @@ +/* + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.util.StringTokenizer; + +/** + *

A thin wrapper around java.util.Date that allows + * the JDBC API to identify this as an SQL TIMESTAMP value. + * It adds the ability + * to hold the SQL TIMESTAMP fractional seconds value, by allowing + * the specification of fractional seconds to a precision of nanoseconds. + * A Timestamp also provides formatting and + * parsing operations to support the JDBC escape syntax for timestamp values. + * + *

The precision of a Timestamp object is calculated to be either: + *

    + *
  • 19 , which is the number of characters in yyyy-mm-dd hh:mm:ss + *
  • 20 + s , which is the number + * of characters in the yyyy-mm-dd hh:mm:ss.[fff...] and s represents the scale of the given Timestamp, + * its fractional seconds precision. + *
+ * + *

Note: This type is a composite of a java.util.Date and a + * separate nanoseconds value. Only integral seconds are stored in the + * java.util.Date component. The fractional seconds - the nanos - are + * separate. The Timestamp.equals(Object) method never returns + * true when passed an object + * that isn't an instance of java.sql.Timestamp, + * because the nanos component of a date is unknown. + * As a result, the Timestamp.equals(Object) + * method is not symmetric with respect to the + * java.util.Date.equals(Object) + * method. Also, the hashCode method uses the underlying + * java.util.Date + * implementation and therefore does not include nanos in its computation. + *

+ * Due to the differences between the Timestamp class + * and the java.util.Date + * class mentioned above, it is recommended that code not view + * Timestamp values generically as an instance of + * java.util.Date. The + * inheritance relationship between Timestamp + * and java.util.Date really + * denotes implementation inheritance, and not type inheritance. + */ +public class Timestamp extends java.util.Date { + + /** + * Constructs a Timestamp object initialized + * with the given values. + * + * @param year the year minus 1900 + * @param month 0 to 11 + * @param date 1 to 31 + * @param hour 0 to 23 + * @param minute 0 to 59 + * @param second 0 to 59 + * @param nano 0 to 999,999,999 + * @deprecated instead use the constructor Timestamp(long millis) + * @exception IllegalArgumentException if the nano argument is out of bounds + */ + @Deprecated + public Timestamp(int year, int month, int date, + int hour, int minute, int second, int nano) { + super(year, month, date, hour, minute, second); + if (nano > 999999999 || nano < 0) { + throw new IllegalArgumentException("nanos > 999999999 or < 0"); + } + nanos = nano; + } + + /** + * Constructs a Timestamp object + * using a milliseconds time value. The + * integral seconds are stored in the underlying date value; the + * fractional seconds are stored in the nanos field of + * the Timestamp object. + * + * @param time milliseconds since January 1, 1970, 00:00:00 GMT. + * A negative number is the number of milliseconds before + * January 1, 1970, 00:00:00 GMT. + * @see java.util.Calendar + */ + public Timestamp(long time) { + super((time/1000)*1000); + nanos = (int)((time%1000) * 1000000); + if (nanos < 0) { + nanos = 1000000000 + nanos; + super.setTime(((time/1000)-1)*1000); + } + } + + /** + * Sets this Timestamp object to represent a point in time that is + * time milliseconds after January 1, 1970 00:00:00 GMT. + * + * @param time the number of milliseconds. + * @see #getTime + * @see #Timestamp(long time) + * @see java.util.Calendar + */ + public void setTime(long time) { + super.setTime((time/1000)*1000); + nanos = (int)((time%1000) * 1000000); + if (nanos < 0) { + nanos = 1000000000 + nanos; + super.setTime(((time/1000)-1)*1000); + } + } + + /** + * Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT + * represented by this Timestamp object. + * + * @return the number of milliseconds since January 1, 1970, 00:00:00 GMT + * represented by this date. + * @see #setTime + */ + public long getTime() { + long time = super.getTime(); + return (time + (nanos / 1000000)); + } + + + /** + * @serial + */ + private int nanos; + + /** + * Converts a String object in JDBC timestamp escape format to a + * Timestamp value. + * + * @param s timestamp in format yyyy-[m]m-[d]d hh:mm:ss[.f...]. The + * fractional seconds may be omitted. The leading zero for mm + * and dd may also be omitted. + * + * @return corresponding Timestamp value + * @exception java.lang.IllegalArgumentException if the given argument + * does not have the format yyyy-[m]m-[d]d hh:mm:ss[.f...] + */ + public static Timestamp valueOf(String s) { + final int YEAR_LENGTH = 4; + final int MONTH_LENGTH = 2; + final int DAY_LENGTH = 2; + final int MAX_MONTH = 12; + final int MAX_DAY = 31; + String date_s; + String time_s; + String nanos_s; + int year = 0; + int month = 0; + int day = 0; + int hour; + int minute; + int second; + int a_nanos = 0; + int firstDash; + int secondDash; + int dividingSpace; + int firstColon = 0; + int secondColon = 0; + int period = 0; + String formatError = "Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]"; + String zeros = "000000000"; + String delimiterDate = "-"; + String delimiterTime = ":"; + + if (s == null) throw new java.lang.IllegalArgumentException("null string"); + + // Split the string into date and time components + s = s.trim(); + dividingSpace = s.indexOf(' '); + if (dividingSpace > 0) { + date_s = s.substring(0,dividingSpace); + time_s = s.substring(dividingSpace+1); + } else { + throw new java.lang.IllegalArgumentException(formatError); + } + + // Parse the date + firstDash = date_s.indexOf('-'); + secondDash = date_s.indexOf('-', firstDash+1); + + // Parse the time + if (time_s == null) + throw new java.lang.IllegalArgumentException(formatError); + firstColon = time_s.indexOf(':'); + secondColon = time_s.indexOf(':', firstColon+1); + period = time_s.indexOf('.', secondColon+1); + + // Convert the date + boolean parsedDate = false; + if ((firstDash > 0) && (secondDash > 0) && (secondDash < date_s.length() - 1)) { + String yyyy = date_s.substring(0, firstDash); + String mm = date_s.substring(firstDash + 1, secondDash); + String dd = date_s.substring(secondDash + 1); + if (yyyy.length() == YEAR_LENGTH && + (mm.length() >= 1 && mm.length() <= MONTH_LENGTH) && + (dd.length() >= 1 && dd.length() <= DAY_LENGTH)) { + year = Integer.parseInt(yyyy); + month = Integer.parseInt(mm); + day = Integer.parseInt(dd); + + if ((month >= 1 && month <= MAX_MONTH) && (day >= 1 && day <= MAX_DAY)) { + parsedDate = true; + } + } + } + if (! parsedDate) { + throw new java.lang.IllegalArgumentException(formatError); + } + + // Convert the time; default missing nanos + if ((firstColon > 0) & (secondColon > 0) & + (secondColon < time_s.length()-1)) { + hour = Integer.parseInt(time_s.substring(0, firstColon)); + minute = + Integer.parseInt(time_s.substring(firstColon+1, secondColon)); + if ((period > 0) & (period < time_s.length()-1)) { + second = + Integer.parseInt(time_s.substring(secondColon+1, period)); + nanos_s = time_s.substring(period+1); + if (nanos_s.length() > 9) + throw new java.lang.IllegalArgumentException(formatError); + if (!Character.isDigit(nanos_s.charAt(0))) + throw new java.lang.IllegalArgumentException(formatError); + nanos_s = nanos_s + zeros.substring(0,9-nanos_s.length()); + a_nanos = Integer.parseInt(nanos_s); + } else if (period > 0) { + throw new java.lang.IllegalArgumentException(formatError); + } else { + second = Integer.parseInt(time_s.substring(secondColon+1)); + } + } else { + throw new java.lang.IllegalArgumentException(formatError); + } + + return new Timestamp(year - 1900, month - 1, day, hour, minute, second, a_nanos); + } + + /** + * Formats a timestamp in JDBC timestamp escape format. + * yyyy-mm-dd hh:mm:ss.fffffffff, + * where ffffffffff indicates nanoseconds. + *

+ * @return a String object in + * yyyy-mm-dd hh:mm:ss.fffffffff format + */ + public String toString () { + + int year = super.getYear() + 1900; + int month = super.getMonth() + 1; + int day = super.getDate(); + int hour = super.getHours(); + int minute = super.getMinutes(); + int second = super.getSeconds(); + String yearString; + String monthString; + String dayString; + String hourString; + String minuteString; + String secondString; + String nanosString; + String zeros = "000000000"; + String yearZeros = "0000"; + StringBuffer timestampBuf; + + if (year < 1000) { + // Add leading zeros + yearString = "" + year; + yearString = yearZeros.substring(0, (4-yearString.length())) + + yearString; + } else { + yearString = "" + year; + } + if (month < 10) { + monthString = "0" + month; + } else { + monthString = Integer.toString(month); + } + if (day < 10) { + dayString = "0" + day; + } else { + dayString = Integer.toString(day); + } + if (hour < 10) { + hourString = "0" + hour; + } else { + hourString = Integer.toString(hour); + } + if (minute < 10) { + minuteString = "0" + minute; + } else { + minuteString = Integer.toString(minute); + } + if (second < 10) { + secondString = "0" + second; + } else { + secondString = Integer.toString(second); + } + if (nanos == 0) { + nanosString = "0"; + } else { + nanosString = Integer.toString(nanos); + + // Add leading zeros + nanosString = zeros.substring(0, (9-nanosString.length())) + + nanosString; + + // Truncate trailing zeros + char[] nanosChar = new char[nanosString.length()]; + nanosString.getChars(0, nanosString.length(), nanosChar, 0); + int truncIndex = 8; + while (nanosChar[truncIndex] == '0') { + truncIndex--; + } + + nanosString = new String(nanosChar, 0, truncIndex + 1); + } + + // do a string buffer here instead. + timestampBuf = new StringBuffer(20+nanosString.length()); + timestampBuf.append(yearString); + timestampBuf.append("-"); + timestampBuf.append(monthString); + timestampBuf.append("-"); + timestampBuf.append(dayString); + timestampBuf.append(" "); + timestampBuf.append(hourString); + timestampBuf.append(":"); + timestampBuf.append(minuteString); + timestampBuf.append(":"); + timestampBuf.append(secondString); + timestampBuf.append("."); + timestampBuf.append(nanosString); + + return (timestampBuf.toString()); + } + + /** + * Gets this Timestamp object's nanos value. + * + * @return this Timestamp object's fractional seconds component + * @see #setNanos + */ + public int getNanos() { + return nanos; + } + + /** + * Sets this Timestamp object's nanos field + * to the given value. + * + * @param n the new fractional seconds component + * @exception java.lang.IllegalArgumentException if the given argument + * is greater than 999999999 or less than 0 + * @see #getNanos + */ + public void setNanos(int n) { + if (n > 999999999 || n < 0) { + throw new IllegalArgumentException("nanos > 999999999 or < 0"); + } + nanos = n; + } + + /** + * Tests to see if this Timestamp object is + * equal to the given Timestamp object. + * + * @param ts the Timestamp value to compare with + * @return true if the given Timestamp + * object is equal to this Timestamp object; + * false otherwise + */ + public boolean equals(Timestamp ts) { + if (super.equals(ts)) { + if (nanos == ts.nanos) { + return true; + } else { + return false; + } + } else { + return false; + } + } + + /** + * Tests to see if this Timestamp object is + * equal to the given object. + * + * This version of the method equals has been added + * to fix the incorrect + * signature of Timestamp.equals(Timestamp) and to preserve backward + * compatibility with existing class files. + * + * Note: This method is not symmetric with respect to the + * equals(Object) method in the base class. + * + * @param ts the Object value to compare with + * @return true if the given Object is an instance + * of a Timestamp that + * is equal to this Timestamp object; + * false otherwise + */ + public boolean equals(java.lang.Object ts) { + if (ts instanceof Timestamp) { + return this.equals((Timestamp)ts); + } else { + return false; + } + } + + /** + * Indicates whether this Timestamp object is + * earlier than the given Timestamp object. + * + * @param ts the Timestamp value to compare with + * @return true if this Timestamp object is earlier; + * false otherwise + */ + public boolean before(Timestamp ts) { + return compareTo(ts) < 0; + } + + /** + * Indicates whether this Timestamp object is + * later than the given Timestamp object. + * + * @param ts the Timestamp value to compare with + * @return true if this Timestamp object is later; + * false otherwise + */ + public boolean after(Timestamp ts) { + return compareTo(ts) > 0; + } + + /** + * Compares this Timestamp object to the given + * Timestamp object. + * + * @param ts the Timestamp object to be compared to + * this Timestamp object + * @return the value 0 if the two Timestamp + * objects are equal; a value less than 0 if this + * Timestamp object is before the given argument; + * and a value greater than 0 if this + * Timestamp object is after the given argument. + * @since 1.4 + */ + public int compareTo(Timestamp ts) { + long thisTime = this.getTime(); + long anotherTime = ts.getTime(); + int i = (thisTime ts.nanos) { + return 1; + } else if (nanos < ts.nanos) { + return -1; + } + } + return i; + + } + + /** + * Compares this Timestamp object to the given + * Date object. + * + * @param o the Date to be compared to + * this Timestamp object + * @return the value 0 if this Timestamp object + * and the given object are equal; a value less than 0 + * if this Timestamp object is before the given argument; + * and a value greater than 0 if this + * Timestamp object is after the given argument. + * + * @since 1.5 + */ + public int compareTo(java.util.Date o) { + if(o instanceof Timestamp) { + // When Timestamp instance compare it with a Timestamp + // Hence it is basically calling this.compareTo((Timestamp))o); + // Note typecasting is safe because o is instance of Timestamp + return compareTo((Timestamp)o); + } else { + // When Date doing a o.compareTo(this) + // will give wrong results. + Timestamp ts = new Timestamp(o.getTime()); + return this.compareTo(ts); + } + } + + /** + * {@inheritDoc} + * + * The {@code hashCode} method uses the underlying {@code java.util.Date} + * implementation and therefore does not include nanos in its computation. + * + */ + @Override + public int hashCode() { + return super.hashCode(); + } + + static final long serialVersionUID = 2745179027874758501L; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Types.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Types.java new file mode 100644 index 0000000000..5b800a926f --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Types.java @@ -0,0 +1,314 @@ +/* + * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + *

The class that defines the constants that are used to identify generic + * SQL types, called JDBC types. + *

+ * This class is never instantiated. + */ +public class Types { + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * BIT. + */ + public final static int BIT = -7; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * TINYINT. + */ + public final static int TINYINT = -6; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * SMALLINT. + */ + public final static int SMALLINT = 5; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * INTEGER. + */ + public final static int INTEGER = 4; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * BIGINT. + */ + public final static int BIGINT = -5; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * FLOAT. + */ + public final static int FLOAT = 6; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * REAL. + */ + public final static int REAL = 7; + + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * DOUBLE. + */ + public final static int DOUBLE = 8; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * NUMERIC. + */ + public final static int NUMERIC = 2; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * DECIMAL. + */ + public final static int DECIMAL = 3; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * CHAR. + */ + public final static int CHAR = 1; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * VARCHAR. + */ + public final static int VARCHAR = 12; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * LONGVARCHAR. + */ + public final static int LONGVARCHAR = -1; + + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * DATE. + */ + public final static int DATE = 91; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * TIME. + */ + public final static int TIME = 92; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * TIMESTAMP. + */ + public final static int TIMESTAMP = 93; + + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * BINARY. + */ + public final static int BINARY = -2; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * VARBINARY. + */ + public final static int VARBINARY = -3; + +/** + *

The constant in the Java programming language, sometimes referred + * to as a type code, that identifies the generic SQL type + * LONGVARBINARY. + */ + public final static int LONGVARBINARY = -4; + +/** + *

The constant in the Java programming language + * that identifies the generic SQL value + * NULL. + */ + public final static int NULL = 0; + + /** + * The constant in the Java programming language that indicates + * that the SQL type is database-specific and + * gets mapped to a Java object that can be accessed via + * the methods getObject and setObject. + */ + public final static int OTHER = 1111; + + + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type + * JAVA_OBJECT. + * @since 1.2 + */ + public final static int JAVA_OBJECT = 2000; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type + * DISTINCT. + * @since 1.2 + */ + public final static int DISTINCT = 2001; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type + * STRUCT. + * @since 1.2 + */ + public final static int STRUCT = 2002; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type + * ARRAY. + * @since 1.2 + */ + public final static int ARRAY = 2003; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type + * BLOB. + * @since 1.2 + */ + public final static int BLOB = 2004; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type + * CLOB. + * @since 1.2 + */ + public final static int CLOB = 2005; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type + * REF. + * @since 1.2 + */ + public final static int REF = 2006; + + /** + * The constant in the Java programming language, somtimes referred to + * as a type code, that identifies the generic SQL type DATALINK. + * + * @since 1.4 + */ + public final static int DATALINK = 70; + + /** + * The constant in the Java programming language, somtimes referred to + * as a type code, that identifies the generic SQL type BOOLEAN. + * + * @since 1.4 + */ + public final static int BOOLEAN = 16; + + //------------------------- JDBC 4.0 ----------------------------------- + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type ROWID + * + * @since 1.6 + * + */ + public final static int ROWID = -8; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type NCHAR + * + * @since 1.6 + */ + public static final int NCHAR = -15; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type NVARCHAR. + * + * @since 1.6 + */ + public static final int NVARCHAR = -9; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type LONGNVARCHAR. + * + * @since 1.6 + */ + public static final int LONGNVARCHAR = -16; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type NCLOB. + * + * @since 1.6 + */ + public static final int NCLOB = 2011; + + /** + * The constant in the Java programming language, sometimes referred to + * as a type code, that identifies the generic SQL type XML. + * + * @since 1.6 + */ + public static final int SQLXML = 2009; + + // Prevent instantiation + private Types() {} +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Wrapper.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Wrapper.java new file mode 100644 index 0000000000..2eaa003f24 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/Wrapper.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +/** + * Interface for JDBC classes which provide the ability to retrieve the delegate instance when the instance + * in question is in fact a proxy class. + *

+ * The wrapper pattern is employed by many JDBC driver implementations to provide extensions beyond + * the traditional JDBC API that are specific to a data source. Developers may wish to gain access to + * these resources that are wrapped (the delegates) as proxy class instances representing the + * the actual resources. This interface describes a standard mechanism to access + * these wrapped resources + * represented by their proxy, to permit direct access to the resource delegates. + * + * @since 1.6 + */ + +public interface Wrapper { + + /** + * Returns an object that implements the given interface to allow access to + * non-standard methods, or standard methods not exposed by the proxy. + * + * If the receiver implements the interface then the result is the receiver + * or a proxy for the receiver. If the receiver is a wrapper + * and the wrapped object implements the interface then the result is the + * wrapped object or a proxy for the wrapped object. Otherwise return the + * the result of calling unwrap recursively on the wrapped object + * or a proxy for that result. If the receiver is not a + * wrapper and does not implement the interface, then an SQLException is thrown. + * + * @param iface A Class defining an interface that the result must implement. + * @return an object that implements the interface. May be a proxy for the actual implementing object. + * @throws java.sql.SQLException If no object found that implements the interface + * @since 1.6 + */ + T unwrap(java.lang.Class iface) throws java.sql.SQLException; + + /** + * Returns true if this either implements the interface argument or is directly or indirectly a wrapper + * for an object that does. Returns false otherwise. If this implements the interface then return true, + * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped + * object. If this does not implement the interface and is not a wrapper, return false. + * This method should be implemented as a low-cost operation compared to unwrap so that + * callers can use this method to avoid expensive unwrap calls that may fail. If this method + * returns true then calling unwrap with the same argument should succeed. + * + * @param iface a Class defining an interface. + * @return true if this implements the interface or directly or indirectly wraps an object that does. + * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper + * for an object with the given interface. + * @since 1.6 + */ + boolean isWrapperFor(java.lang.Class iface) throws java.sql.SQLException; + +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/package.html b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/package.html new file mode 100644 index 0000000000..60acef6bee --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/java/sql/package.html @@ -0,0 +1,326 @@ + + + + + + + + + + + +Provides the API for accessing and processing data stored in a +data source (usually a relational database) using the +JavaTM programming language. +This API includes a framework whereby different +drivers can be installed dynamically to access different data sources. +Although the JDBCTM API is mainly geared +to passing SQL statements to a database, it provides for reading and +writing data from any data source with a tabular format. +The reader/writer facility, available through the +javax.sql.RowSet group of interfaces, can be customized to +use and update data from a spread sheet, flat file, or any other tabular +data source. +

+

What the JDBCTM 4.1 API Includes

+The JDBCTM 4.1 API includes both +the java.sql package, referred to as the JDBC core API, +and the javax.sql package, referred to as the JDBC Optional +Package API. This complete JDBC API +is included in the JavaTM +Standard Edition (Java SETM), version 7. +The javax.sql package extends the functionality of the JDBC API +from a client-side API to a server-side API, and it is an essential part +of the JavaTM Enterprise Edition +(Java EETM) technology. +

+

Versions

+The JDBC 4.1 API incorporates all of the previous JDBC API versions: +
    +
  • The JDBC 4.0 API +
  • The JDBC 3.0 API +
  • The JDBC 2.1 core API +
  • The JDBC 2.0 Optional Package API
    + (Note that the JDBC 2.1 core API and the JDBC 2.0 Optional Package + API together are referred to as the JDBC 2.0 API.) +
  • The JDBC 1.2 API +
  • The JDBC 1.0 API +
+

+Classes, interfaces, methods, fields, constructors, and exceptions +have the following "since" tags that indicate when they were introduced +into the Java platform. When these "since" tags are used in +JavadocTM comments for the JDBC API, +they indicate the following: +

    +
  • Since 1.7 -- new in the JDBC 4.1 API and part of the Java SE platform, + version 7 +
  • Since 1.6 -- new in the JDBC 4.0 API and part of the Java SE platform, + version 6 +
  • Since 1.4 -- new in the JDBC 3.0 API and part of the J2SE platform, + version 1.4 +
  • Since 1.2 -- new in the JDBC 2.0 API and part of the J2SE platform, + version 1.2 +
  • Since 1.1 or no "since" tag -- in the original JDBC 1.0 API and part of + the JDKTM, version 1.1 +
+

+NOTE: Many of the new features are optional; consequently, there is +some variation in drivers and the features they support. Always +check your driver's documentation to see whether it supports a feature before +you try to use it. +

+NOTE: The class SQLPermission was added in the +JavaTM 2 SDK, Standard Edition, +version 1.3 release. This class is used to prevent unauthorized +access to the logging stream associated with the DriverManager, +which may contain information such as table names, column data, and so on. +

+ +

What the java.sql Package Contains

+The java.sql package contains API for the following: +
    +
  • Making a connection with a database via the DriverManager facility +
      +
    • DriverManager class -- makes a connection with a driver +
    • SQLPermission class -- provides permission when code + running within a Security Manager, such as an applet, + attempts to set up a logging stream through the + DriverManager +
    • Driver interface -- provides the API for registering + and connecting drivers based on JDBC technology ("JDBC drivers"); + generally used only by the DriverManager class +
    • DriverPropertyInfo class -- provides properties for a + JDBC driver; not used by the general user +
    +
  • Sending SQL statements to a database +
      +
    • Statement -- used to send basic SQL statements +
    • PreparedStatement -- used to send prepared statements or + basic SQL statements (derived from Statement) +
    • CallableStatement -- used to call database stored + procedures (derived from PreparedStatement) +
    • Connection interface -- provides methods for creating + statements and managing connections and their properties +
    • Savepoint -- provides savepoints in a transaction + +
    +
  • Retrieving and updating the results of a query +
      +
    • ResultSet interface +
    +
  • Standard mappings for SQL types to classes and interfaces in the + Java programming language +
      +
    • Array interface -- mapping for SQL ARRAY +
    • Blob interface -- mapping for SQL BLOB +
    • Clob interface -- mapping for SQL CLOB +
    • Date class -- mapping for SQL DATE +
    • NClob interface -- mapping for SQL NCLOB +
    • Ref interface -- mapping for SQL REF +
    • RowId interface -- mapping for SQL ROWID +
    • Struct interface -- mapping for SQL STRUCT +
    • SQLXML interface -- mapping for SQL XML +
    • Time class -- mapping for SQL TIME +
    • Timestamp class -- mapping for SQL TIMESTAMP +
    • Types class -- provides constants for SQL types +
    +
  • Custom mapping an SQL user-defined type (UDT) to a class in the + Java programming language +
      +
    • SQLData interface -- specifies the mapping of + a UDT to an instance of this class +
    • SQLInput interface -- provides methods for reading + UDT attributes from a stream +
    • SQLOutput interface -- provides methods for writing + UDT attributes back to a stream +
    +
  • Metadata +
      +
    • DatabaseMetaData interface -- provides information + about the database +
    • ResultSetMetaData interface -- provides information + about the columns of a ResultSet object +
    • ParameterMetaData interface -- provides information + about the parameters to PreparedStatement commands +
    +
  • Exceptions +
      +
    • SQLException -- thrown by most methods when there + is a problem accessing data and by some methods for other reasons +
    • SQLWarning -- thrown to indicate a warning +
    • DataTruncation -- thrown to indicate that data may have + been truncated +
    • BatchUpdateException -- thrown to indicate that not all + commands in a batch update executed successfully +
    +
+

+

java.sql and javax.sql Features Introduced in the JDBC 4.1 API

+
    +
  • Allow Connection, + ResultSet and Statement objects to be + used with the try-with-resources statement
  • +
  • Supported added to CallableStatement and + ResultSet to specify the Java type to convert to via the + getObject method
  • +
  • DatabaseMetaData methods to return PseudoColumns and if a + generated key is always returned
  • +
  • Added support to Connection to specify a database schema, + abort and timeout a physical connection.
  • +
  • Added support to close a Statement object when its dependent + objects have been closed
  • +
  • Support for obtaining the parent logger for a Driver, + DataSource, ConnectionPoolDataSource and + XADataSource
  • + +
+

java.sql and javax.sql Features Introduced in the JDBC 4.0 API

+
    +
  • auto java.sql.Driver discovery -- no longer need to load a +java.sql.Driver class via Class.forName +
  • National Character Set support added +
  • Support added for the SQL:2003 XML data type +
  • SQLException enhancements -- Added support for cause chaining; New SQLExceptions + added for common SQLState class value codes +
  • Enhanced Blob/Clob functionality -- Support provided to create and free a Blob/Clob instance + as well as additional methods added to improve accessiblity +
  • Support added for accessing a SQL ROWID +
  • Support added to allow a JDBC application to access an instance of a JDBC resource + that has been wrapped by a vendor, usually in an application server or connection + pooling environment. +
  • Availability to be notified when a PreparedStatement that is associated + with a PooledConnection has been closed or the driver determines is invalid + + +
+

+

+

java.sql and javax.sql Features Introduced in the JDBC 3.0 API

+
    +
  • Pooled statements -- reuse of statements associated with a pooled + connection +
  • Savepoints -- allow a transaction to be rolled back to a designated + savepoint +
  • Properties defined for ConnectionPoolDataSource -- specify + how connections are to be pooled +
  • Metadata for parameters of a PreparedStatement object +
  • Ability to retrieve values from automatically generated columns +
  • Ability to have multiple ResultSet objects + returned from CallableStatement objects open at the + same time +
  • Ability to identify parameters to CallableStatement + objects by name as well as by index +
  • ResultSet holdability -- ability to specify whether cursors + should be held open or closed at the end of a transaction +
  • Ability to retrieve and update the SQL structured type instance that a + Ref object references +
  • Ability to programmatically update BLOB, + CLOB, ARRAY, and REF values. +
  • Addition of the java.sql.Types.DATALINK data type -- + allows JDBC drivers access to objects stored outside a data source +
  • Addition of metadata for retrieving SQL type hierarchies +
+

+

java.sql Features Introduced in the JDBC 2.1 Core API

+
    +
  • Scrollable result sets--using new methods in the ResultSet + interface that allow the cursor to be moved to a particular row or to a + position relative to its current position +
  • Batch updates +
  • Programmatic updates--using ResultSet updater methods +
  • New data types--interfaces mapping the SQL3 data types +
  • Custom mapping of user-defined types (UDTs) +
  • Miscellaneous features, including performance hints, the use of character + streams, full precision for java.math.BigDecimal values, + additional security, and + support for time zones in date, time, and timestamp values. +
+

+

javax.sql Features Introduced in the JDBC 2.0 Optional +Package API

+
    +
  • The DataSource interface as a means of making a connection. The + Java Naming and Directory InterfaceTM + (JNDI) is used for registering a DataSource object with a + naming service and also for retrieving it. +
  • Pooled connections -- allowing connections to be used and reused +
  • Distributed transactions -- allowing a transaction to span diverse + DBMS servers +
  • RowSet technology -- providing a convenient means of + handling and passing data +
+

+

+

Custom Mapping of UDTs

+A user-defined type (UDT) defined in SQL can be mapped to a class in the Java +programming language. An SQL structured type or an SQL DISTINCT +type are the UDTs that may be custom mapped. The following three +steps set up a custom mapping: +
    +
  1. Defining the SQL structured type or DISTINCT type in SQL +
  2. Defining the class in the Java programming language to which the + SQL UDT will be mapped. This class must implement the + SQLData interface. +
  3. Making an entry in a Connection object's type map + that contains two things: +
      +
    • the fully-qualified SQL name of the UDT +
    • the Class object for the class that implements the + SQLData interface +
    +
+

+When these are in place for a UDT, calling the methods +ResultSet.getObject or CallableStatement.getObject +on that UDT will automatically retrieve the custom mapping for it. Also, the +PreparedStatement.setObject method will automatically map the +object back to its SQL type to store it in the data source. + +

Package Specification

+ + + +

Related Documentation

+ + +

+@since 1.1 + + diff --git a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/CallerSensitive.java b/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/CallerSensitive.java new file mode 100644 index 0000000000..79fbdfc38e --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/CallerSensitive.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.reflect; + +import java.lang.annotation.*; +import static java.lang.annotation.ElementType.*; + +/** + * A method annotated @CallerSensitive is sensitive to its calling class, + * via {@link sun.reflect.Reflection#getCallerClass Reflection.getCallerClass}, + * or via some equivalent. + * + * @author John R. Rose + * + * @hide + */ +// Android-added @hide +@Retention(RetentionPolicy.RUNTIME) +@Target({METHOD}) +public @interface CallerSensitive { +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/objc/java/java/sql/DriverManager.java b/jre_emul/android/platform/libcore/ojluni/src/objc/java/java/sql/DriverManager.java new file mode 100644 index 0000000000..2606720415 --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/objc/java/java/sql/DriverManager.java @@ -0,0 +1,609 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.util.concurrent.CopyOnWriteArrayList; +import sun.reflect.CallerSensitive; + +/** + *

The basic service for managing a set of JDBC drivers.
+ * NOTE: The {@code DataSource} interface, new in the + * JDBC 2.0 API, provides another way to connect to a data source. + * The use of a DataSource object is the preferred means of + * connecting to a data source. + * + *

As part of its initialization, the DriverManager class will + * attempt to load the driver classes referenced in the "jdbc.drivers" + * system property. This allows a user to customize the JDBC Drivers + * used by their applications. For example in your + * ~/.hotjava/properties file you might specify: + *

+ * jdbc.drivers=foo.bah.Driver:wombat.sql.Driver:bad.taste.ourDriver
+ * 
+ *

The DriverManager methods getConnection and + * getDrivers have been enhanced to support the Java Standard Edition + * Service Provider mechanism. JDBC 4.0 Drivers must + * include the file META-INF/services/java.sql.Driver. This file contains the name of the JDBC drivers + * implementation of java.sql.Driver. For example, to load the my.sql.Driver class, + * the META-INF/services/java.sql.Driver file would contain the entry: + *

+ * my.sql.Driver
+ * 
+ * + *

Applications no longer need to explictly load JDBC drivers using Class.forName(). Existing programs + * which currently load JDBC drivers using Class.forName() will continue to work without + * modification. + * + *

When the method getConnection is called, + * the DriverManager will attempt to + * locate a suitable driver from amongst those loaded at + * initialization and those loaded explicitly using the same classloader + * as the current applet or application. + * + *

+ * Starting with the Java 2 SDK, Standard Edition, version 1.3, a + * logging stream can be set only if the proper + * permission has been granted. Normally this will be done with + * the tool PolicyTool, which can be used to grant permission + * java.sql.SQLPermission "setLog". + * @see Driver + * @see Connection + */ +// Android-changed line 2 of the javadoc to "{@code DataSource}" +public class DriverManager { + + + // List of registered JDBC drivers + private final static CopyOnWriteArrayList registeredDrivers = new CopyOnWriteArrayList(); + private static volatile int loginTimeout = 0; + private static volatile java.io.PrintWriter logWriter = null; + private static volatile java.io.PrintStream logStream = null; + // Used in println() to synchronize logWriter + private final static Object logSync = new Object(); + + /* Prevent the DriverManager class from being instantiated. */ + private DriverManager(){} + + + /** + * Load the initial JDBC drivers by checking the System property + * jdbc.properties and then use the {@code ServiceLoader} mechanism + */ + static { + loadInitialDrivers(); + println("JDBC DriverManager initialized"); + } + + /** + * The SQLPermission constant that allows the + * setting of the logging stream. + * @since 1.3 + */ + final static SQLPermission SET_LOG_PERMISSION = + new SQLPermission("setLog"); + + //--------------------------JDBC 2.0----------------------------- + + /** + * Retrieves the log writer. + * + * The getLogWriter and setLogWriter + * methods should be used instead + * of the get/setlogStream methods, which are deprecated. + * @return a java.io.PrintWriter object + * @see #setLogWriter + * @since 1.2 + */ + public static java.io.PrintWriter getLogWriter() { + return logWriter; + } + + /** + * Sets the logging/tracing PrintWriter object + * that is used by the DriverManager and all drivers. + *

+ * There is a minor versioning problem created by the introduction + * of the method setLogWriter. The + * method setLogWriter cannot create a PrintStream object + * that will be returned by getLogStream---the Java platform does + * not provide a backward conversion. As a result, a new application + * that uses setLogWriter and also uses a JDBC 1.0 driver that uses + * getLogStream will likely not see debugging information written + * by that driver. + *

+ * Starting with the Java 2 SDK, Standard Edition, version 1.3 release, this method checks + * to see that there is an SQLPermission object before setting + * the logging stream. If a SecurityManager exists and its + * checkPermission method denies setting the log writer, this + * method throws a java.lang.SecurityException. + * + * @param out the new logging/tracing PrintStream object; + * null to disable logging and tracing + * @throws SecurityException + * if a security manager exists and its + * checkPermission method denies + * setting the log writer + * + * @see SecurityManager#checkPermission + * @see #getLogWriter + * @since 1.2 + */ + public static void setLogWriter(java.io.PrintWriter out) { + + SecurityManager sec = System.getSecurityManager(); + if (sec != null) { + sec.checkPermission(SET_LOG_PERMISSION); + } + logStream = null; + logWriter = out; + } + + + //--------------------------------------------------------------- + + /** + * Attempts to establish a connection to the given database URL. + * The DriverManager attempts to select an appropriate driver from + * the set of registered JDBC drivers. + * + * @param url a database url of the form + * jdbc:subprotocol:subname + * @param info a list of arbitrary string tag/value pairs as + * connection arguments; normally at least a "user" and + * "password" property should be included + * @return a Connection to the URL + * @exception SQLException if a database access error occurs + */ + @CallerSensitive + public static Connection getConnection(String url, + java.util.Properties info) throws SQLException { + return (getConnection(url, info, ClassLoader.getSystemClassLoader())); + } + + /** + * Attempts to establish a connection to the given database URL. + * The DriverManager attempts to select an appropriate driver from + * the set of registered JDBC drivers. + * + * @param url a database url of the form + * jdbc:subprotocol:subname + * @param user the database user on whose behalf the connection is being + * made + * @param password the user's password + * @return a connection to the URL + * @exception SQLException if a database access error occurs + */ + @CallerSensitive + public static Connection getConnection(String url, + String user, String password) throws SQLException { + java.util.Properties info = new java.util.Properties(); + + if (user != null) { + info.put("user", user); + } + if (password != null) { + info.put("password", password); + } + + return (getConnection(url, info, ClassLoader.getSystemClassLoader())); + } + + /** + * Attempts to establish a connection to the given database URL. + * The DriverManager attempts to select an appropriate driver from + * the set of registered JDBC drivers. + * + * @param url a database url of the form + * jdbc:subprotocol:subname + * @return a connection to the URL + * @exception SQLException if a database access error occurs + */ + @CallerSensitive + public static Connection getConnection(String url) + throws SQLException { + + java.util.Properties info = new java.util.Properties(); + return (getConnection(url, info, ClassLoader.getSystemClassLoader())); + } + + /** + * Attempts to locate a driver that understands the given URL. + * The DriverManager attempts to select an appropriate driver from + * the set of registered JDBC drivers. + * + * @param url a database URL of the form + * jdbc:subprotocol:subname + * @return a Driver object representing a driver + * that can connect to the given URL + * @exception SQLException if a database access error occurs + */ + @CallerSensitive + public static Driver getDriver(String url) + throws SQLException { + + println("DriverManager.getDriver(\"" + url + "\")"); + + ClassLoader callerClassLoader = ClassLoader.getSystemClassLoader(); + + // Walk through the loaded registeredDrivers attempting to locate someone + // who understands the given URL. + for (DriverInfo aDriver : registeredDrivers) { + // If the caller does not have permission to load the driver then + // skip it. + if(isDriverAllowed(aDriver.driver, callerClassLoader)) { + try { + if(aDriver.driver.acceptsURL(url)) { + // Success! + println("getDriver returning " + aDriver.driver.getClass().getName()); + return (aDriver.driver); + } + + } catch(SQLException sqe) { + // Drop through and try the next driver. + } + } else { + println(" skipping: " + aDriver.driver.getClass().getName()); + } + + } + + println("getDriver: no suitable driver"); + throw new SQLException("No suitable driver", "08001"); + } + + + /** + * Registers the given driver with the DriverManager. + * A newly-loaded driver class should call + * the method registerDriver to make itself + * known to the DriverManager. + * + * @param driver the new JDBC Driver that is to be registered with the + * DriverManager + * @exception SQLException if a database access error occurs + */ + public static synchronized void registerDriver(java.sql.Driver driver) + throws SQLException { + + /* Register the driver if it has not already been added to our list */ + if(driver != null) { + registeredDrivers.addIfAbsent(new DriverInfo(driver)); + } else { + // This is for compatibility with the original DriverManager + throw new NullPointerException(); + } + + println("registerDriver: " + driver); + + } + + /** + * Drops a driver from the DriverManager's list. + * Applets can only deregister drivers from their own classloaders. + * + * @param driver the JDBC Driver to drop + * @exception SQLException if a database access error occurs + */ + @CallerSensitive + public static synchronized void deregisterDriver(Driver driver) + throws SQLException { + if (driver == null) { + return; + } + + println("DriverManager.deregisterDriver: " + driver); + + DriverInfo aDriver = new DriverInfo(driver); + if(registeredDrivers.contains(aDriver)) { + if (isDriverAllowed(driver, ClassLoader.getSystemClassLoader())) { + registeredDrivers.remove(aDriver); + } else { + // If the caller does not have permission to load the driver then + // throw a SecurityException. + throw new SecurityException(); + } + } else { + println(" couldn't find driver to unload"); + } + } + + /** + * Retrieves an Enumeration with all of the currently loaded JDBC drivers + * to which the current caller has access. + * + *

Note: The classname of a driver can be found using + * d.getClass().getName() + * + * @return the list of JDBC Drivers loaded by the caller's class loader + */ + @CallerSensitive + public static java.util.Enumeration getDrivers() { + java.util.Vector result = new java.util.Vector(); + + ClassLoader callerClassLoader = ClassLoader.getSystemClassLoader(); + + // Walk through the loaded registeredDrivers. + for(DriverInfo aDriver : registeredDrivers) { + // If the caller does not have permission to load the driver then + // skip it. + if(isDriverAllowed(aDriver.driver, callerClassLoader)) { + result.addElement(aDriver.driver); + } else { + println(" skipping: " + aDriver.getClass().getName()); + } + } + return (result.elements()); + } + + + /** + * Sets the maximum time in seconds that a driver will wait + * while attempting to connect to a database. + * + * @param seconds the login time limit in seconds; zero means there is no limit + * @see #getLoginTimeout + */ + public static void setLoginTimeout(int seconds) { + loginTimeout = seconds; + } + + /** + * Gets the maximum time in seconds that a driver can wait + * when attempting to log in to a database. + * + * @return the driver login time limit in seconds + * @see #setLoginTimeout + */ + public static int getLoginTimeout() { + return (loginTimeout); + } + + /** + * Sets the logging/tracing PrintStream that is used + * by the DriverManager + * and all drivers. + *

+ * In the Java 2 SDK, Standard Edition, version 1.3 release, this method checks + * to see that there is an SQLPermission object before setting + * the logging stream. If a SecurityManager exists and its + * checkPermission method denies setting the log writer, this + * method throws a java.lang.SecurityException. + * + * @param out the new logging/tracing PrintStream; to disable, set to null + * @deprecated Use {@code setLogWriter} instead. + * @throws SecurityException if a security manager exists and its + * checkPermission method denies setting the log stream + * + * @see SecurityManager#checkPermission + * @see #getLogStream + */ + @Deprecated // Android-added, also changed deprecation comment to include a reason. + public static void setLogStream(java.io.PrintStream out) { + + SecurityManager sec = System.getSecurityManager(); + if (sec != null) { + sec.checkPermission(SET_LOG_PERMISSION); + } + + logStream = out; + if ( out != null ) + logWriter = new java.io.PrintWriter(out); + else + logWriter = null; + } + + /** + * Retrieves the logging/tracing PrintStream that is used by the DriverManager + * and all drivers. + * + * @return the logging/tracing PrintStream; if disabled, is null + * @deprecated Use {@code getLogWriter} instead. + * @see #setLogStream + */ + @Deprecated // Android-added, also changed deprecation comment to include a reason. + public static java.io.PrintStream getLogStream() { + return logStream; + } + + /** + * Prints a message to the current JDBC log stream. + * + * @param message a log or tracing message + */ + public static void println(String message) { + synchronized (logSync) { + if (logWriter != null) { + logWriter.println(message); + + // automatic flushing is never enabled, so we must do it ourselves + logWriter.flush(); + } + } + } + + //------------------------------------------------------------------------ + + private static boolean isDriverAllowed(Driver driver, ClassLoader classLoader) { + boolean result = false; + if(driver != null) { + Class aClass = null; + try { + aClass = Class.forName(driver.getClass().getName(), true, classLoader); + } catch (Exception ex) { + result = false; + } + + result = ( aClass == driver.getClass() ) ? true : false; + } + + return result; + } + + private static void loadInitialDrivers() { + String drivers = System.getProperty("jdbc.drivers", null); + + /* Disable for j2objc. + // If the driver is packaged as a Service Provider, load it. + // Get all the drivers through the classloader + // exposed as a java.sql.Driver.class service. + // ServiceLoader.load() replaces the sun.misc.Providers() + + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { + + ServiceLoader loadedDrivers = ServiceLoader.load(Driver.class); + Iterator driversIterator = loadedDrivers.iterator(); + + /* Load these drivers, so that they can be instantiated. + * It may be the case that the driver class may not be there + * i.e. there may be a packaged driver with the service class + * as implementation of java.sql.Driver but the actual class + * may be missing. In that case a java.util.ServiceConfigurationError + * will be thrown at runtime by the VM trying to locate + * and load the service. + * + * Adding a try catch block to catch those runtime errors + * if driver not available in classpath but it's + * packaged as service and that service is there in classpath. + * / + try{ + while(driversIterator.hasNext()) { + driversIterator.next(); + } + } catch(Throwable t) { + // Do nothing + } + return null; + } + }); + */ + + println("DriverManager.initialize: jdbc.drivers = " + drivers); + + if (drivers == null || drivers.equals("")) { + return; + } + String[] driversList = drivers.split(":"); + println("number of Drivers:" + driversList.length); + for (String aDriver : driversList) { + try { + println("DriverManager.Initialize: loading " + aDriver); + Class.forName(aDriver, true, + ClassLoader.getSystemClassLoader()); + } catch (Exception ex) { + println("DriverManager.Initialize: load failed: " + ex); + } + } + } + + + // Worker method called by the public getConnection() methods. + private static Connection getConnection( + String url, java.util.Properties info, ClassLoader callerCL) throws SQLException { + /* + * When callerCl is null, we should check the application's + * (which is invoking this class indirectly) + * classloader, so that the JDBC driver class outside rt.jar + * can be loaded from here. + */ + synchronized (DriverManager.class) { + // synchronize loading of the correct classloader. + if (callerCL == null) { + callerCL = Thread.currentThread().getContextClassLoader(); + } + } + + if(url == null) { + throw new SQLException("The url cannot be null", "08001"); + } + + println("DriverManager.getConnection(\"" + url + "\")"); + + // Walk through the loaded registeredDrivers attempting to make a connection. + // Remember the first exception that gets raised so we can reraise it. + SQLException reason = null; + + for(DriverInfo aDriver : registeredDrivers) { + // If the caller does not have permission to load the driver then + // skip it. + if(isDriverAllowed(aDriver.driver, callerCL)) { + try { + println(" trying " + aDriver.driver.getClass().getName()); + Connection con = aDriver.driver.connect(url, info); + if (con != null) { + // Success! + println("getConnection returning " + aDriver.driver.getClass().getName()); + return (con); + } + } catch (SQLException ex) { + if (reason == null) { + reason = ex; + } + } + + } else { + println(" skipping: " + aDriver.getClass().getName()); + } + + } + + // if we got here nobody could connect. + if (reason != null) { + println("getConnection failed: " + reason); + throw reason; + } + + println("getConnection: no suitable driver found for "+ url); + throw new SQLException("No suitable driver found for "+ url, "08001"); + } +} + +/* + * Wrapper class for registered Drivers in order to not expose Driver.equals() + * to avoid the capture of the Driver it being compared to as it might not + * normally have access. + */ +class DriverInfo { + + final Driver driver; + DriverInfo(Driver driver) { + this.driver = driver; + } + + public boolean equals(Object other) { + return (other instanceof DriverInfo) + && this.driver == ((DriverInfo) other).driver; + } + + public int hashCode() { + return driver.hashCode(); + } + + public String toString() { + return ("driver[className=" + driver + "]"); + } +} diff --git a/jre_emul/android/platform/libcore/ojluni/src/objc/java/java/sql/SQLException.java b/jre_emul/android/platform/libcore/ojluni/src/objc/java/java/sql/SQLException.java new file mode 100644 index 0000000000..189f9c85fe --- /dev/null +++ b/jre_emul/android/platform/libcore/ojluni/src/objc/java/java/sql/SQLException.java @@ -0,0 +1,395 @@ +/* + * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.sql; + +import java.lang.reflect.Field; +import java.util.Iterator; +import java.util.NoSuchElementException; +import sun.misc.Unsafe; + +/** + *

An exception that provides information on a database access + * error or other errors. + * + *

Each SQLException provides several kinds of information: + *

    + *
  • a string describing the error. This is used as the Java Exception + * message, available via the method getMesasge. + *
  • a "SQLstate" string, which follows either the XOPEN SQLstate conventions + * or the SQL:2003 conventions. + * The values of the SQLState string are described in the appropriate spec. + * The DatabaseMetaData method getSQLStateType + * can be used to discover whether the driver returns the XOPEN type or + * the SQL:2003 type. + *
  • an integer error code that is specific to each vendor. Normally this will + * be the actual error code returned by the underlying database. + *
  • a chain to a next Exception. This can be used to provide additional + * error information. + *
  • the causal relationship, if any for this SQLException. + *
+ */ +public class SQLException extends java.lang.Exception + implements Iterable { + + /** + * Constructs a SQLException object with a given + * reason, SQLState and + * vendorCode. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + */ + public SQLException(String reason, String SQLState, int vendorCode) { + super(reason); + this.SQLState = SQLState; + this.vendorCode = vendorCode; + if (!(this instanceof SQLWarning)) { + if (DriverManager.getLogWriter() != null) { + DriverManager.println("SQLState(" + SQLState + + ") vendor code(" + vendorCode + ")"); + printStackTrace(DriverManager.getLogWriter()); + } + } + } + + + /** + * Constructs a SQLException object with a given + * reason and SQLState. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code + * is initialized to 0. + *

+ * @param reason a description of the exception + * @param SQLState an XOPEN or SQL:2003 code identifying the exception + */ + public SQLException(String reason, String SQLState) { + super(reason); + this.SQLState = SQLState; + this.vendorCode = 0; + if (!(this instanceof SQLWarning)) { + if (DriverManager.getLogWriter() != null) { + printStackTrace(DriverManager.getLogWriter()); + DriverManager.println("SQLException: SQLState(" + SQLState + ")"); + } + } + } + + /** + * Constructs a SQLException object with a given + * reason. The SQLState is initialized to + * null and the vender code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ * @param reason a description of the exception + */ + public SQLException(String reason) { + super(reason); + this.SQLState = null; + this.vendorCode = 0; + if (!(this instanceof SQLWarning)) { + if (DriverManager.getLogWriter() != null) { + printStackTrace(DriverManager.getLogWriter()); + } + } + } + + /** + * Constructs a SQLException object. + * The reason, SQLState are initialized + * to null and the vendor code is initialized to 0. + * + * The cause is not initialized, and may subsequently be + * initialized by a call to the + * {@link Throwable#initCause(java.lang.Throwable)} method. + *

+ */ + public SQLException() { + super(); + this.SQLState = null; + this.vendorCode = 0; + if (!(this instanceof SQLWarning)) { + if (DriverManager.getLogWriter() != null) { + printStackTrace(DriverManager.getLogWriter()); + } + } + } + + /** + * Constructs a SQLException object with a given + * cause. + * The SQLState is initialized + * to null and the vendor code is initialized to 0. + * The reason is initialized to null if + * cause==null or to cause.toString() if + * cause!=null. + *

+ * @param cause the underlying reason for this SQLException + * (which is saved for later retrieval by the getCause() method); + * may be null indicating the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLException(Throwable cause) { + super(cause); + + if (!(this instanceof SQLWarning)) { + if (DriverManager.getLogWriter() != null) { + printStackTrace(DriverManager.getLogWriter()); + } + } + } + + /** + * Constructs a SQLException object with a given + * reason and cause. + * The SQLState is initialized to null + * and the vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param cause the underlying reason for this SQLException + * (which is saved for later retrieval by the getCause() method); + * may be null indicating the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLException(String reason, Throwable cause) { + super(reason,cause); + + if (!(this instanceof SQLWarning)) { + if (DriverManager.getLogWriter() != null) { + printStackTrace(DriverManager.getLogWriter()); + } + } + } + + /** + * Constructs a SQLException object with a given + * reason, SQLState and cause. + * The vendor code is initialized to 0. + *

+ * @param reason a description of the exception. + * @param sqlState an XOPEN or SQL:2003 code identifying the exception + * @param cause the underlying reason for this SQLException + * (which is saved for later retrieval by the + * getCause() method); may be null indicating + * the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLException(String reason, String sqlState, Throwable cause) { + super(reason,cause); + + this.SQLState = sqlState; + this.vendorCode = 0; + if (!(this instanceof SQLWarning)) { + if (DriverManager.getLogWriter() != null) { + printStackTrace(DriverManager.getLogWriter()); + DriverManager.println("SQLState(" + SQLState + ")"); + } + } + } + + /** + * Constructs a SQLException object with a given + * reason, SQLState, vendorCode + * and cause. + *

+ * @param reason a description of the exception + * @param sqlState an XOPEN or SQL:2003 code identifying the exception + * @param vendorCode a database vendor-specific exception code + * @param cause the underlying reason for this SQLException + * (which is saved for later retrieval by the getCause() method); + * may be null indicating the cause is non-existent or unknown. + * @since 1.6 + */ + public SQLException(String reason, String sqlState, int vendorCode, Throwable cause) { + super(reason,cause); + + this.SQLState = sqlState; + this.vendorCode = vendorCode; + if (!(this instanceof SQLWarning)) { + if (DriverManager.getLogWriter() != null) { + DriverManager.println("SQLState(" + SQLState + + ") vendor code(" + vendorCode + ")"); + printStackTrace(DriverManager.getLogWriter()); + } + } + } + + /** + * Retrieves the SQLState for this SQLException object. + * + * @return the SQLState value + */ + public String getSQLState() { + return (SQLState); + } + + /** + * Retrieves the vendor-specific exception code + * for this SQLException object. + * + * @return the vendor's error code + */ + public int getErrorCode() { + return (vendorCode); + } + + /** + * Retrieves the exception chained to this + * SQLException object by setNextException(SQLException ex). + * + * @return the next SQLException object in the chain; + * null if there are none + * @see #setNextException + */ + public SQLException getNextException() { + return (next); + } + + /** + * Adds an SQLException object to the end of the chain. + * + * @param ex the new exception that will be added to the end of + * the SQLException chain + * @see #getNextException + */ + public void setNextException(SQLException ex) { + + SQLException current = this; + for(;;) { + SQLException next=current.next; + if (next != null) { + current = next; + continue; + } + + if (nextUpdater.compareAndSet(current,null,ex)) { + return; + } + current=current.next; + } + } + + /** + * Returns an iterator over the chained SQLExceptions. The iterator will + * be used to iterate over each SQLException and its underlying cause + * (if any). + * + * @return an iterator over the chained SQLExceptions and causes in the proper + * order + * + * @since 1.6 + */ + public Iterator iterator() { + + return new Iterator() { + + SQLException firstException = SQLException.this; + SQLException nextException = firstException.getNextException(); + Throwable cause = firstException.getCause(); + + public boolean hasNext() { + if(firstException != null || nextException != null || cause != null) + return true; + return false; + } + + public Throwable next() { + Throwable throwable = null; + if(firstException != null){ + throwable = firstException; + firstException = null; + } + else if(cause != null){ + throwable = cause; + cause = cause.getCause(); + } + else if(nextException != null){ + throwable = nextException; + cause = nextException.getCause(); + nextException = nextException.getNextException(); + } + else + throw new NoSuchElementException(); + return throwable; + } + + public void remove() { + throw new UnsupportedOperationException(); + } + + }; + + } + + // J2ObjC-specific: remove dependency on atomic operation to reduce link dependencies. + static class NextExceptionUpdater { + private final Unsafe unsafe = Unsafe.getUnsafe(); + private final Field nextExceptionField = getNextExceptionField(); + private final long offset = unsafe.objectFieldOffset(nextExceptionField); + + public boolean compareAndSet(SQLException obj, SQLException expect, SQLException update) { + return unsafe.compareAndSwapObject(obj, offset, expect, update); + } + + private static Field getNextExceptionField() { + try { + return Class.forName("java.sql.SQLException").getDeclaredField("next"); + } catch (ClassNotFoundException | NoSuchFieldException | SecurityException e) { + // Should never happen, since both references are in this unit. + throw new AssertionError(); + } + } + } + + private static final NextExceptionUpdater nextUpdater = new NextExceptionUpdater(); + + /** + * @serial + */ + private String SQLState; + + /** + * @serial + */ + private int vendorCode; + + /** + * @serial + */ + private volatile SQLException next; + + private static final long serialVersionUID = 2135244094396331484L; +} diff --git a/jre_emul/java_sources.mk b/jre_emul/java_sources.mk index 28615b1e88..01c753f88e 100644 --- a/jre_emul/java_sources.mk +++ b/jre_emul/java_sources.mk @@ -578,6 +578,7 @@ JAVA_PRIVATE_SOURCES_CORE = \ sun/misc/FloatConsts.java \ sun/misc/FpUtils.java \ sun/misc/Hashing.java \ + sun/reflect/CallerSensitive.java \ sun/reflect/Reflection.java \ sun/reflect/annotation/AnnotationSupport.java \ sun/reflect/annotation/AnnotationType.java \