mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-24 09:10:08 +00:00
6589685: JDBC 4.1 updates
Reviewed-by: darcy
This commit is contained in:
parent
9dbee5740e
commit
36b68b66fa
@ -765,7 +765,6 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
|
||||
if( conn != null){
|
||||
// JDBC 4.0 mandates as does the Java EE spec that all DataBaseMetaData methods
|
||||
// must be implemented, therefore, the previous fix for 5055528 is being backed out
|
||||
|
||||
dbmslocatorsUpdateCopy = conn.getMetaData().locatorsUpdateCopy();
|
||||
}
|
||||
}
|
||||
@ -10131,5 +10130,14 @@ a
|
||||
|
||||
}
|
||||
|
||||
//------------------------- JDBC 4.1 -----------------------------------
|
||||
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported yet.");
|
||||
}
|
||||
|
||||
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported yet.");
|
||||
}
|
||||
|
||||
static final long serialVersionUID =1884577171200622428L;
|
||||
}
|
||||
|
||||
@ -7034,4 +7034,14 @@ a
|
||||
}
|
||||
|
||||
static final long serialVersionUID = -3591946023893483003L;
|
||||
|
||||
//------------------------- JDBC 4.1 -----------------------------------
|
||||
|
||||
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported yet.");
|
||||
}
|
||||
|
||||
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -2436,4 +2436,64 @@ public interface CallableStatement extends PreparedStatement {
|
||||
*/
|
||||
void setNClob(String parameterName, Reader reader)
|
||||
throws SQLException;
|
||||
|
||||
//------------------------- JDBC 4.1 -----------------------------------
|
||||
|
||||
|
||||
/**
|
||||
*<p>Returns an object representing the value of OUT parameter
|
||||
* {@code parameterIndex} and will convert from the
|
||||
* SQL type of the parameter to the requested Java data type, if the
|
||||
* conversion is supported. If the conversion is not
|
||||
* supported or null is specified for the type, a
|
||||
* <code>SQLException</code> is thrown.
|
||||
*<p>
|
||||
* At a minimum, an implementation must support the conversions defined in
|
||||
* Appendix B, Table B-3 and conversion of appropriate user defined SQL
|
||||
* types to a Java type which implements {@code SQLData}, or {@code Struct}.
|
||||
* Additional conversions may be supported and are vendor defined.
|
||||
*
|
||||
* @param parameterIndex the first parameter is 1, the second is 2, and so on
|
||||
* @param type Class representing the Java data type to convert the
|
||||
* designated parameter to.
|
||||
* @return an instance of {@code type} holding the OUT parameter value
|
||||
* @throws SQLException if conversion is not supported, type is null or
|
||||
* another error occurs. The getCause() method of the
|
||||
* exception may provide a more detailed exception, for example, if
|
||||
* a conversion error occurs
|
||||
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
|
||||
* this method
|
||||
* @since 1.7
|
||||
*/
|
||||
public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException;
|
||||
|
||||
|
||||
/**
|
||||
*<p>Returns an object representing the value of OUT parameter
|
||||
* {@code parameterName} and will convert from the
|
||||
* SQL type of the parameter to the requested Java data type, if the
|
||||
* conversion is supported. If the conversion is not
|
||||
* supported or null is specified for the type, a
|
||||
* <code>SQLException</code> is thrown.
|
||||
*<p>
|
||||
* At a minimum, an implementation must support the conversions defined in
|
||||
* Appendix B, Table B-3 and conversion of appropriate user defined SQL
|
||||
* types to a Java type which implements {@code SQLData}, or {@code Struct}.
|
||||
* Additional conversions may be supported and are vendor defined.
|
||||
*
|
||||
* @param parameterName the name of the parameter
|
||||
* @param type Class representing the Java data type to convert
|
||||
* the designated parameter to.
|
||||
* @return an instance of {@code type} holding the OUT parameter
|
||||
* value
|
||||
* @throws SQLException if conversion is not supported, type is null or
|
||||
* another error occurs. The getCause() method of the
|
||||
* exception may provide a more detailed exception, for example, if
|
||||
* a conversion error occurs
|
||||
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
|
||||
* this method
|
||||
* @since 1.7
|
||||
*/
|
||||
public <T> T getObject(String parameterName, Class<T> type) throws SQLException;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -26,6 +26,7 @@
|
||||
package java.sql;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* <P>A connection (session) with a specific
|
||||
@ -38,7 +39,7 @@ import java.util.Properties;
|
||||
* information is obtained with the <code>getMetaData</code> method.
|
||||
*
|
||||
* <P><B>Note:</B> When configuring a <code>Connection</code>, JDBC applications
|
||||
* should use the appropritate <code>Connection</code> method such as
|
||||
* should use the appropriate <code>Connection</code> method such as
|
||||
* <code>setAutoCommit</code> or <code>setTransactionIsolation</code>.
|
||||
* Applications should not invoke SQL commands directly to change the connection's
|
||||
* configuration when there is a JDBC method available. By default a <code>Connection</code> object is in
|
||||
@ -80,7 +81,7 @@ import java.util.Properties;
|
||||
* @see ResultSet
|
||||
* @see DatabaseMetaData
|
||||
*/
|
||||
public interface Connection extends Wrapper {
|
||||
public interface Connection extends Wrapper, AutoCloseable {
|
||||
|
||||
/**
|
||||
* Creates a <code>Statement</code> object for sending
|
||||
@ -347,6 +348,13 @@ public interface Connection extends Wrapper {
|
||||
* <P>
|
||||
* If the driver does not support catalogs, it will
|
||||
* silently ignore this request.
|
||||
* <p>
|
||||
* 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
|
||||
* <code>Connection</code> object's database) in which to work
|
||||
@ -598,7 +606,17 @@ public interface Connection extends Wrapper {
|
||||
* <code>Connection</code> object.
|
||||
* Unless the application has added an entry, the type map returned
|
||||
* will be empty.
|
||||
*
|
||||
* <p>
|
||||
* You must invoke <code>setTypeMap</code> after making changes to the
|
||||
* <code>Map</code> object returned from
|
||||
* <code>getTypeMap</code> as a JDBC driver may create an internal
|
||||
* copy of the <code>Map</code> object passed to <code>setTypeMap</code>:
|
||||
* <p>
|
||||
* <pre>
|
||||
* Map<String,Class<?>> myMap = con.getTypeMap();
|
||||
* myMap.put("mySchemaName.ATHLETES", Athletes.class);
|
||||
* con.setTypeMap(myMap);
|
||||
* </pre>
|
||||
* @return the <code>java.util.Map</code> object associated
|
||||
* with this <code>Connection</code> object
|
||||
* @exception SQLException if a database access error occurs
|
||||
@ -614,7 +632,16 @@ public interface Connection extends Wrapper {
|
||||
* Installs the given <code>TypeMap</code> object as the type map for
|
||||
* this <code>Connection</code> object. The type map will be used for the
|
||||
* custom mapping of SQL structured types and distinct types.
|
||||
*
|
||||
*<p>
|
||||
* You must set the the values for the <code>TypeMap</code> prior to
|
||||
* callng <code>setMap</code> as a JDBC driver may create an internal copy
|
||||
* of the <code>TypeMap</code>:
|
||||
* <p>
|
||||
* <pre>
|
||||
* Map myMap<String,Class<?>> = new HashMap<String,Class<?>>();
|
||||
* myMap.put("mySchemaName.ATHLETES", Athletes.class);
|
||||
* con.setTypeMap(myMap);
|
||||
* </pre>
|
||||
* @param map the <code>java.util.Map</code> object to install
|
||||
* as the replacement for this <code>Connection</code>
|
||||
* object's default type map
|
||||
@ -1274,4 +1301,186 @@ SQLException;
|
||||
*/
|
||||
Struct createStruct(String typeName, Object[] attributes)
|
||||
throws SQLException;
|
||||
|
||||
//--------------------------JDBC 4.1 -----------------------------
|
||||
|
||||
/**
|
||||
* Sets the given schema name to access.
|
||||
* <P>
|
||||
* If the driver does not support schemas, it will
|
||||
* silently ignore this request.
|
||||
* <p>
|
||||
* Calling {@code setSchema} 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 setSchema} should be called before a
|
||||
* {@code Statement} is created or prepared.
|
||||
*
|
||||
* @param schema the name of a schema in which to work
|
||||
* @exception SQLException if a database access error occurs
|
||||
* or this method is called on a closed connection
|
||||
* @see #getSchema
|
||||
* @since 1.7
|
||||
*/
|
||||
void setSchema(String schema) throws SQLException;
|
||||
|
||||
/**
|
||||
* Retrieves this <code>Connection</code> object's current schema name.
|
||||
*
|
||||
* @return the current schema name or <code>null</code> if there is none
|
||||
* @exception SQLException if a database access error occurs
|
||||
* or this method is called on a closed connection
|
||||
* @see #setSchema
|
||||
* @since 1.7
|
||||
*/
|
||||
String getSchema() throws SQLException;
|
||||
|
||||
/**
|
||||
* Terminates an open connection. Calling <code>abort</code> results in:
|
||||
* <ul>
|
||||
* <li>The connection marked as closed
|
||||
* <li>Closes any physical connection to the database
|
||||
* <li>Releases resources used by the connection
|
||||
* <li>Insures that any thread that is currently accessing the connection
|
||||
* will either progress to completion or throw an <code>SQLException</code>.
|
||||
* </ul>
|
||||
* <p>
|
||||
* Calling <code>abort</code> marks the connection closed and releases any
|
||||
* resources. Calling <code>abort</code> on a closed connection is a
|
||||
* no-op.
|
||||
* <p>
|
||||
* It is possible that the aborting and releasing of the resources that are
|
||||
* held by the connection can take an extended period of time. When the
|
||||
* <code>abort</code> method returns, the connection will have been marked as
|
||||
* closed and the <code>Executor</code> that was passed as a parameter to abort
|
||||
* may still be executing tasks to release resources.
|
||||
* <p>
|
||||
* This method checks to see that there is an <code>SQLPermission</code>
|
||||
* object before allowing the method to proceed. If a
|
||||
* <code>SecurityManager</code> exists and its
|
||||
* <code>checkPermission</code> method denies calling <code>abort</code>,
|
||||
* this method throws a
|
||||
* <code>java.lang.SecurityException</code>.
|
||||
* @param executor The <code>Executor</code> implementation which will
|
||||
* be used by <code>abort</code>.
|
||||
* @throws java.sql.SQLException if a database access error occurs or
|
||||
* the {@code executor} is {@code null},
|
||||
* @throws java.lang.SecurityException if a security manager exists and its
|
||||
* <code>checkPermission</code> method denies calling <code>abort</code>
|
||||
* @see SecurityManager#checkPermission
|
||||
* @see Executor
|
||||
* @since 1.7
|
||||
*/
|
||||
void abort(Executor executor) throws SQLException;
|
||||
|
||||
/**
|
||||
*
|
||||
* Sets the maximum period a <code>Connection</code> or
|
||||
* objects created from the <code>Connection</code>
|
||||
* will wait for the database to reply to any one request. If any
|
||||
* request remains unanswered, the waiting method will
|
||||
* return with a <code>SQLException</code>, and the <code>Connection</code>
|
||||
* or objects created from the <code>Connection</code> will be marked as
|
||||
* closed. Any subsequent use of
|
||||
* the objects, with the exception of the <code>close</code>,
|
||||
* <code>isClosed</code> or <code>Connection.isValid</code>
|
||||
* methods, will result in a <code>SQLException</code>.
|
||||
* <p>
|
||||
* <b>Note</b>: This method is intended to address a rare but serious
|
||||
* condition where network partitions can cause threads issuing JDBC calls
|
||||
* to hang uninterruptedly in socket reads, until the OS TCP-TIMEOUT
|
||||
* (typically 10 minutes). This method is related to the
|
||||
* {@link #abort abort() } method which provides an administrator
|
||||
* thread a means to free any such threads in cases where the
|
||||
* JDBC connection is accessible to the administrator thread.
|
||||
* The <code>setNetworkTimeout</code> method will cover cases where
|
||||
* there is no administrator thread, or it has no access to the
|
||||
* connection. This method is severe in it's effects, and should be
|
||||
* given a high enough value so it is never triggered before any more
|
||||
* normal timeouts, such as transaction timeouts.
|
||||
* <p>
|
||||
* JDBC driver implementations may also choose to support the
|
||||
* {@code setNetworkTimeout} method to impose a limit on database
|
||||
* response time, in environments where no network is present.
|
||||
* <p>
|
||||
* Drivers may internally implement some or all of their API calls with
|
||||
* multiple internal driver-database transmissions, and it is left to the
|
||||
* driver implementation to determine whether the limit will be
|
||||
* applied always to the response to the API call, or to any
|
||||
* single request made during the API call.
|
||||
* <p>
|
||||
*
|
||||
* This method can be invoked more than once, such as to set a limit for an
|
||||
* area of JDBC code, and to reset to the default on exit from this area.
|
||||
* Invocation of this method has no impact on already outstanding
|
||||
* requests.
|
||||
* <p>
|
||||
* The {@code Statement.setQueryTimeout()} timeout value is independent of the
|
||||
* timeout value specified in {@code setNetworkTimeout}. If the query timeout
|
||||
* expires before the network timeout then the
|
||||
* statement execution will be canceled. If the network is still
|
||||
* active the result will be that both the statement and connection
|
||||
* are still usable. However if the network timeout expires before
|
||||
* the query timeout or if the statement timeout fails due to network
|
||||
* problems, the connection will be marked as closed, any resources held by
|
||||
* the connection will be released and both the connection and
|
||||
* statement will be unusable.
|
||||
*<p>
|
||||
* When the driver determines that the {@code setNetworkTimeout} timeout
|
||||
* value has expired, the JDBC driver marks the connection
|
||||
* closed and releases any resources held by the connection.
|
||||
* <p>
|
||||
*
|
||||
* This method checks to see that there is an <code>SQLPermission</code>
|
||||
* object before allowing the method to proceed. If a
|
||||
* <code>SecurityManager</code> exists and its
|
||||
* <code>checkPermission</code> method denies calling
|
||||
* <code>setNetworkTimeout</code>, this method throws a
|
||||
* <code>java.lang.SecurityException</code>.
|
||||
*
|
||||
* @param executor The <code>Executor</code> implementation which will
|
||||
* be used by <code>setNetworkTimeout</code>.
|
||||
* @param milliseconds The time in milliseconds to wait for the database
|
||||
* operation
|
||||
* to complete. If the JDBC driver does not support milliseconds, the
|
||||
* JDBC driver will round the value up to the nearest second. If the
|
||||
* timeout period expires before the operation
|
||||
* completes, a SQLException will be thrown.
|
||||
* A value of 0 indicates that there is not timeout for database operations.
|
||||
* @throws java.sql.SQLException if a database access error occurs, this
|
||||
* method is called on a closed connection,
|
||||
* the {@code executor} is {@code null},
|
||||
* or the value specified for <code>seconds</code> is less than 0.
|
||||
* @throws java.lang.SecurityException if a security manager exists and its
|
||||
* <code>checkPermission</code> method denies calling
|
||||
* <code>setNetworkTimeout</code>.
|
||||
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support
|
||||
* this method
|
||||
* @see SecurityManager#checkPermission
|
||||
* @see Statement#setQueryTimeout
|
||||
* @see #getNetworkTimeout
|
||||
* @see #abort
|
||||
* @see Executor
|
||||
* @since 1.7
|
||||
*/
|
||||
void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the number of milliseconds the driver will
|
||||
* wait for a database request to complete.
|
||||
* If the limit is exceeded, a
|
||||
* <code>SQLException</code> is thrown.
|
||||
*
|
||||
* @return the current timeout limit in milliseconds; zero means there is
|
||||
* no limit
|
||||
* @throws SQLException if a database access error occurs or
|
||||
* this method is called on a closed <code>Connection</code>
|
||||
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support
|
||||
* this method
|
||||
* @see #setNetworkTimeout
|
||||
* @since 1.7
|
||||
*/
|
||||
int getNetworkTimeout() throws SQLException;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -1342,10 +1342,10 @@ public interface DatabaseMetaData extends Wrapper {
|
||||
* defined.
|
||||
* <LI><B>IS_NULLABLE</B> String => ISO rules are used to determine the nullability for a column.
|
||||
* <UL>
|
||||
* <LI> YES --- if the parameter can include NULLs
|
||||
* <LI> NO --- if the parameter cannot include NULLs
|
||||
* <LI> YES --- if the column can include NULLs
|
||||
* <LI> NO --- if the column cannot include NULLs
|
||||
* <LI> empty string --- if the nullability for the
|
||||
* parameter is unknown
|
||||
* column is unknown
|
||||
* </UL>
|
||||
* <LI><B>SPECIFIC_NAME</B> String => the name which uniquely identifies this procedure within its schema.
|
||||
* </OL>
|
||||
@ -1610,17 +1610,17 @@ public interface DatabaseMetaData extends Wrapper {
|
||||
* (starting at 1)
|
||||
* <LI><B>IS_NULLABLE</B> String => ISO rules are used to determine the nullability for a column.
|
||||
* <UL>
|
||||
* <LI> YES --- if the parameter can include NULLs
|
||||
* <LI> NO --- if the parameter cannot include NULLs
|
||||
* <LI> YES --- if the column can include NULLs
|
||||
* <LI> NO --- if the column cannot include NULLs
|
||||
* <LI> empty string --- if the nullability for the
|
||||
* parameter is unknown
|
||||
* column is unknown
|
||||
* </UL>
|
||||
* <LI><B>SCOPE_CATLOG</B> String => catalog of table that is the scope
|
||||
* <LI><B>SCOPE_CATALOG</B> String => catalog of table that is the scope
|
||||
* of a reference attribute (<code>null</code> if DATA_TYPE isn't REF)
|
||||
* <LI><B>SCOPE_SCHEMA</B> String => schema of table that is the scope
|
||||
* of a reference attribute (<code>null</code> if the DATA_TYPE isn't REF)
|
||||
* <LI><B>SCOPE_TABLE</B> String => table name that this the scope
|
||||
* of a reference attribure (<code>null</code> if the DATA_TYPE isn't REF)
|
||||
* of a reference attribute (<code>null</code> if the DATA_TYPE isn't REF)
|
||||
* <LI><B>SOURCE_DATA_TYPE</B> short => source type of a distinct type or user-generated
|
||||
* Ref type, SQL type from java.sql.Types (<code>null</code> if DATA_TYPE
|
||||
* isn't DISTINCT or user-generated REF)
|
||||
@ -1629,11 +1629,16 @@ public interface DatabaseMetaData extends Wrapper {
|
||||
* <LI> YES --- if the column is auto incremented
|
||||
* <LI> NO --- if the column is not auto incremented
|
||||
* <LI> empty string --- if it cannot be determined whether the column is auto incremented
|
||||
* parameter is unknown
|
||||
* </UL>
|
||||
* <LI><B>IS_GENERATEDCOLUMN</B> String => Indicates whether this is a generated column
|
||||
* <UL>
|
||||
* <LI> YES --- if this a generated column
|
||||
* <LI> NO --- if this not a generated column
|
||||
* <LI> empty string --- if it cannot be determined whether this is a generated column
|
||||
* </UL>
|
||||
* </OL>
|
||||
*
|
||||
* <p>The COLUMN_SIZE column the specified column size for the given column.
|
||||
* <p>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,
|
||||
@ -3186,7 +3191,7 @@ public interface DatabaseMetaData extends Wrapper {
|
||||
* Retrieves whether this database supports statement pooling.
|
||||
*
|
||||
* @return <code>true</code> if so; <code>false</code> otherwise
|
||||
* @throws SQLExcpetion if a database access error occurs
|
||||
* @throws SQLException if a database access error occurs
|
||||
* @since 1.4
|
||||
*/
|
||||
boolean supportsStatementPooling() throws SQLException;
|
||||
@ -3568,4 +3573,83 @@ public interface DatabaseMetaData extends Wrapper {
|
||||
*/
|
||||
int functionReturnsTable = 2;
|
||||
|
||||
//--------------------------JDBC 4.1 -----------------------------
|
||||
|
||||
/**
|
||||
* Retrieves a description of the pseudo or hidden columns available
|
||||
* in a given table within the specified catalog and schema.
|
||||
* Psuedo or hidden columns may not always be stored within
|
||||
* a table and are not visible in a ResultSet unless they are
|
||||
* specified in the query's outermost SELECT list. Psuedo or hidden
|
||||
* columns may not necessarily be able to be modified. If there are
|
||||
* no pseudo or hidden columns, an empty ResultSet is returned.
|
||||
*
|
||||
* <P>Only column descriptions matching the catalog, schema, table
|
||||
* and column name criteria are returned. They are ordered by
|
||||
* <code>TABLE_CAT</code>,<code>TABLE_SCHEM</code>, <code>TABLE_NAME</code>
|
||||
* and <code>COLUMN_NAME</code>.
|
||||
*
|
||||
* <P>Each column description has the following columns:
|
||||
* <OL>
|
||||
* <LI><B>TABLE_CAT</B> String => table catalog (may be <code>null</code>)
|
||||
* <LI><B>TABLE_SCHEM</B> String => table schema (may be <code>null</code>)
|
||||
* <LI><B>TABLE_NAME</B> String => table name
|
||||
* <LI><B>COLUMN_NAME</B> String => column name
|
||||
* <LI><B>DATA_TYPE</B> int => SQL type from java.sql.Types
|
||||
* <LI><B>COLUMN_SIZE</B> int => column size.
|
||||
* <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits. Null is returned for data types where
|
||||
* DECIMAL_DIGITS is not applicable.
|
||||
* <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
|
||||
* <LI><B>COLUMN_USAGE</B> String => The allowed usage for the column. The
|
||||
* value returned will correspond to the enum name returned by {@link PseudoColumnUsage#name PseudoColumnUsage.name()}
|
||||
* <LI><B>REMARKS</B> String => comment describing column (may be <code>null</code>)
|
||||
* <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
|
||||
* maximum number of bytes in the column
|
||||
* <LI><B>IS_NULLABLE</B> String => ISO rules are used to determine the nullability for a column.
|
||||
* <UL>
|
||||
* <LI> YES --- if the column can include NULLs
|
||||
* <LI> NO --- if the column cannot include NULLs
|
||||
* <LI> empty string --- if the nullability for the column is unknown
|
||||
* </UL>
|
||||
* </OL>
|
||||
*
|
||||
* <p>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;
|
||||
* <code>null</code> 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;
|
||||
* <code>null</code> 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 <code>ResultSet</code> - each row is a column description
|
||||
* @exception SQLException if a database access error occurs
|
||||
* @see PseudoColumnUsage
|
||||
* @since 1.7
|
||||
*/
|
||||
ResultSet getPseudoColumns(String catalog, String schemaPattern,
|
||||
String tableNamePattern, String columnNamePattern)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
* Retrieves whether a generated key will always be returned if the column
|
||||
* name(s) or indexe(s) specified for the auto generated key column(s)
|
||||
* are valid and the statement succeeds. The key that is returned may or
|
||||
* may not be based on the column(s) for the auto generated key.
|
||||
* Consult your JDBC driver documentation for additional details.
|
||||
* @return <code>true</code> if so; <code>false</code> otherwise
|
||||
* @exception SQLException if a database access error occurs
|
||||
* @since 1.7
|
||||
*/
|
||||
boolean generatedKeyAlwaysReturned() throws SQLException;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -96,11 +96,12 @@ public class Date extends java.util.Date {
|
||||
* a <code>Date</code> value.
|
||||
*
|
||||
* @param s a <code>String</code> object representing a date in
|
||||
* in the format "yyyy-mm-dd"
|
||||
* in the format "yyyy-[m]m-[d]d". The leading zero for <code>mm</code>
|
||||
* and <code>dd</code> may also be omitted.
|
||||
* @return a <code>java.sql.Date</code> object representing the
|
||||
* given date
|
||||
* @throws IllegalArgumentException if the date given is not in the
|
||||
* JDBC date escape format (yyyy-mm-dd)
|
||||
* JDBC date escape format (yyyy-[m]m-[d]d)
|
||||
*/
|
||||
public static Date valueOf(String s) {
|
||||
final int YEAR_LENGTH = 4;
|
||||
@ -123,8 +124,9 @@ public class Date extends java.util.Date {
|
||||
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() == MONTH_LENGTH &&
|
||||
dd.length() == DAY_LENGTH) {
|
||||
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);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
package java.sql;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* The interface that every driver class must implement.
|
||||
* <P>The Java SQL framework allows for multiple database drivers.
|
||||
@ -150,4 +152,19 @@ public interface Driver {
|
||||
* otherwise
|
||||
*/
|
||||
boolean jdbcCompliant();
|
||||
|
||||
//------------------------- JDBC 4.1 -----------------------------------
|
||||
|
||||
/**
|
||||
* Return the parent Logger of all the Loggers used by this driver. This
|
||||
* should be the Logger farthest from the root Logger that is
|
||||
* still an ancestor of all of the Loggers used by this driver. Configuring
|
||||
* this Logger will affect all of the log messages generated by the driver.
|
||||
* In the worst case, this may be the root Logger.
|
||||
*
|
||||
* @return the parent Logger for this driver
|
||||
* @throws SQLFeatureNotSupportedException if the driver does not use <code>java.util.logging<code>.
|
||||
* @since 1.7
|
||||
*/
|
||||
public Logger getParentLogger() throws SQLFeatureNotSupportedException;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -69,6 +69,10 @@ public interface PreparedStatement extends Statement {
|
||||
* @exception SQLException if a database access error occurs;
|
||||
* this method is called on a closed <code>PreparedStatement</code> or the SQL
|
||||
* statement does not return a <code>ResultSet</code> 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;
|
||||
|
||||
@ -82,8 +86,11 @@ public interface PreparedStatement extends Statement {
|
||||
* or (2) 0 for SQL statements that return nothing
|
||||
* @exception SQLException if a database access error occurs;
|
||||
* this method is called on a closed <code>PreparedStatement</code>
|
||||
* or the SQL
|
||||
* statement returns a <code>ResultSet</code> object
|
||||
* or the SQL statement returns a <code>ResultSet</code> 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;
|
||||
|
||||
@ -463,6 +470,10 @@ public interface PreparedStatement extends Statement {
|
||||
* @exception SQLException if a database access error occurs;
|
||||
* this method is called on a closed <code>PreparedStatement</code>
|
||||
* 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
|
||||
@ -1208,4 +1219,5 @@ public interface PreparedStatement extends Statement {
|
||||
void setNClob(int parameterIndex, Reader reader)
|
||||
throws SQLException;
|
||||
|
||||
|
||||
}
|
||||
|
||||
57
jdk/src/share/classes/java/sql/PseudoColumnUsage.java
Normal file
57
jdk/src/share/classes/java/sql/PseudoColumnUsage.java
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 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;
|
||||
|
||||
|
||||
/**
|
||||
* Enumeration for pseudo/hidden column usage.
|
||||
*
|
||||
* @since 1.7
|
||||
* @see DatabaseMetaData#getPseudoColumns
|
||||
*/
|
||||
public enum PseudoColumnUsage {
|
||||
|
||||
/**
|
||||
* The pseudo/hidden column may only be used in a SELECT list.
|
||||
*/
|
||||
SELECT_LIST_ONLY,
|
||||
|
||||
/**
|
||||
* The pseudo/hidden column may only be used in a WHERE clause.
|
||||
*/
|
||||
WHERE_CLAUSE_ONLY,
|
||||
|
||||
/**
|
||||
* There are no restrictions on the usage of the pseudo/hidden columns.
|
||||
*/
|
||||
NO_USAGE_RESTRICTIONS,
|
||||
|
||||
/**
|
||||
* The usage of the pseudo/hidden column cannot be determined.
|
||||
*/
|
||||
USAGE_UNKNOWN
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -145,7 +145,7 @@ import java.io.InputStream;
|
||||
* @see ResultSetMetaData
|
||||
*/
|
||||
|
||||
public interface ResultSet extends Wrapper {
|
||||
public interface ResultSet extends Wrapper, AutoCloseable {
|
||||
|
||||
/**
|
||||
* Moves the cursor froward one row from its current position.
|
||||
@ -1187,6 +1187,9 @@ public interface ResultSet extends Wrapper {
|
||||
* cursor on the last row; calling the method <code>absolute(-2)</code>
|
||||
* moves the cursor to the next-to-last row, and so on.
|
||||
*
|
||||
* <p>If the row number specified is zero, the cursor is moved to
|
||||
* before the first row.
|
||||
*
|
||||
* <p>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.
|
||||
@ -1196,9 +1199,10 @@ public interface ResultSet extends Wrapper {
|
||||
* is the same as calling <code>last()</code>.
|
||||
*
|
||||
* @param row the number of the row to which the cursor should move.
|
||||
* 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
|
||||
* 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 <code>true</code> if the cursor is moved to a position in this
|
||||
* <code>ResultSet</code> object;
|
||||
* <code>false</code> if the cursor is before the first row or after the
|
||||
@ -2529,7 +2533,7 @@ public interface ResultSet extends Wrapper {
|
||||
* @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
|
||||
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support
|
||||
* this method
|
||||
* @since 1.2
|
||||
*/
|
||||
@ -4072,4 +4076,64 @@ public interface ResultSet extends Wrapper {
|
||||
*/
|
||||
void updateNClob(String columnLabel, Reader reader) throws SQLException;
|
||||
|
||||
//------------------------- JDBC 4.1 -----------------------------------
|
||||
|
||||
|
||||
/**
|
||||
*<p>Retrieves the value of the designated column in the current row
|
||||
* of this <code>ResultSet</code> object and will convert from the
|
||||
* SQL type of the column to the requested Java data type, if the
|
||||
* conversion is supported. If the conversion is not
|
||||
* supported or null is specified for the type, a
|
||||
* <code>SQLException</code> is thrown.
|
||||
*<p>
|
||||
* At a minimum, an implementation must support the conversions defined in
|
||||
* Appendix B, Table B-3 and conversion of appropriate user defined SQL
|
||||
* types to a Java type which implements {@code SQLData}, or {@code Struct}.
|
||||
* Additional conversions may be supported and are vendor defined.
|
||||
*
|
||||
* @param columnIndex the first column is 1, the second is 2, ...
|
||||
* @param type Class representing the Java data type to convert the designated
|
||||
* column to.
|
||||
* @return an instance of {@code type} holding the column value
|
||||
* @throws SQLException if conversion is not supported, type is null or
|
||||
* another error occurs. The getCause() method of the
|
||||
* exception may provide a more detailed exception, for example, if
|
||||
* a conversion error occurs
|
||||
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
|
||||
* this method
|
||||
* @since 1.7
|
||||
*/
|
||||
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException;
|
||||
|
||||
|
||||
/**
|
||||
*<p>Retrieves the value of the designated column in the current row
|
||||
* of this <code>ResultSet</code> object and will convert from the
|
||||
* SQL type of the column to the requested Java data type, if the
|
||||
* conversion is supported. If the conversion is not
|
||||
* supported or null is specified for the type, a
|
||||
* <code>SQLException</code> is thrown.
|
||||
*<p>
|
||||
* At a minimum, an implementation must support the conversions defined in
|
||||
* Appendix B, Table B-3 and conversion of appropriate user defined SQL
|
||||
* types to a Java type which implements {@code SQLData}, or {@code Struct}.
|
||||
* Additional conversions may be supported and are vendor defined.
|
||||
*
|
||||
* @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 type Class representing the Java data type to convert the designated
|
||||
* column to.
|
||||
* @return an instance of {@code type} holding the column value
|
||||
* @throws SQLException if conversion is not supported, type is null or
|
||||
* another error occurs. The getCause() method of the
|
||||
* exception may provide a more detailed exception, for example, if
|
||||
* a conversion error occurs
|
||||
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
|
||||
* this method
|
||||
* @since 1.7
|
||||
*/
|
||||
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -30,9 +30,14 @@ import java.security.*;
|
||||
|
||||
/**
|
||||
* The permission for which the <code>SecurityManager</code> will check
|
||||
* when code that is running in an applet calls the
|
||||
* <code>DriverManager.setLogWriter</code> method or the
|
||||
* <code>DriverManager.setLogStream</code> (deprecated) method.
|
||||
* when code that is running in an applet, or an application with a
|
||||
* <code>SecurityManager</code> enabled, calls the
|
||||
* <code>DriverManager.setLogWriter</code> method,
|
||||
* <code>DriverManager.setLogStream</code> (deprecated) method,
|
||||
* {@code SyncFactory.setJNDIContext} method,
|
||||
* {@code SyncFactory.setLogger} method,
|
||||
* {@code Connection.setNetworktimeout} method,
|
||||
* or the <code>Connection.abort</code> method.
|
||||
* If there is no <code>SQLPermission</code> object, these methods
|
||||
* throw a <code>java.lang.SecurityException</code> as a runtime exception.
|
||||
* <P>
|
||||
@ -48,7 +53,6 @@ import java.security.*;
|
||||
* but <code>*loadLibrary</code> or <code>a*b</code> is not valid.
|
||||
* <P>
|
||||
* The following table lists all the possible <code>SQLPermission</code> target names.
|
||||
* Currently, the only name allowed is <code>setLog</code>.
|
||||
* The table gives a description of what the permission allows
|
||||
* and a discussion of the risks of granting code the permission.
|
||||
* <P>
|
||||
@ -67,9 +71,33 @@ import java.security.*;
|
||||
* The contents of the log may contain usernames and passwords,
|
||||
* SQL statements, and SQL data.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>callAbort</td>
|
||||
* <td>Allows the invocation of the {@code Connection} method
|
||||
* {@code abort}</td>
|
||||
* <td>Permits an application to terminate a physical connection to a
|
||||
* database.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>setSyncFactory</td>
|
||||
* <td>Allows the invocation of the {@code SyncFactory} methods
|
||||
* {@code setJNDIContext} and {@code setLogger}</td>
|
||||
* <td>Permits an application to specify the JNDI context from which the
|
||||
* {@code SyncProvider} implementations can be retrieved from and the logging
|
||||
* object to be used by the{@codeSyncProvider} implementation.</td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr>
|
||||
* <td>setNetworkTimeout</td>
|
||||
* <td>Allows the invocation of the {@code Connection} method
|
||||
* {@code setNetworkTimeout}</td>
|
||||
* <td>Permits an application to specify the maximum period a
|
||||
* <code>Connection</code> or
|
||||
* objects created from the <code>Connection</code>
|
||||
* will wait for the database to reply to any one request.</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
*<p>
|
||||
* The person running an applet decides what permissions to allow
|
||||
* and will run the <code>Policy Tool</code> to create an
|
||||
* <code>SQLPermission</code> in a policy file. A programmer does
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -40,20 +40,27 @@ package java.sql;
|
||||
* @see Connection#createStatement
|
||||
* @see ResultSet
|
||||
*/
|
||||
public interface Statement extends Wrapper {
|
||||
public interface Statement extends Wrapper, AutoCloseable {
|
||||
|
||||
/**
|
||||
* Executes the given SQL statement, which returns a single
|
||||
* <code>ResultSet</code> object.
|
||||
*
|
||||
*<p>
|
||||
* <strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @param sql an SQL statement to be sent to the database, typically a
|
||||
* static SQL <code>SELECT</code> statement
|
||||
* @return a <code>ResultSet</code> object that contains the data produced
|
||||
* by the given query; never <code>null</code>
|
||||
* @exception SQLException if a database access error occurs,
|
||||
* this method is called on a closed <code>Statement</code> or the given
|
||||
* this method is called on a closed <code>Statement</code>, the given
|
||||
* SQL statement produces anything other than a single
|
||||
* <code>ResultSet</code> object
|
||||
* <code>ResultSet</code> object, the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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;
|
||||
|
||||
@ -61,7 +68,9 @@ public interface Statement extends Wrapper {
|
||||
* Executes the given SQL statement, which may be an <code>INSERT</code>,
|
||||
* <code>UPDATE</code>, or <code>DELETE</code> statement or an
|
||||
* SQL statement that returns nothing, such as an SQL DDL statement.
|
||||
*
|
||||
*<p>
|
||||
* <strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
|
||||
* <code>DELETE</code>; or an SQL statement that returns nothing,
|
||||
* such as a DDL statement.
|
||||
@ -70,8 +79,13 @@ public interface Statement extends Wrapper {
|
||||
* or (2) 0 for SQL statements that return nothing
|
||||
*
|
||||
* @exception SQLException if a database access error occurs,
|
||||
* this method is called on a closed <code>Statement</code> or the given
|
||||
* SQL statement produces a <code>ResultSet</code> object
|
||||
* this method is called on a closed <code>Statement</code>, the given
|
||||
* SQL statement produces a <code>ResultSet</code> object, the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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;
|
||||
|
||||
@ -198,11 +212,21 @@ public interface Statement extends Wrapper {
|
||||
/**
|
||||
* Sets the number of seconds the driver will wait for a
|
||||
* <code>Statement</code> object to execute to the given number of seconds.
|
||||
* If the limit is exceeded, an <code>SQLException</code> is thrown. A JDBC
|
||||
* driver must apply this limit to the <code>execute</code>,
|
||||
* <code>executeQuery</code> and <code>executeUpdate</code> methods. JDBC driver
|
||||
* implementations may also apply this limit to <code>ResultSet</code> methods
|
||||
*By default there is no limit on the amount of time allowed for a running
|
||||
* statement to complete. If the limit is exceeded, an
|
||||
* <code>SQLTimeoutException</code> is thrown.
|
||||
* A JDBC driver must apply this limit to the <code>execute</code>,
|
||||
* <code>executeQuery</code> and <code>executeUpdate</code> methods.
|
||||
* <p>
|
||||
* <strong>Note:</strong> JDBC driver implementations may also apply this
|
||||
* limit to {@code ResultSet} methods
|
||||
* (consult your driver vendor documentation for details).
|
||||
* <p>
|
||||
* <strong>Note:</strong> 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
|
||||
@ -300,13 +324,21 @@ public interface Statement extends Wrapper {
|
||||
* <code>getResultSet</code> or <code>getUpdateCount</code>
|
||||
* to retrieve the result, and <code>getMoreResults</code> to
|
||||
* move to any subsequent result(s).
|
||||
*
|
||||
* <p>
|
||||
*<strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @param sql any SQL statement
|
||||
* @return <code>true</code> if the first result is a <code>ResultSet</code>
|
||||
* object; <code>false</code> if it is an update count or there are
|
||||
* no results
|
||||
* @exception SQLException if a database access error occurs or
|
||||
* this method is called on a closed <code>Statement</code>
|
||||
* @exception SQLException if a database access error occurs,
|
||||
* this method is called on a closed <code>Statement</code>,
|
||||
* the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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
|
||||
@ -465,12 +497,14 @@ public interface Statement extends Wrapper {
|
||||
* <code>Statement</code> object. The commands in this list can be
|
||||
* executed as a batch by calling the method <code>executeBatch</code>.
|
||||
* <P>
|
||||
*
|
||||
*<strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @param sql typically this is a SQL <code>INSERT</code> or
|
||||
* <code>UPDATE</code> statement
|
||||
* @exception SQLException if a database access error occurs,
|
||||
* this method is called on a closed <code>Statement</code> or the
|
||||
* driver does not support batch updates
|
||||
* this method is called on a closed <code>Statement</code>, the
|
||||
* driver does not support batch updates, the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @see #executeBatch
|
||||
* @see DatabaseMetaData#supportsBatchUpdates
|
||||
* @since 1.2
|
||||
@ -536,7 +570,10 @@ public interface Statement extends Wrapper {
|
||||
* driver does not support batch statements. Throws {@link BatchUpdateException}
|
||||
* (a subclass of <code>SQLException</code>) 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
|
||||
@ -678,7 +715,9 @@ public interface Statement extends Wrapper {
|
||||
* flag if the SQL statement
|
||||
* is not an <code>INSERT</code> statement, or an SQL statement able to return
|
||||
* auto-generated keys (the list of such statements is vendor-specific).
|
||||
*
|
||||
*<p>
|
||||
* <strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
|
||||
* <code>DELETE</code>; or an SQL statement that returns nothing,
|
||||
* such as a DDL statement.
|
||||
@ -693,10 +732,15 @@ public interface Statement extends Wrapper {
|
||||
*
|
||||
* @exception SQLException if a database access error occurs,
|
||||
* this method is called on a closed <code>Statement</code>, the given
|
||||
* SQL statement returns a <code>ResultSet</code> object, or
|
||||
* the given constant is not one of those allowed
|
||||
* SQL statement returns a <code>ResultSet</code> object,
|
||||
* the given constant is not one of those allowed, the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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;
|
||||
@ -709,7 +753,9 @@ public interface Statement extends Wrapper {
|
||||
* available. The driver will ignore the array if the SQL statement
|
||||
* is not an <code>INSERT</code> statement, or an SQL statement able to return
|
||||
* auto-generated keys (the list of such statements is vendor-specific).
|
||||
*
|
||||
*<p>
|
||||
* <strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
|
||||
* <code>DELETE</code>; or an SQL statement that returns nothing,
|
||||
* such as a DDL statement.
|
||||
@ -721,10 +767,15 @@ public interface Statement extends Wrapper {
|
||||
*
|
||||
* @exception SQLException if a database access error occurs,
|
||||
* this method is called on a closed <code>Statement</code>, the SQL
|
||||
* statement returns a <code>ResultSet</code> object, or the
|
||||
* second argument supplied to this method is not an <code>int</code> array
|
||||
* whose elements are valid column indexes
|
||||
* statement returns a <code>ResultSet</code> object,the second argument
|
||||
* supplied to this method is not an
|
||||
* <code>int</code> array whose elements are valid column indexes, the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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;
|
||||
@ -737,7 +788,9 @@ public interface Statement extends Wrapper {
|
||||
* available. The driver will ignore the array if the SQL statement
|
||||
* is not an <code>INSERT</code> statement, or an SQL statement able to return
|
||||
* auto-generated keys (the list of such statements is vendor-specific).
|
||||
*
|
||||
*<p>
|
||||
* <strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
|
||||
* <code>DELETE</code>; or an SQL statement that returns nothing,
|
||||
* such as a DDL statement.
|
||||
@ -748,11 +801,15 @@ public interface Statement extends Wrapper {
|
||||
* that return nothing
|
||||
* @exception SQLException if a database access error occurs,
|
||||
* this method is called on a closed <code>Statement</code>, the SQL
|
||||
* statement returns a <code>ResultSet</code> object, or the
|
||||
* statement returns a <code>ResultSet</code> object, the
|
||||
* second argument supplied to this method is not a <code>String</code> array
|
||||
* whose elements are valid column names
|
||||
*
|
||||
* whose elements are valid column names, the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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;
|
||||
@ -776,7 +833,9 @@ public interface Statement extends Wrapper {
|
||||
* <code>getResultSet</code> or <code>getUpdateCount</code>
|
||||
* to retrieve the result, and <code>getMoreResults</code> to
|
||||
* move to any subsequent result(s).
|
||||
*
|
||||
*<p>
|
||||
*<strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @param sql any SQL statement
|
||||
* @param autoGeneratedKeys a constant indicating whether auto-generated
|
||||
* keys should be made available for retrieval using the method
|
||||
@ -787,12 +846,18 @@ public interface Statement extends Wrapper {
|
||||
* object; <code>false</code> 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 <code>Statement</code> or the second
|
||||
* this method is called on a closed <code>Statement</code>, the second
|
||||
* parameter supplied to this method is not
|
||||
* <code>Statement.RETURN_GENERATED_KEYS</code> or
|
||||
* <code>Statement.NO_GENERATED_KEYS</code>.
|
||||
* <code>Statement.NO_GENERATED_KEYS</code>,
|
||||
* the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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
|
||||
@ -823,7 +888,9 @@ public interface Statement extends Wrapper {
|
||||
* <code>getResultSet</code> or <code>getUpdateCount</code>
|
||||
* to retrieve the result, and <code>getMoreResults</code> to
|
||||
* move to any subsequent result(s).
|
||||
*
|
||||
*<p>
|
||||
* <strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @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
|
||||
@ -832,10 +899,15 @@ public interface Statement extends Wrapper {
|
||||
* object; <code>false</code> 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 <code>Statement</code> or the
|
||||
* this method is called on a closed <code>Statement</code>, the
|
||||
* elements in the <code>int</code> array passed to this method
|
||||
* are not valid column indexes
|
||||
* are not valid column indexes, the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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
|
||||
@ -865,7 +937,9 @@ public interface Statement extends Wrapper {
|
||||
* <code>getResultSet</code> or <code>getUpdateCount</code>
|
||||
* to retrieve the result, and <code>getMoreResults</code> to
|
||||
* move to any subsequent result(s).
|
||||
*
|
||||
*<p>
|
||||
* <strong>Note:</strong>This method cannot be called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>.
|
||||
* @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
|
||||
@ -874,10 +948,15 @@ public interface Statement extends Wrapper {
|
||||
* object; <code>false</code> 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 <code>Statement</code> or the
|
||||
* this method is called on a closed <code>Statement</code>,the
|
||||
* elements of the <code>String</code> array passed to this
|
||||
* method are not valid column names
|
||||
* method are not valid column names, the method is called on a
|
||||
* <code>PreparedStatement</code> or <code>CallableStatement</code>
|
||||
* @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
|
||||
@ -951,4 +1030,34 @@ public interface Statement extends Wrapper {
|
||||
boolean isPoolable()
|
||||
throws SQLException;
|
||||
|
||||
//--------------------------JDBC 4.1 -----------------------------
|
||||
|
||||
/**
|
||||
* Specifies that this {@code Statement} will be closed when all its
|
||||
* dependent result sets are closed. If execution of the {@code Statement}
|
||||
* does not produce any result sets, this method has no effect.
|
||||
* <p>
|
||||
* <strong>Note:</strong> Multiple calls to {@code closeOnCompletion} do
|
||||
* not toggle the effect on this {@code Statement}. However, a call to
|
||||
* {@code closeOnCompletion} does effect both the subsequent execution of
|
||||
* statements, and statements that currently have open, dependent,
|
||||
* result sets.
|
||||
*
|
||||
* @throws SQLException if this method is called on a closed
|
||||
* {@code Statement}
|
||||
* @since 1.7
|
||||
*/
|
||||
public void closeOnCompletion() throws SQLException;
|
||||
|
||||
/**
|
||||
* Returns a value indicating whether this {@code Statement} will be
|
||||
* closed when all dependent objects such as resultsets are closed.
|
||||
* @return {@code true} if the {@code Statement} will be closed when all
|
||||
* of its dependent objects are closed; {@code false} otherwise
|
||||
* @throws SQLException if this method is called on a closed
|
||||
* {@code Statement}
|
||||
* @since 1.7
|
||||
*/
|
||||
public boolean isCloseOnCompletion() throws SQLException;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -155,19 +155,26 @@ public class Timestamp extends java.util.Date {
|
||||
* Converts a <code>String</code> object in JDBC timestamp escape format to a
|
||||
* <code>Timestamp</code> value.
|
||||
*
|
||||
* @param s timestamp in format <code>yyyy-mm-dd hh:mm:ss[.f...]</code>. The
|
||||
* fractional seconds may be omitted.
|
||||
* @param s timestamp in format <code>yyyy-[m]m-[d]d hh:mm:ss[.f...]</code>. The
|
||||
* fractional seconds may be omitted. The leading zero for <code>mm</code>
|
||||
* and <code>dd</code> may also be omitted.
|
||||
*
|
||||
* @return corresponding <code>Timestamp</code> value
|
||||
* @exception java.lang.IllegalArgumentException if the given argument
|
||||
* does not have the format <code>yyyy-mm-dd hh:mm:ss[.f...]</code>
|
||||
* does not have the format <code>yyyy-[m]m-[d]d hh:mm:ss[.f...]</code>
|
||||
*/
|
||||
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;
|
||||
int month;
|
||||
int day;
|
||||
int year = 0;
|
||||
int month = 0;
|
||||
int day = 0;
|
||||
int hour;
|
||||
int minute;
|
||||
int second;
|
||||
@ -182,17 +189,9 @@ public class Timestamp extends java.util.Date {
|
||||
String zeros = "000000000";
|
||||
String delimiterDate = "-";
|
||||
String delimiterTime = ":";
|
||||
StringTokenizer stringTokeninzerDate;
|
||||
StringTokenizer stringTokeninzerTime;
|
||||
|
||||
if (s == null) throw new java.lang.IllegalArgumentException("null string");
|
||||
|
||||
int counterD = 0;
|
||||
int intDate[] = {4,2,2};
|
||||
|
||||
int counterT = 0;
|
||||
int intTime[] = {2,2,12};
|
||||
|
||||
// Split the string into date and time components
|
||||
s = s.trim();
|
||||
dividingSpace = s.indexOf(' ');
|
||||
@ -203,30 +202,6 @@ public class Timestamp extends java.util.Date {
|
||||
throw new java.lang.IllegalArgumentException(formatError);
|
||||
}
|
||||
|
||||
stringTokeninzerTime = new StringTokenizer(time_s, delimiterTime);
|
||||
stringTokeninzerDate = new StringTokenizer(date_s, delimiterDate);
|
||||
|
||||
while(stringTokeninzerDate.hasMoreTokens()) {
|
||||
String tokenDate = stringTokeninzerDate.nextToken();
|
||||
if(tokenDate.length() != intDate[counterD] ) {
|
||||
throw new java.lang.IllegalArgumentException(formatError);
|
||||
}
|
||||
counterD++;
|
||||
}
|
||||
|
||||
/*
|
||||
//Commenting this portion out for checking of time
|
||||
|
||||
while(stringTokeninzerTime.hasMoreTokens()) {
|
||||
String tokenTime = stringTokeninzerTime.nextToken();
|
||||
|
||||
if (counterT < 2 && tokenTime.length() != intTime[counterT] ) {
|
||||
throw new java.lang.IllegalArgumentException(formatError);
|
||||
}
|
||||
counterT++;
|
||||
}
|
||||
*/
|
||||
|
||||
// Parse the date
|
||||
firstDash = date_s.indexOf('-');
|
||||
secondDash = date_s.indexOf('-', firstDash+1);
|
||||
@ -239,14 +214,24 @@ public class Timestamp extends java.util.Date {
|
||||
period = time_s.indexOf('.', secondColon+1);
|
||||
|
||||
// Convert the date
|
||||
if ((firstDash > 0) && (secondDash > 0) &&
|
||||
(secondDash < date_s.length()-1)) {
|
||||
year = Integer.parseInt(date_s.substring(0, firstDash)) - 1900;
|
||||
month =
|
||||
Integer.parseInt(date_s.substring
|
||||
(firstDash+1, secondDash)) - 1;
|
||||
day = Integer.parseInt(date_s.substring(secondDash+1));
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -272,10 +257,10 @@ public class Timestamp extends java.util.Date {
|
||||
second = Integer.parseInt(time_s.substring(secondColon+1));
|
||||
}
|
||||
} else {
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
throw new java.lang.IllegalArgumentException(formatError);
|
||||
}
|
||||
|
||||
return new Timestamp(year, month, day, hour, minute, second, a_nanos);
|
||||
return new Timestamp(year - 1900, month - 1, day, hour, minute, second, a_nanos);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -502,14 +487,10 @@ public class Timestamp extends java.util.Date {
|
||||
|
||||
/**
|
||||
* Compares this <code>Timestamp</code> object to the given
|
||||
* <code>Date</code>, which must be a <code>Timestamp</code>
|
||||
* object. If the argument is not a <code>Timestamp</code> object,
|
||||
* this method throws a <code>ClassCastException</code> object.
|
||||
* (<code>Timestamp</code> objects are
|
||||
* comparable only to other <code>Timestamp</code> objects.)
|
||||
* <code>Date</code> object.
|
||||
*
|
||||
* @param o the <code>Date</code> to be compared, which must be a
|
||||
* <code>Timestamp</code> object
|
||||
* @param o the <code>Date</code> to be compared to
|
||||
* this <code>Timestamp</code> object
|
||||
* @return the value <code>0</code> if this <code>Timestamp</code> object
|
||||
* and the given object are equal; a value less than <code>0</code>
|
||||
* if this <code>Timestamp</code> object is before the given argument;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -27,6 +27,8 @@ package javax.sql;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Interface that defines the methods which are common between <code>DataSource</code>,
|
||||
@ -35,79 +37,93 @@ import java.io.PrintWriter;
|
||||
*/
|
||||
public interface CommonDataSource {
|
||||
|
||||
/**
|
||||
* <p>Retrieves the log writer for this <code>DataSource</code>
|
||||
* object.
|
||||
*
|
||||
* <p>The log writer is a character output stream to which all logging
|
||||
* and tracing messages for this data source will be
|
||||
* printed. This includes messages printed by the methods of this
|
||||
* object, messages printed by methods of other objects manufactured
|
||||
* by this object, and so on. Messages printed to a data source
|
||||
* specific log writer are not printed to the log writer associated
|
||||
* with the <code>java.sql.DriverManager</code> class. When a
|
||||
* <code>DataSource</code> object is
|
||||
* created, the log writer is initially null; in other words, the
|
||||
* default is for logging to be disabled.
|
||||
*
|
||||
* @return the log writer for this data source or null if
|
||||
* logging is disabled
|
||||
* @exception java.sql.SQLException if a database access error occurs
|
||||
* @see #setLogWriter
|
||||
* @since 1.4
|
||||
*/
|
||||
java.io.PrintWriter getLogWriter() throws SQLException;
|
||||
/**
|
||||
* <p>Retrieves the log writer for this <code>DataSource</code>
|
||||
* object.
|
||||
*
|
||||
* <p>The log writer is a character output stream to which all logging
|
||||
* and tracing messages for this data source will be
|
||||
* printed. This includes messages printed by the methods of this
|
||||
* object, messages printed by methods of other objects manufactured
|
||||
* by this object, and so on. Messages printed to a data source
|
||||
* specific log writer are not printed to the log writer associated
|
||||
* with the <code>java.sql.DriverManager</code> class. When a
|
||||
* <code>DataSource</code> object is
|
||||
* created, the log writer is initially null; in other words, the
|
||||
* default is for logging to be disabled.
|
||||
*
|
||||
* @return the log writer for this data source or null if
|
||||
* logging is disabled
|
||||
* @exception java.sql.SQLException if a database access error occurs
|
||||
* @see #setLogWriter
|
||||
* @since 1.4
|
||||
*/
|
||||
java.io.PrintWriter getLogWriter() throws SQLException;
|
||||
|
||||
/**
|
||||
* <p>Sets the log writer for this <code>DataSource</code>
|
||||
* object to the given <code>java.io.PrintWriter</code> object.
|
||||
*
|
||||
* <p>The log writer is a character output stream to which all logging
|
||||
* and tracing messages for this data source will be
|
||||
* printed. This includes messages printed by the methods of this
|
||||
* object, messages printed by methods of other objects manufactured
|
||||
* by this object, and so on. Messages printed to a data source-
|
||||
* specific log writer are not printed to the log writer associated
|
||||
* with the <code>java.sql.DriverManager</code> class. When a
|
||||
* <code>DataSource</code> object is created the log writer is
|
||||
* initially null; in other words, the default is for logging to be
|
||||
* disabled.
|
||||
*
|
||||
* @param out the new log writer; to disable logging, set to null
|
||||
* @exception SQLException if a database access error occurs
|
||||
* @see #getLogWriter
|
||||
* @since 1.4
|
||||
*/
|
||||
void setLogWriter(java.io.PrintWriter out) throws SQLException;
|
||||
/**
|
||||
* <p>Sets the log writer for this <code>DataSource</code>
|
||||
* object to the given <code>java.io.PrintWriter</code> object.
|
||||
*
|
||||
* <p>The log writer is a character output stream to which all logging
|
||||
* and tracing messages for this data source will be
|
||||
* printed. This includes messages printed by the methods of this
|
||||
* object, messages printed by methods of other objects manufactured
|
||||
* by this object, and so on. Messages printed to a data source-
|
||||
* specific log writer are not printed to the log writer associated
|
||||
* with the <code>java.sql.DriverManager</code> class. When a
|
||||
* <code>DataSource</code> object is created the log writer is
|
||||
* initially null; in other words, the default is for logging to be
|
||||
* disabled.
|
||||
*
|
||||
* @param out the new log writer; to disable logging, set to null
|
||||
* @exception SQLException if a database access error occurs
|
||||
* @see #getLogWriter
|
||||
* @since 1.4
|
||||
*/
|
||||
void setLogWriter(java.io.PrintWriter out) throws SQLException;
|
||||
|
||||
/**
|
||||
* <p>Sets the maximum time in seconds that this data source will wait
|
||||
* while attempting to connect to a database. A value of zero
|
||||
* specifies that the timeout is the default system timeout
|
||||
* if there is one; otherwise, it specifies that there is no timeout.
|
||||
* When a <code>DataSource</code> object is created, the login timeout is
|
||||
* initially zero.
|
||||
*
|
||||
* @param seconds the data source login time limit
|
||||
* @exception SQLException if a database access error occurs.
|
||||
* @see #getLoginTimeout
|
||||
* @since 1.4
|
||||
*/
|
||||
void setLoginTimeout(int seconds) throws SQLException;
|
||||
/**
|
||||
* <p>Sets the maximum time in seconds that this data source will wait
|
||||
* while attempting to connect to a database. A value of zero
|
||||
* specifies that the timeout is the default system timeout
|
||||
* if there is one; otherwise, it specifies that there is no timeout.
|
||||
* When a <code>DataSource</code> object is created, the login timeout is
|
||||
* initially zero.
|
||||
*
|
||||
* @param seconds the data source login time limit
|
||||
* @exception SQLException if a database access error occurs.
|
||||
* @see #getLoginTimeout
|
||||
* @since 1.4
|
||||
*/
|
||||
void setLoginTimeout(int seconds) throws SQLException;
|
||||
|
||||
/**
|
||||
* Gets the maximum time in seconds that this data source can wait
|
||||
* while attempting to connect to a database. A value of zero
|
||||
* means that the timeout is the default system timeout
|
||||
* if there is one; otherwise, it means that there is no timeout.
|
||||
* When a <code>DataSource</code> object is created, the login timeout is
|
||||
* initially zero.
|
||||
*
|
||||
* @return the data source login time limit
|
||||
* @exception SQLException if a database access error occurs.
|
||||
* @see #setLoginTimeout
|
||||
* @since 1.4
|
||||
*/
|
||||
int getLoginTimeout() throws SQLException;
|
||||
/**
|
||||
* Gets the maximum time in seconds that this data source can wait
|
||||
* while attempting to connect to a database. A value of zero
|
||||
* means that the timeout is the default system timeout
|
||||
* if there is one; otherwise, it means that there is no timeout.
|
||||
* When a <code>DataSource</code> object is created, the login timeout is
|
||||
* initially zero.
|
||||
*
|
||||
* @return the data source login time limit
|
||||
* @exception SQLException if a database access error occurs.
|
||||
* @see #setLoginTimeout
|
||||
* @since 1.4
|
||||
*/
|
||||
int getLoginTimeout() throws SQLException;
|
||||
|
||||
//------------------------- JDBC 4.1 -----------------------------------
|
||||
|
||||
/**
|
||||
* Return the parent Logger of all the Loggers used by this data source. This
|
||||
* should be the Logger farthest from the root Logger that is
|
||||
* still an ancestor of all of the Loggers used by this data source. Configuring
|
||||
* this Logger will affect all of the log messages generated by the data source.
|
||||
* In the worst case, this may be the root Logger.
|
||||
*
|
||||
* @return the parent Logger for this data source
|
||||
* @throws SQLFeatureNotSupportedException if the data source does not use <code>java.util.logging<code>.
|
||||
* @since 1.7
|
||||
*/
|
||||
public Logger getParentLogger() throws SQLFeatureNotSupportedException;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user