Commit f2390fad by Bryce McKinlay Committed by Bryce McKinlay

Reformat JDBC classes and add new JDK 1.4 classes and methods.

	* java/sql/ParameterMetaData.java, java/sql/SQLPermission.java,
	java/sql/Savepoint.java: New files.
	* java/sql/Array.java, java/sql/BatchUpdateException.java,
	java/sql/Blob.java, java/sql/CallableStatement.java,
	java/sql/Clob.java, java/sql/Connection.java,
	java/sql/DataTruncation.java, java/sql/DatabaseMetaData.java,
	java/sql/Date.java, java/sql/Driver.java,
	java/sql/DriverManager.java,
	java/sql/DriverPropertyInfo.java, java/sql/PreparedStatement.java,
	java/sql/Ref.java, java/sql/ResultSet.java,
	java/sql/ResultSetMetaData.java, java/sql/SQLData.java
	java/sql/SQLException.java, java/sql/SQLInput.java,
	java/sql/SQLOutput.java, java/sql/SQLWarning.java
	java/sql/Statement.java, java/sql/Struct.java, java/sql/Time.java,
	java/sql/Timestamp.java, java/sql/Types.java: Updated to JDBC 3.0
	(JDK 1.4) specification.
	* javax/sql/ConnectionEvent.java,
	javax/sql/ConnectionEventListener.java,
	javax/sql/ConnectionPoolDataSource.java,
	javax/sql/DataSource.java, javax/sql/PooledConnection.java,
	javax/sql/RowSetEvent.java, javax/sql/RowSetInternal.java,
	javax/sql/RowSet.java, javax/sql/RowSetListener.java,
	javax/sql/RowSetMetaData.java, javax/sql/RowSetReader.java,
	javax/sql/RowSetWriter.java, javax/sql/XAConnection.java,
	javax/sql/XADataSource.java: New files.
	* Makefile.am: Add new files.
	* Makefile.in: Rebuilt.

From-SVN: r54871
parent 00b94a44
2002-06-21 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
Reformat JDBC classes and add new JDK 1.4 classes and methods.
* java/sql/ParameterMetaData.java, java/sql/SQLPermission.java,
java/sql/Savepoint.java: New files.
* java/sql/Array.java, java/sql/BatchUpdateException.java,
java/sql/Blob.java, java/sql/CallableStatement.java,
java/sql/Clob.java, java/sql/Connection.java,
java/sql/DataTruncation.java, java/sql/DatabaseMetaData.java,
java/sql/Date.java, java/sql/Driver.java, java/sql/DriverManager.java,
java/sql/DriverPropertyInfo.java, java/sql/PreparedStatement.java,
java/sql/Ref.java, java/sql/ResultSet.java,
java/sql/ResultSetMetaData.java, java/sql/SQLData.java
java/sql/SQLException.java, java/sql/SQLInput.java,
java/sql/SQLOutput.java, java/sql/SQLWarning.java
java/sql/Statement.java, java/sql/Struct.java, java/sql/Time.java,
java/sql/Timestamp.java, java/sql/Types.java: Updated to JDBC 3.0
(JDK 1.4) specification.
* javax/sql/ConnectionEvent.java,
javax/sql/ConnectionEventListener.java,
javax/sql/ConnectionPoolDataSource.java,
javax/sql/DataSource.java, javax/sql/PooledConnection.java,
javax/sql/RowSetEvent.java, javax/sql/RowSetInternal.java,
javax/sql/RowSet.java, javax/sql/RowSetListener.java,
javax/sql/RowSetMetaData.java, javax/sql/RowSetReader.java,
javax/sql/RowSetWriter.java, javax/sql/XAConnection.java,
javax/sql/XADataSource.java: New files.
* Makefile.am: Add new files.
* Makefile.in: Rebuilt.
2002-06-20 Tom Tromey <tromey@redhat.com> 2002-06-20 Tom Tromey <tromey@redhat.com>
For PR libgcj/7073: For PR libgcj/7073:
......
...@@ -997,6 +997,20 @@ javax/naming/ldap/UnsolicitedNotification.java \ ...@@ -997,6 +997,20 @@ javax/naming/ldap/UnsolicitedNotification.java \
javax/naming/ldap/UnsolicitedNotificationEvent.java \ javax/naming/ldap/UnsolicitedNotificationEvent.java \
javax/naming/ldap/UnsolicitedNotificationListener.java \ javax/naming/ldap/UnsolicitedNotificationListener.java \
javax/naming/OperationNotSupportedException.java \ javax/naming/OperationNotSupportedException.java \
javax/sql/ConnectionEvent.java \
javax/sql/ConnectionEventListener.java \
javax/sql/ConnectionPoolDataSource.java \
javax/sql/DataSource.java \
javax/sql/PooledConnection.java \
javax/sql/RowSetEvent.java \
javax/sql/RowSetInternal.java \
javax/sql/RowSet.java \
javax/sql/RowSetListener.java \
javax/sql/RowSetMetaData.java \
javax/sql/RowSetReader.java \
javax/sql/RowSetWriter.java \
javax/sql/XAConnection.java \
javax/sql/XADataSource.java \
javax/transaction/xa/XAException.java \ javax/transaction/xa/XAException.java \
javax/transaction/xa/XAResource.java \ javax/transaction/xa/XAResource.java \
javax/transaction/xa/Xid.java \ javax/transaction/xa/Xid.java \
...@@ -1604,14 +1618,17 @@ java/sql/Date.java \ ...@@ -1604,14 +1618,17 @@ java/sql/Date.java \
java/sql/Driver.java \ java/sql/Driver.java \
java/sql/DriverManager.java \ java/sql/DriverManager.java \
java/sql/DriverPropertyInfo.java \ java/sql/DriverPropertyInfo.java \
java/sql/ParameterMetaData.java \
java/sql/PreparedStatement.java \ java/sql/PreparedStatement.java \
java/sql/Ref.java \ java/sql/Ref.java \
java/sql/ResultSet.java \ java/sql/ResultSet.java \
java/sql/ResultSetMetaData.java \ java/sql/ResultSetMetaData.java \
java/sql/Savepoint.java \
java/sql/SQLData.java \ java/sql/SQLData.java \
java/sql/SQLException.java \ java/sql/SQLException.java \
java/sql/SQLInput.java \ java/sql/SQLInput.java \
java/sql/SQLOutput.java \ java/sql/SQLOutput.java \
java/sql/SQLPermission.java \
java/sql/SQLWarning.java \ java/sql/SQLWarning.java \
java/sql/Statement.java \ java/sql/Statement.java \
java/sql/Struct.java \ java/sql/Struct.java \
......
...@@ -768,6 +768,20 @@ javax/naming/ldap/UnsolicitedNotification.java \ ...@@ -768,6 +768,20 @@ javax/naming/ldap/UnsolicitedNotification.java \
javax/naming/ldap/UnsolicitedNotificationEvent.java \ javax/naming/ldap/UnsolicitedNotificationEvent.java \
javax/naming/ldap/UnsolicitedNotificationListener.java \ javax/naming/ldap/UnsolicitedNotificationListener.java \
javax/naming/OperationNotSupportedException.java \ javax/naming/OperationNotSupportedException.java \
javax/sql/ConnectionEvent.java \
javax/sql/ConnectionEventListener.java \
javax/sql/ConnectionPoolDataSource.java \
javax/sql/DataSource.java \
javax/sql/PooledConnection.java \
javax/sql/RowSetEvent.java \
javax/sql/RowSetInternal.java \
javax/sql/RowSet.java \
javax/sql/RowSetListener.java \
javax/sql/RowSetMetaData.java \
javax/sql/RowSetReader.java \
javax/sql/RowSetWriter.java \
javax/sql/XAConnection.java \
javax/sql/XADataSource.java \
javax/transaction/xa/XAException.java \ javax/transaction/xa/XAException.java \
javax/transaction/xa/XAResource.java \ javax/transaction/xa/XAResource.java \
javax/transaction/xa/Xid.java \ javax/transaction/xa/Xid.java \
...@@ -1366,14 +1380,17 @@ java/sql/Date.java \ ...@@ -1366,14 +1380,17 @@ java/sql/Date.java \
java/sql/Driver.java \ java/sql/Driver.java \
java/sql/DriverManager.java \ java/sql/DriverManager.java \
java/sql/DriverPropertyInfo.java \ java/sql/DriverPropertyInfo.java \
java/sql/ParameterMetaData.java \
java/sql/PreparedStatement.java \ java/sql/PreparedStatement.java \
java/sql/Ref.java \ java/sql/Ref.java \
java/sql/ResultSet.java \ java/sql/ResultSet.java \
java/sql/ResultSetMetaData.java \ java/sql/ResultSetMetaData.java \
java/sql/Savepoint.java \
java/sql/SQLData.java \ java/sql/SQLData.java \
java/sql/SQLException.java \ java/sql/SQLException.java \
java/sql/SQLInput.java \ java/sql/SQLInput.java \
java/sql/SQLOutput.java \ java/sql/SQLOutput.java \
java/sql/SQLPermission.java \
java/sql/SQLWarning.java \ java/sql/SQLWarning.java \
java/sql/Statement.java \ java/sql/Statement.java \
java/sql/Struct.java \ java/sql/Struct.java \
...@@ -2506,13 +2523,15 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2506,13 +2523,15 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/sql/Connection.P .deps/java/sql/DataTruncation.P \ .deps/java/sql/Connection.P .deps/java/sql/DataTruncation.P \
.deps/java/sql/DatabaseMetaData.P .deps/java/sql/Date.P \ .deps/java/sql/DatabaseMetaData.P .deps/java/sql/Date.P \
.deps/java/sql/Driver.P .deps/java/sql/DriverManager.P \ .deps/java/sql/Driver.P .deps/java/sql/DriverManager.P \
.deps/java/sql/DriverPropertyInfo.P .deps/java/sql/PreparedStatement.P \ .deps/java/sql/DriverPropertyInfo.P .deps/java/sql/ParameterMetaData.P \
.deps/java/sql/Ref.P .deps/java/sql/ResultSet.P \ .deps/java/sql/PreparedStatement.P .deps/java/sql/Ref.P \
.deps/java/sql/ResultSetMetaData.P .deps/java/sql/SQLData.P \ .deps/java/sql/ResultSet.P .deps/java/sql/ResultSetMetaData.P \
.deps/java/sql/SQLException.P .deps/java/sql/SQLInput.P \ .deps/java/sql/SQLData.P .deps/java/sql/SQLException.P \
.deps/java/sql/SQLOutput.P .deps/java/sql/SQLWarning.P \ .deps/java/sql/SQLInput.P .deps/java/sql/SQLOutput.P \
.deps/java/sql/Statement.P .deps/java/sql/Struct.P \ .deps/java/sql/SQLPermission.P .deps/java/sql/SQLWarning.P \
.deps/java/sql/Time.P .deps/java/sql/Timestamp.P .deps/java/sql/Types.P \ .deps/java/sql/Savepoint.P .deps/java/sql/Statement.P \
.deps/java/sql/Struct.P .deps/java/sql/Time.P \
.deps/java/sql/Timestamp.P .deps/java/sql/Types.P \
.deps/java/text/Annotation.P \ .deps/java/text/Annotation.P \
.deps/java/text/AttributedCharacterIterator.P \ .deps/java/text/AttributedCharacterIterator.P \
.deps/java/text/AttributedString.P \ .deps/java/text/AttributedString.P \
...@@ -2659,6 +2678,14 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2659,6 +2678,14 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/naming/spi/ObjectFactoryBuilder.P \ .deps/javax/naming/spi/ObjectFactoryBuilder.P \
.deps/javax/naming/spi/ResolveResult.P \ .deps/javax/naming/spi/ResolveResult.P \
.deps/javax/naming/spi/Resolver.P .deps/javax/naming/spi/StateFactory.P \ .deps/javax/naming/spi/Resolver.P .deps/javax/naming/spi/StateFactory.P \
.deps/javax/sql/ConnectionEvent.P \
.deps/javax/sql/ConnectionEventListener.P \
.deps/javax/sql/ConnectionPoolDataSource.P .deps/javax/sql/DataSource.P \
.deps/javax/sql/PooledConnection.P .deps/javax/sql/RowSet.P \
.deps/javax/sql/RowSetEvent.P .deps/javax/sql/RowSetInternal.P \
.deps/javax/sql/RowSetListener.P .deps/javax/sql/RowSetMetaData.P \
.deps/javax/sql/RowSetReader.P .deps/javax/sql/RowSetWriter.P \
.deps/javax/sql/XAConnection.P .deps/javax/sql/XADataSource.P \
.deps/javax/transaction/HeuristicCommitException.P \ .deps/javax/transaction/HeuristicCommitException.P \
.deps/javax/transaction/HeuristicMixedException.P \ .deps/javax/transaction/HeuristicMixedException.P \
.deps/javax/transaction/HeuristicRollbackException.P \ .deps/javax/transaction/HeuristicRollbackException.P \
......
/* Array.java -- Interface for accessing SQL array object /* Array.java -- Interface for accessing SQL array object
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -35,203 +35,151 @@ this exception to your version of the library, but you are not ...@@ -35,203 +35,151 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.util.Map; import java.util.Map;
/** /**
* This interface provides methods for accessing SQL array types * This interface provides methods for accessing SQL array types.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface Array public interface Array
{ {
/**
/** * Returns the name of the SQL type of the elements in this
* This method returns the name of the SQL type of the elements in this * array. This name is database specific.
* array. This name is database specific. *
* * @param The name of the SQL type of the elements in this array.
* @param The name of the SQL type of the elements in this array. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public String getBaseTypeName() throws SQLException;
*/
public abstract String /**
getBaseTypeName() throws SQLException; * Returns the JDBC type identifier of the elements in this
* array. This will be one of the values defined in the
/*************************************************************************/ * <code>Types</code> class.
*
/** * @return The JDBC type of the elements in this array.
* This method returns the JDBC type identifier of the elements in this * @exception SQLException If an error occurs.
* array. This will be one of the values defined in the <code>Types</code> * @see Types
* class. */
* public int getBaseType() throws SQLException;
* @return The JDBC type of the elements in this array.
* /**
* @exception SQLException If an error occurs. * Returns the contents of this array. This object returned
* * will be an array of Java objects of the appropriate types.
* @see Types *
*/ * @return The contents of the array as an array of Java objects.
public abstract int * @exception SQLException If an error occurs.
getBaseType() throws SQLException; */
public Object getArray() throws SQLException;
/*************************************************************************/
/**
/** * Returns the contents of this array. The specified
* This method returns the contents of this array. This object returned * <code>Map</code> will be used to override selected mappings
* will be an array of Java objects of the appropriate types. * between SQL types and Java classes.
* *
* @return The contents of the array as an array of Java objects. * @param map A mapping of SQL types to Java classes.
* * @return The contents of the array as an array of Java objects.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract Object public Object getArray(Map map) throws SQLException;
getArray() throws SQLException;
/**
/*************************************************************************/ * Returns a portion of this array starting at <code>index</code>
* into the array and continuing for <code>count</code>
/** * elements. Fewer than the requested number of elements will be
* This method returns the contents of this array. The specified * returned if the array does not contain the requested number of elements.
* <code>Map</code> will be used to override selected mappings between * The object returned will be an array of Java objects of
* SQL types and Java classes. * the appropriate types.
* *
* @param map A mapping of SQL types to Java classes. * @param offset The offset into this array to start returning elements from.
* * @param count The requested number of elements to return.
* @return The contents of the array as an array of Java objects. * @return The requested portion of the array.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
*/ public Object getArray(long index, int count) throws SQLException;
public abstract Object
getArray(Map map) throws SQLException; /**
* This method returns a portion of this array starting at <code>index</code>
/*************************************************************************/ * into the array and continuing for <code>count</code>
* elements. Fewer than the requested number of elements will be
/** * returned if the array does not contain the requested number of elements.
* This method returns a portion of this array starting at index * The object returned will be an array of Java objects. The specified
* <code>offset</code> into the array and continuing for <code>length</code> * <code>Map</code> will be used for overriding selected SQL type to
* elements. Fewer than the requested number of elements will be * Java class mappings.
* returned if the array does not contain the requested number of elements. *
* The object returned will be an array of Java objects of * @param offset The offset into this array to start returning elements from.
* the appropriate types. * @param count The requested number of elements to return.
* * @param map A mapping of SQL types to Java classes.
* @param offset The offset into this array to start returning elements from. * @return The requested portion of the array.
* @param count The requested number of elements to return. * @exception SQLException If an error occurs.
* */
* @return The requested portion of the array. public Object getArray(long index, int count, Map map) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * Returns the elements in the array as a <code>ResultSet</code>.
public abstract Object * Each row of the result set will have two columns. The first will be
getArray(long offset, int count) throws SQLException; * the index into the array of that row's contents. The second will be
* the actual value of that array element.
/*************************************************************************/ *
* @return The elements of this array as a <code>ResultSet</code>.
/** * @exception SQLException If an error occurs.
* This method returns a portion of this array starting at index * @see ResultSet
* <code>offset</code> into the array and continuing for <code>length</code> */
* elements. Fewer than the requested number of elements will be public ResultSet getResultSet() throws SQLException;
* returned if the array does not contain the requested number of elements.
* The object returned will be an array of Java objects. The specified /**
* <code>Map</code> will be used for overriding selected SQL type to * This method returns the elements in the array as a <code>ResultSet</code>.
* Java class mappings. * Each row of the result set will have two columns. The first will be
* * the index into the array of that row's contents. The second will be
* @param offset The offset into this array to start returning elements from. * the actual value of that array element. The specified <code>Map</code>
* @param count The requested number of elements to return. * will be used to override selected default mappings of SQL types to
* @param map A mapping of SQL types to Java classes. * Java classes.
* *
* @return The requested portion of the array. * @param map A mapping of SQL types to Java classes.
* * @return The elements of this array as a <code>ResultSet</code>.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ * @see ResultSet
public abstract Object */
getArray(long index, int count, Map map) throws SQLException; public ResultSet getResultSet(Map map) throws SQLException;
/*************************************************************************/ /**
* This method returns a portion of the array as a <code>ResultSet</code>.
/** * The returned portion will start at <code>index</code> into the
* This method returns the elements in the array as a <code>ResultSet</code>. * array and up to <code>count</code> elements will be returned.
* Each row of the result set will have two columns. The first will be * <p>
* the index into the array of that row's contents. The second will be * Each row of the result set will have two columns. The first will be
* the actual value of that array element. * the index into the array of that row's contents. The second will be
* * the actual value of that array element.
* @return The elements of this array as a <code>ResultSet</code>. *
* * @param offset The index into the array to start returning elements from.
* @exception SQLException If an error occurs. * @param length The requested number of elements to return.
* * @return The requested elements of this array as a <code>ResultSet</code>.
* @see ResultSet * @exception SQLException If an error occurs.
*/ * @see ResultSet
public abstract ResultSet */
getResultSet() throws SQLException; public ResultSet getResultSet(long index, int count) throws SQLException;
/*************************************************************************/ /**
* This method returns a portion of the array as a <code>ResultSet</code>.
/** * The returned portion will start at <code>index</code> into the
* This method returns the elements in the array as a <code>ResultSet</code>. * array and up to <cod>count</code> elements will be returned.
* Each row of the result set will have two columns. The first will be * <p>
* the index into the array of that row's contents. The second will be * Each row of the result set will have two columns. The first will be
* the actual value of that array element. The specified <code>Map</code> * the index into the array of that row's contents. The second will be
* will be used to override selected default mappings of SQL types to * the actual value of that array element. The specified <code>Map</code>
* Java classes. * will be used to override selected default mappings of SQL types to
* * Java classes.
* @param map A mapping of SQL types to Java classes. *
* * @param offset The index into the array to start returning elements from.
* @return The elements of this array as a <code>ResultSet</code>. * @param length The requested number of elements to return.
* * @param map A mapping of SQL types to Java classes.
* @exception SQLException If an error occurs. * @return The requested elements of this array as a <code>ResultSet</code>.
* * @exception SQLException If an error occurs.
* @see ResultSet * @see ResultSet
*/ */
public abstract ResultSet public ResultSet getResultSet(long index, int count, Map map)
getResultSet(Map map) throws SQLException; throws SQLException;
}
/*************************************************************************/
/**
* This method returns a portion of the array as a <code>ResultSet</code>.
* The returned portion will start at index <code>offset</code> into the
* array and up to <code>length</code> elements will be returned.
* <p>
* Each row of the result set will have two columns. The first will be
* the index into the array of that row's contents. The second will be
* the actual value of that array element.
*
* @param offset The index into the array to start returning elements from.
* @param length The requested number of elements to return.
*
* @return The requested elements of this array as a <code>ResultSet</code>.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract ResultSet
getResultSet(long index, int count) throws SQLException;
/*************************************************************************/
/**
* This method returns a portion of the array as a <code>ResultSet</code>.
* The returned portion will start at index <code>offset</code> into the
* array and up to <code>length</code> elements will be returned.
* <p>
* Each row of the result set will have two columns. The first will be
* the index into the array of that row's contents. The second will be
* the actual value of that array element. The specified <code>Map</code>
* will be used to override selected default mappings of SQL types to
* Java classes.
*
* @param offset The index into the array to start returning elements from.
* @param length The requested number of elements to return.
* @param map A mapping of SQL types to Java classes.
*
* @return The requested elements of this array as a <code>ResultSet</code>.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract ResultSet
getResultSet(long index, int count, Map map) throws SQLException;
} // interface Array
/* BatchUpdateException.java -- Exception for batch oriented SQL errors /* BatchUpdateException.java -- Exception for batch oriented SQL errors
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -35,146 +35,107 @@ this exception to your version of the library, but you are not ...@@ -35,146 +35,107 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
/** /**
* This class extends <code>SQLException</code> to count the successful * This class extends <code>SQLException</code> to count the successful
* updates in each statement in a batch that was successfully updated prior * updates in each statement in a batch that was successfully updated prior
* to the error. * to the error.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class BatchUpdateException extends SQLException
{
/*************************************************************************/
/*
* Instance Variables
*/
/**
* This is the array of update counts for the commands which completed
* successfully prior to the error.
* @serialized
*/
private int[] updateCounts;
/*************************************************************************/
/*
* Constructors
*/
/**
* This method initializes a new instance of <code>BatchUpdateException</code>
* with no descriptive error message. The SQL state and update count will
* be initialized to <code>null</code> and the vendor specific error code will
* initialized to 0.
*/
public
BatchUpdateException()
{
super();
}
/*************************************************************************/
/**
* This method initializes a new instance of <code>BatchUpdateException</code>
* with the specified update count information and no descriptive error
* message. This SQL state will be initialized to <code>null</code> and
* the vendor specific error code will be initialized to 0.
*
* @param updateCounts The update count array.
*/
public
BatchUpdateException(int[] updateCounts)
{
super();
this.updateCounts = updateCounts;
}
/*************************************************************************/
/**
* This method initializes a new instance of <code>BatchUpdateException</code>
* with the specified descriptive error message and update count information.
* The SQL state will be initialized to <code>null</code> and the vendor
* specific error code will be initialized to 0.
*
* @param message The descriptive error message.
* @param updateCounts The update count information for this error.
*/
public
BatchUpdateException(String message, int[] updateCounts)
{
super(message);
this.updateCounts = updateCounts;
}
/*************************************************************************/
/**
* This method initializes a new instance of <code>BatchUpdateException</code>
* with the specified descriptive error message, SQL state, and update count
* information. The vendor specific error code will be initialized to 0.
*
* @param message The descriptive error message.
* @param SQLState The SQL state information for this error.
* @param updateCounts The update count information for this error.
*/
public
BatchUpdateException(String message, String SQLState, int[] updateCounts)
{
super(message, SQLState);
this.updateCounts = updateCounts;
}
/*************************************************************************/
/**
* This method initializes a new instance of <code>BatchUpdateException</code>
* with the specified descriptive error message, SQL state, vendor
* specific error code and update count information.
*
* @param message The descriptive error message.
* @param SQLState The SQL state information for this error.
* @param vendorCode The vendor specific error code for this error.
* @param updateCounts The update count information for this error.
*/
public
BatchUpdateException(String message, String SQLState, int vendorCode,
int[] updateCounts)
{
super(message, SQLState, vendorCode);
this.updateCounts = updateCounts;
}
/*************************************************************************/
/*
* Instance Methods
*/ */
public class BatchUpdateException extends SQLException
/**
* This method returns the update count information for this error. If
* not <code>null</code> this is an array of <code>int</code>'s that are
* the update accounts for each command that was successfully executed.
* The array elements are in the order that the commands were executed.
*
* @return The update count information, which may be <code>null</code>.
*/
public int[]
getUpdateCounts()
{ {
return(updateCounts); static final long serialVersionUID = 5977529877145521757L;
/**
* This is the array of update counts for the commands which completed
* successfully prior to the error.
*/
private int[] updateCounts;
/**
* This method initializes a new instance of <code>BatchUpdateException</code>
* with the specified descriptive error message, SQL state, and update count
* information. The vendor specific error code will be initialized to 0.
*
* @param message The descriptive error message.
* @param SQLState The SQL state information for this error.
* @param vendorCode
* @param updateCounts The update count information for this error.
*/
public BatchUpdateException(String message, String SQLState, int vendorCode,
int[] updateCounts)
{
super(message, SQLState, vendorCode);
this.updateCounts = updateCounts;
}
/**
* This method initializes a new instance of <code>BatchUpdateException</code>
* with the specified descriptive error message, SQL state, and update count
* information. The vendor specific error code will be initialized to 0.
*
* @param message The descriptive error message.
* @param SQLState The SQL state information for this error.
* @param updateCounts The update count information for this error.
*/
public BatchUpdateException(String message, String SQLState,
int[] updateCounts)
{
super(message, SQLState);
this.updateCounts = updateCounts;
}
/**
* This method initializes a new instance of <code>BatchUpdateException</code>
* with the specified descriptive error message and update count information.
* The SQL state will be initialized to <code>null</code> and the vendor
* specific error code will be initialized to 0.
*
* @param message The descriptive error message.
* @param updateCounts The update count information for this error.
*/
public BatchUpdateException(String message, int[] updateCounts)
{
super(message);
this.updateCounts = updateCounts;
}
/**
* Initializes a new instance of <code>BatchUpdateException</code>
* with the specified update count information and no descriptive error
* message. This SQL state will be initialized to <code>null</code> and
* the vendor specific error code will be initialized to 0.
*
* @param updateCounts The update count array.
*/
public BatchUpdateException(int[] updateCounts)
{
this.updateCounts = updateCounts;
}
/**
* Initializes a new instance of <code>BatchUpdateException</code>
* with no descriptive error message. The SQL state and update count will
* be initialized to <code>null</code> and the vendor specific error code will
* initialized to 0.
*/
public BatchUpdateException()
{
super();
}
/**
* This method returns the update count information for this error. If
* not <code>null</code> this is an array of <code>int</code>'s that are
* the update accounts for each command that was successfully executed.
* The array elements are in the order that the commands were executed.
*
* @return The update count information, which may be <code>null</code>.
*/
public int[] getUpdateCounts()
{
return updateCounts;
}
} }
} // class BatchUpdateException
/* Blob.java -- Access a SQL Binary Large OBject. /* Blob.java -- Access a SQL Binary Large OBject.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -35,97 +35,97 @@ this exception to your version of the library, but you are not ...@@ -35,97 +35,97 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
/** /**
* This interface specified methods for accessing a SQL BLOB (Binary * This interface specified methods for accessing a SQL BLOB (Binary
* Large OBject) type. * Large OBject) type.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ * @since 1.2
public interface Blob */
public interface Blob
{ {
/**
/*************************************************************************/ * This method returns the number of bytes in the BLOB.
*
/** * @return The number of bytes in the BLOB.
* This method returns the number of bytes in the BLOB. * @exception SQLException If an error occurs.
* */
* @return The number of bytes in the BLOB. public long length() throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method returns up to the requested bytes of this BLOB as a
public abstract long * <code>byte</code> array.
length() throws SQLException; *
* @param pos The index into the BLOB to start returning bytes from.
/*************************************************************************/ * @param length The requested number of bytes to return.
* @return The requested bytes from the BLOB.
/** * @exception SQLException If an error occurs.
* This method returns up to the requested bytes of this BLOB as a */
* <code>byte</code> array. public byte[] getBytes(long pos, int length) throws SQLException;
*
* @param offset The index into the BLOB to start returning bytes from. /**
* @param length The requested number of bytes to return. * This method returns a stream that will read the bytes of the BLOB.
* *
* @return The requested bytes from the BLOB. * @return A stream that will read the bytes of the BLOB.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
*/ public InputStream getBinaryStream() throws SQLException;
public abstract byte[]
getBytes(long offset, int length) throws SQLException; /**
* This method returns the index into the BLOB at which the first instance
/*************************************************************************/ * of the specified bytes occur. The searching starts at the specified
* index into the BLOB.
/** *
* This method returns a stream that will read the bytes of the BLOB. * @param pattern The byte pattern to search for.
* * @param offset The index into the BLOB to starting searching for the pattern.
* @return A stream that will read the bytes of the BLOB. * @return The offset at which the pattern is first found, or -1 if the
* * pattern is not found.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract InputStream public long position(byte[] pattern, long start) throws SQLException;
getBinaryStream() throws SQLException;
/**
/*************************************************************************/ * This method returns the index into the BLOB at which the first instance
* of the specified pattern occurs. The searching starts at the specified
/** * index into this BLOB. The bytes in the specified <code>Blob</code> are
* This method returns the index into the BLOB at which the first instance * used as the search pattern.
* of the specified bytes occur. The searching starts at the specified *
* index into the BLOB. * @param pattern The <code>Blob</code> containing the byte pattern to
* * search for.
* @param pattern The byte pattern to search for. * @param offset The index into the BLOB to starting searching for the pattern.
* @param offset The index into the BLOB to starting searching for the pattern. * @return The offset at which the pattern is first found, or -1 if the
* * pattern is not found.
* @return The offset at which the pattern is first found, or -1 if the * @exception SQLException If an error occurs.
* pattern is not found. */
* public long position(Blob pattern, long start) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract long * @exception SQLException If an error occurs.
position(byte[] pattern, long offset) throws SQLException; * @since 1.4
*/
/*************************************************************************/ public int setBytes(long pos, byte[] bytes) throws SQLException;
/** /**
* This method returns the index into the BLOB at which the first instance * @exception SQLException If an error occurs.
* of the specified pattern occurs. The searching starts at the specified * @since 1.4
* index into this BLOB. The bytes in the specified <code>Blob</code> are */
* used as the search pattern. public int setBytes(long pos, byte[] bytes, int offset, int len)
* throws SQLException;
* @param pattern The <code>Blob</code> containing the byte pattern to
* search for. /**
* @param offset The index into the BLOB to starting searching for the pattern. * @exception SQLException If an error occurs.
* * @since 1.4
* @return The offset at which the pattern is first found, or -1 if the */
* pattern is not found. public OutputStream setBinaryStream(long pos) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * @exception SQLException If an error occurs.
public abstract long * @since 1.4
position(Blob pattern, long offset) throws SQLException; */
public void truncate(long len) throws SQLException;
} // interface Blob }
/* CallableStatement.java -- A statement for calling stored procedures. /* CallableStatement.java -- A statement for calling stored procedures.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -35,431 +35,617 @@ this exception to your version of the library, but you are not ...@@ -35,431 +35,617 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.io.InputStream; import java.io.InputStream;
import java.io.Reader; import java.io.Reader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL;
import java.util.Calendar; import java.util.Calendar;
import java.util.Map; import java.util.Map;
/** /**
* This interface provides a mechanism for calling stored procedures. * This interface provides a mechanism for calling stored procedures.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface CallableStatement extends PreparedStatement public interface CallableStatement extends PreparedStatement
{ {
/**
/*************************************************************************/ * This method registers the specified parameter as an output parameter
* of the specified SQL type.
/** *
* This method tests whether the value of the last parameter that was fetched * @param index The index of the parameter to register as output.
* was actually a SQL NULL value. * @param type The SQL type value from <code>Types</code>.
* * @exception SQLException If an error occurs.
* @return <code>true</code> if the last parameter fetched was a NULL, */
* <code>false</code> otherwise. public void registerOutParameter(int parameterIndex, int sqlType)
* throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract boolean * This method registers the specified parameter as an output parameter
wasNull() throws SQLException; * of the specified SQL type and scale.
*
/*************************************************************************/ * @param index The index of the parameter to register as output.
* @param type The SQL type value from <code>Types</code>.
/** * @param scale The scale of the value that will be returned.
* This method returns the value of the specified parameter as a Java * @exception SQLException If an error occurs.
* <code>String</code>. */
* public void registerOutParameter(int parameterIndex, int sqlType, int scale)
* @param index The index of the parameter to return. throws SQLException;
*
* @return The parameter value as a <code>String</code>. /**
* * This method tests whether the value of the last parameter that was fetched
* @exception SQLException If an error occurs. * was actually a SQL NULL value.
*/ *
public abstract String * @return <code>true</code> if the last parameter fetched was a NULL,
getString(int index) throws SQLException; * <code>false</code> otherwise.
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public boolean wasNull() throws SQLException;
/**
* This method returns the value of the specified parameter as a Java /**
* <code>Object</code>. * This method returns the value of the specified parameter as a Java
* * <code>String</code>.
* @param index The index of the parameter to return. *
* * @param index The index of the parameter to return.
* @return The parameter value as an <code>Object</code>. * @return The parameter value as a <code>String</code>.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
*/ public String getString(int parameterIndex) throws SQLException;
public abstract Object
getObject(int index) throws SQLException; /**
* This method returns the value of the specified parameter as a Java
/*************************************************************************/ * <code>boolean</code>.
*
/** * @param index The index of the parameter to return.
* This method returns the value of the specified parameter as a Java * @return The parameter value as a <code>boolean</code>.
* <code>Object</code>. * @exception SQLException If an error occurs.
* */
* @param index The index of the parameter to return. public boolean getBoolean(int parameterIndex) throws SQLException;
* @param map The mapping to use for conversion from SQL to Java types.
* /**
* @return The parameter value as an <code>Object</code>. * This method returns the value of the specified parameter as a Java
* * <code>byte</code>.
* @exception SQLException If an error occurs. *
*/ * @param index The index of the parameter to return.
public abstract Object * @return The parameter value as a <code>byte</code>.
getObject(int index, Map map) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public byte getByte(int parameterIndex) throws SQLException;
/** /**
* This method returns the value of the specified parameter as a Java * This method returns the value of the specified parameter as a Java
* <code>boolean</code>. * <code>short</code>.
* *
* @param index The index of the parameter to return. * @param index The index of the parameter to return.
* * @return The parameter value as a <code>short</code>.
* @return The parameter value as a <code>boolean</code>. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public short getShort(int parameterIndex) throws SQLException;
*/
public abstract boolean /**
getBoolean(int index) throws SQLException; * This method returns the value of the specified parameter as a Java
* <code>int</code>.
/*************************************************************************/ *
* @param index The index of the parameter to return.
/** * @return The parameter value as a <code>int</code>.
* This method returns the value of the specified parameter as a Java * @exception SQLException If an error occurs.
* <code>byte</code>. */
* public int getInt(int parameterIndex) throws SQLException;
* @param index The index of the parameter to return.
* /**
* @return The parameter value as a <code>byte</code>. * This method returns the value of the specified parameter as a Java
* * <code>long</code>.
* @exception SQLException If an error occurs. *
*/ * @param index The index of the parameter to return.
public abstract byte * @return The parameter value as a <code>long</code>.
getByte(int index) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public long getLong(int parameterIndex) throws SQLException;
/** /**
* This method returns the value of the specified parameter as a Java * This method returns the value of the specified parameter as a Java
* <code>short</code>. * <code>float</code>.
* *
* @param index The index of the parameter to return. * @param index The index of the parameter to return.
* * @return The parameter value as a <code>float</code>.
* @return The parameter value as a <code>short</code>. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public float getFloat(int parameterIndex) throws SQLException;
*/
public abstract short /**
getShort(int index) throws SQLException; * This method returns the value of the specified parameter as a Java
* <code>double</code>.
/*************************************************************************/ *
* @param index The index of the parameter to return.
/** * @return The parameter value as a <code>double</code>.
* This method returns the value of the specified parameter as a Java * @exception SQLException If an error occurs.
* <code>int</code>. */
* public double getDouble(int parameterIndex) throws SQLException;
* @param index The index of the parameter to return.
* /**
* @return The parameter value as a <code>int</code>. * This method returns the value of the specified parameter as a Java
* * <code>BigDecimal</code>.
* @exception SQLException If an error occurs. *
*/ * @param parameterIndex The index of the parameter to return.
public abstract int * @param scale The number of digits to the right of the decimal to return.
getInt(int index) throws SQLException; * @return The parameter value as a <code>BigDecimal</code>.
* @exception SQLException If an error occurs.
/*************************************************************************/ * @deprecated Use getBigDecimal(int parameterIndex)
* or getBigDecimal(String parameterName) instead.
/** */
* This method returns the value of the specified parameter as a Java public BigDecimal getBigDecimal(int parameterIndex, int scale)
* <code>long</code>. throws SQLException;
*
* @param index The index of the parameter to return. /**
* * This method returns the value of the specified parameter as a Java
* @return The parameter value as a <code>long</code>. * byte array.
* *
* @exception SQLException If an error occurs. * @param parameterIndex The index of the parameter to return.
*/ * @return The parameter value as a byte array
public abstract long * @exception SQLException If an error occurs.
getLong(int index) throws SQLException; */
public byte[] getBytes(int parameterIndex) throws SQLException;
/*************************************************************************/
/**
/** * This method returns the value of the specified parameter as a Java
* This method returns the value of the specified parameter as a Java * <code>java.sql.Date</code>.
* <code>float</code>. *
* * @param index The index of the parameter to return.
* @param index The index of the parameter to return. * @return The parameter value as a <code>java.sql.Date</code>.
* * @exception SQLException If an error occurs.
* @return The parameter value as a <code>float</code>. */
* public Date getDate(int parameterIndex) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract float * This method returns the value of the specified parameter as a Java
getFloat(int index) throws SQLException; * <code>java.sql.Time</code>.
*
/*************************************************************************/ * @param index The index of the parameter to return.
* @return The parameter value as a <code>java.sql.Time</code>.
/** * @exception SQLException If an error occurs.
* This method returns the value of the specified parameter as a Java */
* <code>double</code>. public Time getTime(int parameterIndex) throws SQLException;
*
* @param index The index of the parameter to return. /**
* * This method returns the value of the specified parameter as a Java
* @return The parameter value as a <code>double</code>. * <code>java.sql.Timestamp</code>.
* *
* @exception SQLException If an error occurs. * @param index The index of the parameter to return.
*/ * @return The parameter value as a <code>java.sql.Timestamp</code>.
public abstract double * @exception SQLException If an error occurs.
getDouble(int index) throws SQLException; */
public Timestamp getTimestamp(int parameterIndex) throws SQLException;
/*************************************************************************/
/**
/** * This method returns the value of the specified parameter as a Java
* This method returns the value of the specified parameter as a Java * <code>Object</code>.
* <code>BigDecimal</code>. *
* * @param parameterIndex The index of the parameter to return.
* @param index The index of the parameter to return. * @return The parameter value as an <code>Object</code>.
* * @exception SQLException If an error occurs.
* @return The parameter value as a <code>BigDecimal</code>. * @since 1.2
* */
* @exception SQLException If an error occurs. public Object getObject(int parameterIndex) throws SQLException;
*/
public abstract BigDecimal /**
getBigDecimal(int index) throws SQLException; * This method returns the value of the specified parameter as a Java
* <code>BigDecimal</code>.
/*************************************************************************/ *
* @param parameterIndex The index of the parameter to return.
/** * @return The parameter value as a <code>BigDecimal</code>.
* This method returns the value of the specified parameter as a Java * @exception SQLException If an error occurs.
* <code>BigDecimal</code>. * @since 1.2
* */
* @param index The index of the parameter to return. public BigDecimal getBigDecimal(int parameterIndex) throws SQLException;
* @param scale The number of digits to the right of the decimal to return.
* /**
* @return The parameter value as a <code>BigDecimal</code>. * This method returns the value of the specified parameter as a Java
* * <code>Object</code>.
* @exception SQLException If an error occurs. *
*/ * @param index The index of the parameter to return.
public abstract BigDecimal * @param map The mapping to use for conversion from SQL to Java types.
getBigDecimal(int index, int scale) throws SQLException; * @return The parameter value as an <code>Object</code>.
* @exception SQLException If an error occurs.
/*************************************************************************/ * @since 1.2
*/
/** public Object getObject(int index, Map map) throws SQLException;
* This method returns the value of the specified parameter as a Java
* byte array. /**
* * This method returns the value of the specified parameter as a Java
* @param index The index of the parameter to return. * <code>Ref</code>.
* *
* @return The parameter value as a byte array * @param index The index of the parameter to return.
* * @return The parameter value as a <code>Ref</code>.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ * @since 1.2
public abstract byte[] */
getBytes(int index) throws SQLException; public Ref getRef(int index) throws SQLException;
/*************************************************************************/ /**
* This method returns the value of the specified parameter as a Java
/** * <code>Blob</code>.
* This method returns the value of the specified parameter as a Java *
* <code>java.sql.Date</code>. * @param index The index of the parameter to return.
* * @return The parameter value as a <code>Blob</code>.
* @param index The index of the parameter to return. * @exception SQLException If an error occurs.
* * @since 1.2
* @return The parameter value as a <code>java.sql.Date</code>. */
* public Blob getBlob(int index) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract java.sql.Date * This method returns the value of the specified parameter as a Java
getDate(int index) throws SQLException; * <code>Clob</code>.
*
/*************************************************************************/ * @param index The index of the parameter to return.
* @return The parameter value as a <code>Clob</code>.
/** * @exception SQLException If an error occurs.
* This method returns the value of the specified parameter as a Java * @since 1.2
* <code>java.sql.Date</code>. */
* public Clob getClob(int index) throws SQLException;
* @param index The index of the parameter to return.
* @param calendar The <code>Calendar</code> to use for timezone and locale. /**
* * This method returns the value of the specified parameter as a Java
* @return The parameter value as a <code>java.sql.Date</code>. * <code>Array</code>.
* *
* @exception SQLException If an error occurs. * @param parameterIndex The index of the parameter to return.
*/ * @return The parameter value as a <code>Array</code>.
public abstract java.sql.Date * @exception SQLException If an error occurs.
getDate(int index, Calendar calendar) throws SQLException; * @since 1.2
*/
/*************************************************************************/ public Array getArray(int index) throws SQLException;
/** /**
* This method returns the value of the specified parameter as a Java * This method returns the value of the specified parameter as a Java
* <code>java.sql.Time</code>. * <code>java.sql.Date</code>.
* *
* @param index The index of the parameter to return. * @param parameterIndex The index of the parameter to return.
* * @param cal The <code>Calendar</code> to use for timezone and locale.
* @return The parameter value as a <code>java.sql.Time</code>. * @return The parameter value as a <code>java.sql.Date</code>.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. * @since 1.2
*/ */
public abstract java.sql.Time public Date getDate(int parameterIndex, Calendar cal) throws SQLException;
getTime(int index) throws SQLException;
/**
/*************************************************************************/ * This method returns the value of the specified parameter as a Java
* <code>java.sql.Time</code>.
/** *
* This method returns the value of the specified parameter as a Java * @param parameterIndex The index of the parameter to return.
* <code>java.sql.Time</code>. * @param cal The <code>Calendar</code> to use for timezone and locale.
* * @return The parameter value as a <code>java.sql.Time</code>.
* @param index The index of the parameter to return. * @exception SQLException If an error occurs.
* @param calendar The <code>Calendar</code> to use for timezone and locale. * @since 1.2
* */
* @return The parameter value as a <code>java.sql.Time</code>. public Time getTime(int parameterIndex, Calendar cal) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method returns the value of the specified parameter as a Java
public abstract java.sql.Time * <code>java.sql.Timestamp</code>.
getTime(int index, Calendar calendar) throws SQLException; *
* @param index The index of the parameter to return.
/*************************************************************************/ * @return The parameter value as a <code>java.sql.Timestamp</code>.
* @exception SQLException If an error occurs.
/** * @since 1.2
* This method returns the value of the specified parameter as a Java */
* <code>java.sql.Timestamp</code>. public Timestamp getTimestamp(int parameterIndex, Calendar cal)
* throws SQLException;
* @param index The index of the parameter to return.
* /**
* @return The parameter value as a <code>java.sql.Timestamp</code>. * This method registers the specified parameter as an output parameter
* * of the specified SQL type.
* @exception SQLException If an error occurs. *
*/ * @param index The index of the parameter to register as output.
public abstract java.sql.Timestamp * @param type The SQL type value from <code>Types</code>.
getTimestamp(int index) throws SQLException; * @param name The user defined data type name.
* @exception SQLException If an error occurs.
/*************************************************************************/ * @since 1.2
*/
/** public void registerOutParameter(int paramIndex, int sqlType,
* This method returns the value of the specified parameter as a Java String typeName)
* <code>java.sql.Timestamp</code>. throws SQLException;
*
* @param index The index of the parameter to return. /**
* @param calendar The <code>Calendar</code> to use for timezone and locale. * This method registers the specified parameter as an output parameter
* * of the specified SQL type.
* @return The parameter value as a <code>java.sql.Timestamp</code>. *
* * @param parameterName The name of the parameter to register as output.
* @exception SQLException If an error occurs. * @param sqlType The SQL type value from <code>Types</code>.
*/ * @exception SQLException If an error occurs.
public abstract java.sql.Timestamp * @since 1.4
getTimestamp(int index, Calendar calendar) throws SQLException; */
public void registerOutParameter(String parameterName, int sqlType)
/*************************************************************************/ throws SQLException;
/** /**
* This method returns the value of the specified parameter as a Java * This method registers the specified parameter as an output parameter
* <code>Ref</code>. * of the specified SQL type. This version of registerOutParameter is used
* * for NUMERIC or DECIMAL types.
* @param index The index of the parameter to return. *
* * @param parameterName The name of the parameter to register as output.
* @return The parameter value as a <code>Ref</code>. * @param sqlType The SQL type value from <code>Types</code>.
* * @param scale Number of digits to the right of the decimal point.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ * @since 1.4
public abstract Ref */
getRef(int index) throws SQLException; public void registerOutParameter(String parameterName, int sqlType,
int scale)
/*************************************************************************/ throws SQLException;
/**
* This method returns the value of the specified parameter as a Java /**
* <code>Blob</code>. * This method registers the specified parameter as an output parameter
* * of the specified SQL type. This version of registerOutParameter is used
* @param index The index of the parameter to return. * for user-named or REF types. If the type of the output parameter does
* * not have such a type, the typeName argument is ignored.
* @return The parameter value as a <code>Blob</code>. *
* * @param parameterName The name of the parameter to register as output.
* @exception SQLException If an error occurs. * @param sqlType The SQL type value from <code>Types</code>.
*/ * @param typeName The SQL structured type name.
public abstract Blob * @exception SQLException If an error occurs.
getBlob(int index) throws SQLException; * @since 1.4
*/
/*************************************************************************/ public void registerOutParameter(String parameterName, int sqlType,
String typeName)
/** throws SQLException;
* This method returns the value of the specified parameter as a Java
* <code>Clob</code>. /**
* * @since 1.4
* @param index The index of the parameter to return. */
* public URL getURL(int parameterIndex) throws SQLException;
* @return The parameter value as a <code>Clob</code>.
* /**
* @exception SQLException If an error occurs. * @since 1.4
*/ */
public abstract Clob public void setURL(String parameterName, URL val) throws SQLException;
getClob(int index) throws SQLException;
/**
/*************************************************************************/ * @since 1.4
*/
/** public void setNull(String parameterName, int sqlType) throws SQLException;
* This method returns the value of the specified parameter as a Java
* <code>Array</code>. /**
* * @since 1.4
* @param index The index of the parameter to return. */
* public void setBoolean(String parameterName, boolean x) throws SQLException;
* @return The parameter value as a <code>Array</code>.
* /**
* @exception SQLException If an error occurs. * @since 1.4
*/ */
public abstract Array public void setByte(String parameterName, byte x) throws SQLException;
getArray(int index) throws SQLException;
/**
/*************************************************************************/ * @since 1.4
*/
/** public void setShort(String parameterName, short x) throws SQLException;
* This method registers the specified parameter as an output parameter
* of the specified SQL type. /**
* * @since 1.4
* @param index The index of the parameter to register as output. */
* @param type The SQL type value from <code>Types</code>. public void setInt(String parameterName, int x) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * @since 1.4
public abstract void */
registerOutParameter(int index, int type) throws SQLException; public void setLong(String parameterName, long x) throws SQLException;
/*************************************************************************/ /**
* @since 1.4
/** */
* This method registers the specified parameter as an output parameter public void setFloat(String parameterName, float x) throws SQLException;
* of the specified SQL type.
* /**
* @param index The index of the parameter to register as output. * @since 1.4
* @param type The SQL type value from <code>Types</code>. */
* @param name The user defined data type name. public void setDouble(String parameterName, double x) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * @since 1.4
public abstract void */
registerOutParameter(int index, int type, String name) throws SQLException; public void setBigDecimal(String parameterName, BigDecimal x)
throws SQLException;
/*************************************************************************/
/**
/** * @since 1.4
* This method registers the specified parameter as an output parameter */
* of the specified SQL type and scale. public void setString(String parameterName, String x) throws SQLException;
*
* @param index The index of the parameter to register as output. /**
* @param type The SQL type value from <code>Types</code>. * @since 1.4
* @param scale The scale of the value that will be returned. */
* public void setBytes(String parameterName, byte[] x) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract void * @since 1.4
registerOutParameter(int index, int type, int scale) throws SQLException; */
public void setDate(String parameterName, Date x) throws SQLException;
} // interface CallableStatement
/**
* @since 1.4
*/
public void setTime(String parameterName, Time x) throws SQLException;
/**
* @since 1.4
*/
public void setTimestamp(String parameterName, Timestamp x)
throws SQLException;
/**
* @since 1.4
*/
public void setAsciiStream(String parameterName, InputStream x, int length)
throws SQLException;
/**
* @since 1.4
*/
public void setBinaryStream(String parameterName, InputStream x, int length)
throws SQLException;
/**
* @since 1.4
*/
public void setObject(String parameterName, Object x, int targetSqlType,
int scale)
throws SQLException;
/**
* @since 1.4
*/
public void setObject(String parameterName, Object x, int targetSqlType)
throws SQLException;
/**
* @since 1.4
*/
public void setObject(String parameterName, Object x) throws SQLException;
/**
* @since 1.4
*/
public void setCharacterStream(String parameterName, Reader reader,
int length)
throws SQLException;
/**
* @since 1.4
*/
public void setDate(String parameterName, Date x, Calendar cal)
throws SQLException;
/**
* @since 1.4
*/
public void setTime(String parameterName, Time x, Calendar cal)
throws SQLException;
/**
* @since 1.4
*/
public void setTimestamp(String parameterName, Timestamp x, Calendar cal)
throws SQLException;
/**
* @since 1.4
*/
public void setNull(String parameterName, int sqlType, String typeName)
throws SQLException;
/**
* @since 1.4
*/
public String getString(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public boolean getBoolean(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public byte getByte(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public short getShort(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public int getInt(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public long getLong(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public float getFloat(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public double getDouble(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public byte[] getBytes(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Date getDate(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Time getTime(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Timestamp getTimestamp(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Object getObject(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public BigDecimal getBigDecimal(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Object getObject(String parameterName, Map map) throws SQLException;
/**
* @since 1.4
*/
public Ref getRef(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Blob getBlob(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Clob getClob(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Array getArray(String parameterName) throws SQLException;
/**
* @since 1.4
*/
public Date getDate(String parameterName, Calendar cal) throws SQLException;
/**
* @since 1.4
*/
public Time getTime(String parameterName, Calendar cal) throws SQLException;
/**
* @since 1.4
*/
public Timestamp getTimestamp(String parameterName, Calendar cal)
throws SQLException;
/**
* @since 1.4
*/
public URL getURL(String parameterName) throws SQLException;
}
/* Clob.java -- Access Character Large OBjects /* Clob.java -- Access Character Large OBjects
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -35,113 +35,118 @@ this exception to your version of the library, but you are not ...@@ -35,113 +35,118 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader; import java.io.Reader;
import java.io.Writer;
/** /**
* This interface contains methods for accessing a SQL CLOB (Character * This interface contains methods for accessing a SQL CLOB (Character
* Large OBject) type. * Large OBject) type.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface Clob public interface Clob
{ {
/**
/**
* This method returns the number of characters in the CLOB. * This method returns the number of characters in the CLOB.
* *
* @return The number of characters in the CLOB. * @return The number of characters in the CLOB.
*
* @exception SQLException If an error occurs.
*/
public abstract long
length() throws SQLException;
/*************************************************************************/
/**
* This method returns the specified portion of the CLOB as a
* <code>String</code>.
*
* @param offset The index into the CLOB (index values start at 1) to
* start returning characters from.
* @param length The requested number of characters to return.
*
* @return The requested CLOB section, as a <code>String</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract String
getSubString(long offset, int length) throws SQLException;
/*************************************************************************/
/**
* This method returns a byte stream that reads the contents of the
* CLOB as a series of ASCII bytes.
*
* @return A stream to read the CLOB's contents.
*
* @exception SQLException If an error occurs.
*/
public abstract InputStream
getAsciiStream() throws SQLException;
/*************************************************************************/
/**
* This method returns a character stream that reads the contents of the
* CLOB.
*
* @return A character stream to read the CLOB's contents.
*
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
* @since 1.2
*/ */
public abstract Reader public long length() throws SQLException;
getCharacterStream() throws SQLException;
/**
/*************************************************************************/ * This method returns the specified portion of the CLOB as a
* <code>String</code>.
/** *
* This method returns the index into the CLOB of the first occurrence of * @param offset The index into the CLOB (index values start at 1) to
* the specified character pattern (supplied by the caller as a * start returning characters from.
* <code>String</code>). The search begins at the specified index. * @param length The requested number of characters to return.
* * @return The requested CLOB section, as a <code>String</code>.
* @param pattern The character pattern to search for, passed as a * @exception SQLException If an error occurs.
* <code>String</code>. * @since 1.2
* @param offset. The index into the CLOB to start search (indexes start */
* at 1). public String getSubString(long pos, int length) throws SQLException;
*
* @return The index at which the pattern was found (indexes start at 1), /**
* or -1 if the pattern was not found. * This method returns a character stream that reads the contents of the
* * CLOB.
* @exception SQLException If an error occurs. *
*/ * @return A character stream to read the CLOB's contents.
public abstract long * @exception SQLException If an error occurs.
position(String pattern, long offset) throws SQLException; * @since 1.2
*/
/*************************************************************************/ public Reader getCharacterStream() throws SQLException;
/** /**
* This method returns the index into the CLOB of the first occurrence of * This method returns a byte stream that reads the contents of the
* the specified character pattern (supplied by the caller as a * CLOB as a series of ASCII bytes.
* <code>Clob</code>). The search begins at the specified index. *
* * @return A stream to read the CLOB's contents.
* @param pattern The character pattern to search for, passed as a * @exception SQLException If an error occurs.
* <code>Clob</code>. * @since 1.2
* @param offset. The index into the CLOB to start search (indexes start */
* at 1). public InputStream getAsciiStream() throws SQLException;
*
* @return The index at which the pattern was found (indexes start at 1), /**
* or -1 if the pattern was not found. * This method returns the index into the CLOB of the first occurrence of
* * the specified character pattern (supplied by the caller as a
* @exception SQLException If an error occurs. * <code>String</code>). The search begins at the specified index.
*/ *
public abstract long * @param searchstr The character pattern to search for, passed as a
position(Clob pattern, long offset) throws SQLException; * <code>String</code>.
* @param start. The index into the CLOB to start search (indexes start
} // interface Clob * at 1).
* @return The index at which the pattern was found (indexes start at 1),
* or -1 if the pattern was not found.
* @exception SQLException If an error occurs.
* @since 1.2
*/
public long position(String searchstr, long start) throws SQLException;
/**
* This method returns the index into the CLOB of the first occurrence of
* the specified character pattern (supplied by the caller as a
* <code>Clob</code>). The search begins at the specified index.
*
* @param searchstr The character pattern to search for, passed as a
* <code>Clob</code>.
* @param start. The index into the CLOB to start search (indexes start
* at 1).
* @return The index at which the pattern was found (indexes start at 1),
* or -1 if the pattern was not found.
* @exception SQLException If an error occurs.
* @since 1.2
*/
public long position(Clob searchstr, long start) throws SQLException;
/**
* @since 1.4
*/
public int setString(long pos, String str) throws SQLException;
/**
* @since 1.4
*/
public int setString(long pos, String str, int offset, int len)
throws SQLException;
/**
* @since 1.4
*/
public OutputStream setAsciiStream(long pos) throws SQLException;
/**
* @since 1.4
*/
public Writer setCharacterStream(long pos) throws SQLException;
/**
* @since 1.4
*/
public void truncate(long len) throws SQLException;
}
/* Connection.java -- Manage a database connection. /* Connection.java -- Manage a database connection.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,422 +41,380 @@ package java.sql; ...@@ -41,422 +41,380 @@ package java.sql;
import java.util.Map; import java.util.Map;
/** /**
* This interface provides methods for managing a connection to a database. * This interface provides methods for managing a connection to a database.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface Connection public interface Connection
{ {
/**
/** * This transaction isolation level indicates that transactions are not
* This transaction isolation level indicates that transactions are not * supported.
* supported. */
*/ public static final int TRANSACTION_NONE = 0;
public static final int TRANSACTION_NONE = 0;
/**
/** * This transaction isolation level indicates that one transaction can
* This transaction isolation level indicates that one transaction can * read modifications by other transactions before the other transactions
* read modifications by other transactions before the other transactions * have committed their changes. This could result in invalid reads.
* have committed their changes. This could result in invalid reads. */
*/ public static final int TRANSACTION_READ_UNCOMMITTED = 1;
public static final int TRANSACTION_READ_UNCOMMITTED = 1;
/**
/** * This transaction isolation leve indicates that only committed data from
* This transaction isolation leve indicates that only committed data from * other transactions will be read. If a transaction reads a row, then
* other transactions will be read. If a transaction reads a row, then * another transaction commits a change to that row, the first transaction
* another transaction commits a change to that row, the first transaction * would retrieve the changed row on subsequent reads of the same row.
* would retrieve the changed row on subsequent reads of the same row. */
*/ public static final int TRANSACTION_READ_COMMITTED = 2;
public static final int TRANSACTION_READ_COMMITTED = 2;
/**
/** * This transaction isolation level indicates that only committed data from
* This transaction isolation level indicates that only committed data from * other transactions will be read. It also ensures that data read from
* other transactions will be read. It also ensures that data read from * a row will not be different on a subsequent read even if another
* a row will not be different on a subsequent read even if another * transaction commits a change.
* transaction commits a change. */
*/ public static final int TRANSACTION_REPEATABLE_READ = 4;
public static final int TRANSACTION_REPEATABLE_READ = 4;
/**
/** * This transaction isolation level indicates that only committed data from
* This transaction isolation level indicates that only committed data from * other transactions will be read. It also ensures that data read from
* other transactions will be read. It also ensures that data read from * a row will not be different on a subsequent read even if another
* a row will not be different on a subsequent read even if another * transaction commits a change. Additionally, rows modified by other
* transaction commits a change. Additionally, rows modified by other * transactions will not affect the result set returned during subsequent
* transactions will not affect the result set returned during subsequent * executions of the same WHERE clause in this transaction.
* executions of the same WHERE clause in this transaction. */
*/ public static final int TRANSACTION_SERIALIZABLE = 8;
public static final int TRANSACTION_SERIALIZABLE = 8;
/**
/*************************************************************************/ * This method creates a new SQL statement. The default result set type
* and concurrency will be used.
/** *
* This method creates a new SQL statement. The default result set type * @return A new <code>Statement</code> object.
* and concurrency will be used. * @exception SQLException If an error occurs.
* * @see Statement
* @return A new <code>Statement</code> object. */
* public Statement createStatement() throws SQLException;
* @exception SQLException If an error occurs.
* /**
* @see Statement * This method creates a new <code>PreparedStatement</code> for the specified
*/ * SQL string. This method is designed for use with parameterized
public abstract Statement * statements. The default result set type and concurrency will be used.
createStatement() throws SQLException; *
* @param The SQL statement to use in creating this
/*************************************************************************/ * <code>PreparedStatement</code>.
* @return A new <code>PreparedStatement</code>.
/** * @exception SQLException If an error occurs.
* This method creates a new SQL statement with the specified type and * @see PreparedStatement
* concurrency. Valid values for these parameters are specified in the */
* <code>ResultSet</code> class. public PreparedStatement prepareStatement(String sql) throws SQLException;
*
* @param resultSetType The type of result set to use for this statement. /**
* @param resultSetConcurrency. The type of concurrency to be used in * This method creates a new <code>CallableStatement</code> for the
* the result set for this statement. * specified SQL string. Thie method is designed to be used with
* * stored procedures. The default result set type and concurrency
* @return A new <code>Statement</code> object. * will be used.
* *
* @exception SQLException If an error occurs. * @param The SQL statement to use in creating this
* * <code>CallableStatement</code>.
* @see Statement * @return A new <code>CallableStatement</code>.
* @see ResultSet * @exception SQLException If an error occurs.
*/ * @see CallableStatement
public abstract Statement */
createStatement(int resultSetType, int resultSetConcurrency) public CallableStatement prepareCall(String sql) throws SQLException;
throws SQLException;
/**
/*************************************************************************/ * This method converts the specified generic SQL statement into the
* native grammer of the database this object is connected to.
/** *
* This method creates a new <code>PreparedStatement</code> for the specified * @param The JDBC generic SQL statement.
* SQL string. This method is designed for use with parameterized * @return The native SQL statement.
* statements. The default result set type and concurrency will be used. * @exception SQLException If an error occurs.
* */
* @param The SQL statement to use in creating this public String nativeSQL(String sql) throws SQLException;
* <code>PreparedStatement</code>.
* /**
* @return A new <code>PreparedStatement</code>. * This method turns auto commit mode on or off. In auto commit mode,
* * every SQL statement is committed its own transaction. Otherwise a
* @exception SQLException If an error occurs. * transaction must be explicitly committed or rolled back.
* *
* @see PreparedStatement * @param autoCommit <code>true</code> to enable auto commit mode,
*/ * <code>false</code> to disable it.
public abstract PreparedStatement * @exception SQLException If an error occurs.
prepareStatement(String sql) throws SQLException; * @see commit
* @see rollback
/*************************************************************************/ */
public void setAutoCommit(boolean autoCommit) throws SQLException;
/**
* This method creates a new <code>PreparedStatement</code> for the specified /**
* SQL string. This method is designed for use with parameterized * This method tests whether or not auto commit mode is currently enabled.
* statements. The specified result set type and concurrency will be used. * In auto commit mode, every SQL statement is committed its own transaction.
* Valid values for these parameters are specified in the * Otherwise a transaction must be explicitly committed or rolled back.
* <code>ResultSet</code> class. *
* * @return <code>true</code> if auto commit mode is enabled,
* @param The SQL statement to use in creating this * <code>false</code> otherwise.
* <code>PreparedStatement</code>. *
* @param resultSetType The type of result set to use for this statement. * @exception SQLException If an error occurs.
* @param resultSetConcurrency. The type of concurrency to be used in *
* the result set for this statement. * @see commit
* * @see rollback
* @return A new <code>PreparedStatement</code>. */
* public boolean getAutoCommit() throws SQLException;
* @exception SQLException If an error occurs.
* /**
* @see PreparedStatement
* @see ResultSet
*/
public abstract PreparedStatement
prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
throws SQLException;
/*************************************************************************/
/**
* This method creates a new <code>CallableStatement</code> for the
* specified SQL string. Thie method is designed to be used with
* stored procedures. The default result set type and concurrency
* will be used.
*
* @param The SQL statement to use in creating this
* <code>CallableStatement</code>.
*
* @return A new <code>CallableStatement</code>.
*
* @exception SQLException If an error occurs.
*
* @see CallableStatement
*/
public abstract CallableStatement
prepareCall(String sql) throws SQLException;
/*************************************************************************/
/**
* This method creates a new <code>CallableStatement</code> for the
* specified SQL string. Thie method is designed to be used with
* stored procedures. The specified result set type and concurrency
* will be used. Valid values for these parameters are specified in the
* <code>ResultSet</code> class.
*
* @param The SQL statement to use in creating this
* <code>PreparedStatement</code>.
* @param resultSetType The type of result set to use for this statement.
* @param resultSetConcurrency. The type of concurrency to be used in
* the result set for this statement.
*
* @return A new <code>CallableStatement</code>.
*
* @exception SQLException If an error occurs.
*
* @see CallableStatement
* @see ResultSet
*/
public abstract CallableStatement
prepareCall(String sql, int resultSetType, int resultSetConcurrency)
throws SQLException;
/*************************************************************************/
/**
* This method converts the specified generic SQL statement into the
* native grammer of the database this object is connected to.
*
* @param The JDBC generic SQL statement.
*
* @return The native SQL statement.
*
* @exception SQLException If an error occurs.
*/
public abstract String
nativeSQL(String sql) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not auto commit mode is currently enabled.
* In auto commit mode, every SQL statement is committed its own transaction.
* Otherwise a transaction must be explicitly committed or rolled back.
*
* @return <code>true</code> if auto commit mode is enabled,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see commit
* @see rollback
*/
public abstract boolean
getAutoCommit() throws SQLException;
/*************************************************************************/
/**
* This method turns auto commit mode on or off. In auto commit mode,
* every SQL statement is committed its own transaction. Otherwise a
* transaction must be explicitly committed or rolled back.
*
* @param autoCommit <code>true</code> to enable auto commit mode,
* <code>false</code> to disable it.
*
* @exception SQLException If an error occurs.
*
* @see commit
* @see rollback
*/
public abstract void
setAutoCommit(boolean autoCommit) throws SQLException;
/*************************************************************************/
/**
* This method commits any SQL statements executed on this connection since * This method commits any SQL statements executed on this connection since
* the last commit or rollback. * the last commit or rollback.
* *
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract void public void commit() throws SQLException;
commit() throws SQLException;
/**
/*************************************************************************/ * This method rolls back any SQL statements executed on this connection
* since the last commit or rollback.
/** *
* This method rolls back any SQL statements executed on this connection * @exception SQLException If an error occurs.
* since the last commit or rollback. */
* public void rollback() throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract void * This method immediately closes this database connection.
rollback() throws SQLException; *
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public void close() throws SQLException;
/**
* This method immediately closes this database connection. /**
* * This method tests whether or not this connection has been closed.
* @exception SQLException If an error occurs. *
*/ * @return <code>true</code> if the connection is closed, <code>false</code>
public abstract void * otherwise.
close() throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public boolean isClosed() throws SQLException;
/** /**
* This method tests whether or not this connection has been closed. * This method returns the meta data for this database connection.
* *
* @return <code>true</code> if the connection is closed, <code>false</code> * @return The meta data for this database.
* otherwise. * @exception SQLException If an error occurs.
* * @see DatabaseMetaData
* @exception SQLException If an error occurs. */
*/ public DatabaseMetaData getMetaData() throws SQLException;
public abstract boolean
isClosed() throws SQLException; /**
* This method turns read only mode on or off. It may not be called while
/*************************************************************************/ * a transaction is in progress.
*
/** * @param readOnly <code>true</code> if this connection is read only,
* This method returns the meta data for this database connection. * <code>false</code> otherwise.
* * @exception SQLException If an error occurs.
* @return The meta data for this database. */
* public void setReadOnly(boolean readOnly) throws SQLException;
* @exception SQLException If an error occurs.
* /**
* @see DatabaseMetaData * This method tests whether or not this connection is in read only mode.
*/ *
public abstract DatabaseMetaData * @return <code>true</code> if the connection is read only <code>false</code>
getMetaData() throws SQLException; * otherwise.
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public boolean isReadOnly() throws SQLException;
/**
* This method tests whether or not this connection is in read only mode. /**
* * This method sets the name of the catalog in use by this connection.
* @return <code>true</code> if the connection is read only <code>false</code> * Note that this method does nothing if catalogs are not supported by
* otherwise. * this database.
* *
* @exception SQLException If an error occurs. * @param catalog The name of the catalog to use for this connection.
*/ * @exception SQLException If an error occurs.
public abstract boolean */
isReadOnly() throws SQLException; public void setCatalog(String catalog) throws SQLException;
/*************************************************************************/ /**
* This method returns the name of the catalog in use by this connection,
/** * if any.
* This method turns read only mode on or off. It may not be called while *
* a transaction is in progress. * @return The name of the catalog, or <code>null</code> if one does not
* * exist or catalogs are not supported by this database.
* @param readOnly <code>true</code> if this connection is read only, * @exception SQLException If an error occurs.
* <code>false</code> otherwise. */
* public String getCatalog() throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract void * This method sets the current transaction isolation mode. This must
setReadOnly(boolean readOnly) throws SQLException; * be one of the constants defined in this interface.
*
/*************************************************************************/ * @param level The transaction isolation level.
* @exception SQLException If an error occurs.
/** */
* This method returns the name of the catalog in use by this connection, public void setTransactionIsolation(int level) throws SQLException;
* if any.
* /**
* @return The name of the catalog, or <code>null</code> if one does not * This method returns the current transaction isolation mode. This will
* exist or catalogs are not supported by this database. * be one of the constants defined in this interface.
* *
* @exception SQLException If an error occurs. * @return The transaction isolation level.
*/ * @exception SQLException If an error occurs.
public abstract String */
getCatalog() throws SQLException; public int getTransactionIsolation() throws SQLException;
/*************************************************************************/ /**
* This method returns the first warning that occurred on this connection,
/** * if any. If there were any subsequence warnings, they will be chained
* This method sets the name of the catalog in use by this connection. * to the first one.
* Note that this method does nothing if catalogs are not supported by *
* this database. * @return The first <code>SQLWarning</code> that occurred, or
* * <code>null</code> if there have been no warnings.
* @param catalog The name of the catalog to use for this connection. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public SQLWarning getWarnings() throws SQLException;
*/
public abstract void /**
setCatalog(String catalog) throws SQLException; * This method clears all warnings that have occurred on this connection.
*
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public void clearWarnings() throws SQLException;
* This method returns the current transaction isolation mode. This will
* be one of the constants defined in this interface. /**
* * This method creates a new SQL statement with the specified type and
* @return The transaction isolation level. * concurrency. Valid values for these parameters are specified in the
* * <code>ResultSet</code> class.
* @exception SQLException If an error occurs. *
*/ * @param resultSetType The type of result set to use for this statement.
public abstract int * @param resultSetConcurrency. The type of concurrency to be used in
getTransactionIsolation() throws SQLException; * the result set for this statement.
* @return A new <code>Statement</code> object.
/*************************************************************************/ * @exception SQLException If an error occurs.
* @see Statement
/** * @see ResultSet
* This method sets the current transaction isolation mode. This must */
* be one of the constants defined in this interface. public Statement createStatement(int resultSetType, int resultSetConcurrency)
* throws SQLException;
* @param level The transaction isolation level.
* /**
* @exception SQLException If an error occurs. * This method creates a new <code>PreparedStatement</code> for the specified
*/ * SQL string. This method is designed for use with parameterized
public abstract void * statements. The specified result set type and concurrency will be used.
setTransactionIsolation(int level) throws SQLException; * Valid values for these parameters are specified in the
* <code>ResultSet</code> class.
/*************************************************************************/ *
* @param The SQL statement to use in creating this
/** * <code>PreparedStatement</code>.
* This method returns the first warning that occurred on this connection, * @param resultSetType The type of result set to use for this statement.
* if any. If there were any subsequence warnings, they will be chained * @param resultSetConcurrency. The type of concurrency to be used in
* to the first one. * the result set for this statement.
* * @return A new <code>PreparedStatement</code>.
* @return The first <code>SQLWarning</code> that occurred, or * @exception SQLException If an error occurs.
* <code>null</code> if there have been no warnings. * @see PreparedStatement
* * @see ResultSet
* @exception SQLException If an error occurs. */
*/ public PreparedStatement prepareStatement(String sql, int resultSetType,
public abstract SQLWarning int resultSetConcurrency) throws SQLException;
getWarnings() throws SQLException;
/**
/*************************************************************************/ * This method creates a new <code>CallableStatement</code> for the
* specified SQL string. Thie method is designed to be used with
/** * stored procedures. The specified result set type and concurrency
* This method clears all warnings that have occurred on this connection. * will be used. Valid values for these parameters are specified in the
* * <code>ResultSet</code> class.
* @exception SQLException If an error occurs. *
*/ * @param The SQL statement to use in creating this
public abstract void * <code>PreparedStatement</code>.
clearWarnings() throws SQLException; * @param resultSetType The type of result set to use for this statement.
* @param resultSetConcurrency. The type of concurrency to be used in
/*************************************************************************/ * the result set for this statement.
* @return A new <code>CallableStatement</code>.
/** * @exception SQLException If an error occurs.
* This method returns the mapping of SQL types to Java classes * @see CallableStatement
* currently in use by this connection. This mapping will have no * @see ResultSet
* entries unless they have been manually added. */
* public CallableStatement prepareCall(String sql, int resultSetType, int
* @return The SQL type to Java class mapping. resultSetConcurrency) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method returns the mapping of SQL types to Java classes
public abstract Map * currently in use by this connection. This mapping will have no
getTypeMap() throws SQLException; * entries unless they have been manually added.
*
/*************************************************************************/ * @return The SQL type to Java class mapping.
* @exception SQLException If an error occurs.
/** */
* This method sets the mapping table for SQL types to Java classes. public Map getTypeMap() throws SQLException;
* Any entries in this map override the defaults.
* /**
* @param map The new SQL mapping table. * This method sets the mapping table for SQL types to Java classes.
* * Any entries in this map override the defaults.
* @exception SQLException If an error occurs. *
*/ * @param map The new SQL mapping table.
public abstract void * @exception SQLException If an error occurs.
setTypeMap(Map map) throws SQLException; */
public void setTypeMap(Map map) throws SQLException;
} // interface Connection
/**
* @since 1.4
*/
public void setHoldability(int holdability) throws SQLException;
/**
* @since 1.4
*/
public int getHoldability() throws SQLException;
/**
* @since 1.4
*/
public Savepoint setSavepoint() throws SQLException;
/**
* @since 1.4
*/
public Savepoint setSavepoint(String name) throws SQLException;
/**
* @since 1.4
*/
public void rollback(Savepoint savepoint) throws SQLException;
/**
* @since 1.4
*/
public void releaseSavepoint(Savepoint savepoint) throws SQLException;
/**
* @since 1.4
*/
public Statement createStatement(int resultSetType, int
resultSetConcurrency, int resultSetHoldability) throws SQLException;
/**
* @since 1.4
*/
public PreparedStatement prepareStatement(String sql, int resultSetType, int
resultSetConcurrency, int resultSetHoldability) throws SQLException;
/**
* @since 1.4
*/
public CallableStatement prepareCall(String sql, int resultSetType, int
resultSetConcurrency, int resultSetHoldability) throws SQLException;
/**
* @since 1.4
*/
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
throws SQLException;
/**
* @since 1.4
*/
public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
throws SQLException;
/**
* @since 1.4
*/
public PreparedStatement prepareStatement(String sql, String[] columnNames)
throws SQLException;
}
/* DataTruncation.java -- Warning when data has been truncated. /* DataTruncation.java -- Warning when data has been truncated.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not ...@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
/** /**
...@@ -44,164 +43,115 @@ package java.sql; ...@@ -44,164 +43,115 @@ package java.sql;
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public class DataTruncation extends SQLWarning public class DataTruncation extends SQLWarning
{
/*************************************************************************/
/*
* Instance Variables
*/
/**
* The original size of the data.
* @serialized
*/
private int dataSize;
/**
* The index of the parameter or column whose value was truncated.
* @serialized
*/
private int index;
/**
* Indicates whether or not a parameter value was truncated.
* @serialized
*/
private boolean parameter;
/**
* Indicates whether or not a data column value was truncated.
* @serialized
*/
private boolean read;
/**
* This is the size of the data after truncation.
* @serialized
*/
private int transferSize;
/*************************************************************************/
/**
* Static Variables
*/
/**
* This is the serialization UID for this class
*/
private static final long serialVersionUID = 6464298989504059473L;
/*************************************************************************/
/*
* Constructors
*/
/**
* This method initializes a new instance of <code>DataTruncation</code>
* with the specified values. The descriptive error message for this
* exception will be "Data truncation", the SQL state will be "01004"
* and the vendor specific error code will be set to 0.
*
* @param index The index of the parameter or column that was truncated.
* @param parameter <code>true</code> if a parameter was truncated,
* <code>false</code> otherwise.
* @param read <code>true</code> if a data column was truncated,
* <code>false</code> otherwise.
* @param dataSize The original size of the data.
* @param transferSize The size of the data after truncation.
*/
public
DataTruncation(int index, boolean parameter, boolean read, int dataSize,
int transferSize)
{ {
super("Data truncation", "01004"); static final long serialVersionUID = 6464298989504059473L;
this.index = index; /**
this.parameter = parameter; * The original size of the data.
this.read = read; */
this.dataSize = dataSize; private int dataSize;
this.transferSize = transferSize;
/**
* The index of the parameter or column whose value was truncated.
*/
private int index;
/**
* Indicates whether or not a parameter value was truncated.
*/
private boolean parameter;
/**
* Indicates whether or not a data column value was truncated.
*/
private boolean read;
/**
* This is the size of the data after truncation.
*/
private int transferSize;
/**
* This method initializes a new instance of <code>DataTruncation</code>
* with the specified values. The descriptive error message for this
* exception will be "Data truncation", the SQL state will be "01004"
* and the vendor specific error code will be set to 0.
*
* @param index The index of the parameter or column that was truncated.
* @param parameter <code>true</code> if a parameter was truncated,
* <code>false</code> otherwise.
* @param read <code>true</code> if a data column was truncated,
* <code>false</code> otherwise.
* @param dataSize The original size of the data.
* @param transferSize The size of the data after truncation.
*/
public DataTruncation(int index, boolean parameter, boolean read, int
dataSize, int transferSize)
{
super("Data truncation", "01004");
this.index = index;
this.parameter = parameter;
this.read = read;
this.dataSize = dataSize;
this.transferSize = transferSize;
}
/**
* This method returns the index of the column or parameter that was
* truncated.
*
* @return The index of the column or parameter that was truncated.
*/
public int getIndex()
{
return index;
}
/**
* This method determines whether or not it was a parameter that was
* truncated.
*
* @return <code>true</code> if a parameter was truncated, <code>false</code>
* otherwise.
*/
public boolean getParameter()
{
return parameter;
}
/**
* This method determines whether or not it was a column that was
* truncated.
*
* @return <code>true</code> if a column was truncated, <code>false</code>
* otherwise.
*/
public boolean getRead()
{
return read;
}
/**
* This method returns the original size of the parameter or column that
* was truncated.
*
* @return The original size of the parameter or column that was truncated.
*/
public int getDataSize()
{
return dataSize;
}
/**
* This method returns the size of the parameter or column after it was
* truncated.
*
* @return The size of the parameter or column after it was truncated.
*/
public int getTransferSize()
{
return transferSize;
}
} }
/*************************************************************************/
/*
* Instance Methods
*/
/**
* This method returns the index of the column or parameter that was
* truncated.
*
* @return The index of the column or parameter that was truncated.
*/
public int
getIndex()
{
return(index);
}
/*************************************************************************/
/**
* This method determines whether or not it was a parameter that was
* truncated.
*
* @return <code>true</code> if a parameter was truncated, <code>false</code>
* otherwise.
*/
public boolean
getParameter()
{
return(parameter);
}
/*************************************************************************/
/**
* This method determines whether or not it was a column that was
* truncated.
*
* @return <code>true</code> if a column was truncated, <code>false</code>
* otherwise.
*/
public boolean
getRead()
{
return(read);
}
/*************************************************************************/
/**
* This method returns the original size of the parameter or column that
* was truncated.
*
* @return The original size of the parameter or column that was truncated.
*/
public int
getDataSize()
{
return(dataSize);
}
/*************************************************************************/
/**
* This method returns the size of the parameter or column after it was
* truncated.
*
* @return The size of the parameter or column after it was truncated.
*/
public int
getTransferSize()
{
return(transferSize);
}
} // class DataTruncation
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not ...@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -46,104 +45,69 @@ import java.text.SimpleDateFormat; ...@@ -46,104 +45,69 @@ import java.text.SimpleDateFormat;
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public class Date extends java.util.Date public class Date extends java.util.Date
{
/*
* Class Variables
*/
/**
* Used for parsing and formatting this date.
*/
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
/**
* This is the serialization UID for this class.
*/
private static final long serialVersionUID = 1511598038487230103L;
/*************************************************************************/
/*
* Class Methods
*/
/**
* This method returns a new instance of this class by parsing a
* date in JDBC format into a Java date.
*
* @param str The string to parse.
*
* @return The resulting <code>java.sql.Date</code> value.
*/
public static Date
valueOf(String str)
{
try
{
java.util.Date d = (java.util.Date)sdf.parseObject(str);
return(new Date(d.getTime()));
}
catch(Exception e)
{
return(null);
}
}
/*************************************************************************/
/*
* Constructors
*/
/**
* This method initializes a new instance of this class with the
* specified year, month, and day.
*
* @param year The year of this date minue 1900.
* @param month The month of this date (0-11).
* @param day The day of this date (1-31).
*
* @deprecated
*/
public
Date(int year, int month, int day)
{
super(year, month, day);
}
/*************************************************************************/
/**
* This method initializes a new instance of this class with the
* specified time value representing the number of seconds since
* Jan 1, 1970 at 12:00 midnight GMT.
*
* @param time The time value to intialize this date to.
*/
public
Date(long date)
{ {
super(date); static final long serialVersionUID = 1511598038487230103L;
/**
* Used for parsing and formatting this date.
*/
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
/**
* This method initializes a new instance of this class with the
* specified year, month, and day.
*
* @param year The year of this date minue 1900.
* @param month The month of this date (0-11).
* @param day The day of this date (1-31).
*
* @deprecated
*/
public Date(int year, int month, int day)
{
super(year, month, day);
}
/**
* This method initializes a new instance of this class with the
* specified time value representing the number of seconds since
* Jan 1, 1970 at 12:00 midnight GMT.
*
* @param time The time value to intialize this date to.
*/
public Date(long date)
{
super(date);
}
/**
* This method returns a new instance of this class by parsing a
* date in JDBC format into a Java date.
*
* @param str The string to parse.
* @return The resulting <code>java.sql.Date</code> value.
*/
public static Date valueOf(String str)
{
try
{
java.util.Date d = (java.util.Date) sdf.parseObject(str);
return(new Date(d.getTime()));
}
catch(Exception e)
{
return(null);
}
}
/**
* This method returns this date in JDBC format.
*
* @return This date as a string.
*/
public String toString()
{
return(sdf.format(this));
}
} }
/*************************************************************************/
/*
* Instance Methods
*/
/**
* This method returns this date in JDBC format.
*
* @return This date as a string.
*/
public String
toString()
{
return(sdf.format(this));
}
} // class Date
...@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not ...@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.util.Properties; import java.util.Properties;
...@@ -54,95 +53,71 @@ import java.util.Properties; ...@@ -54,95 +53,71 @@ import java.util.Properties;
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface Driver public interface Driver
{ {
/**
/** * This method connects to the specified database using the connection
* This method returns the major version number of the driver. * properties supplied. If the driver does not understand the database
* * URL, it should return <code>null</code> instead of throwing an
* @return The major version number of the driver. * exception since the <code>DriverManager</code> will probe a driver
*/ * in this manner.
public abstract int *
getMajorVersion(); * @param url The URL string for this connection.
* @param properties The list of database connection properties.
/*************************************************************************/ * @return A <code>Connection</code> object for the newly established
* connection, or <code>null</code> if the URL is not understood.
/** * @exception SQLException If an error occurs.
* This method returns the minor version number of the driver. */
* public Connection connect(String url, Properties info) throws SQLException;
* @return The minor version number of the driver.
*/ /**
public abstract int * This method tests whether or not the driver believes it can connect to
getMinorVersion(); * the specified database. The driver should only test whether it
* understands and accepts the URL. It should not necessarily attempt to
/*************************************************************************/ * probe the database for a connection.
*
/** * @param The database URL string.
* This method tests whether or not the driver is JDBC compliant. This * @return <code>true</code> if the drivers can connect to the database,
* method should only return <code>true</code> if the driver has been * <code>false</code> otherwise.
* certified as JDBC compliant. * @exception SQLException If an error occurs.
* */
* @return <code>true</code> if the driver has been certified JDBC compliant, public boolean acceptsURL(String url) throws SQLException;
* <code>false</code> otherwise.
*/ /**
public abstract boolean * This method returns an array of possible properties that could be
jdbcCompliant(); * used to connect to the specified database.
*
/*************************************************************************/ * @param url The URL string of the database to connect to.
* @param properties The list of properties the caller is planning to use
/** * to connect to the database.
* This method returns an array of possible properties that could be * @return A list of possible additional properties for a connection to this
* used to connect to the specified database. * database. This list may be empty.
* * @exception SQLException If an error occurs.
* @param url The URL string of the database to connect to. */
* @param properties The list of properties the caller is planning to use public DriverPropertyInfo[] getPropertyInfo(String url, Properties properties)
* to connect to the database. throws SQLException;
*
* @return A list of possible additional properties for a connection to this /**
* database. This list may be empty. * This method returns the major version number of the driver.
* *
* @exception SQLException If an error occurs. * @return The major version number of the driver.
*/ */
public abstract DriverPropertyInfo[] public int getMajorVersion();
getPropertyInfo(String url, Properties properties) throws SQLException;
/**
/*************************************************************************/ * This method returns the minor version number of the driver.
*
/** * @return The minor version number of the driver.
* This method tests whether or not the driver believes it can connect to */
* the specified database. The driver should only test whether it public int getMinorVersion();
* understands and accepts the URL. It should not necessarily attempt to
* probe the database for a connection. /**
* * This method tests whether or not the driver is JDBC compliant. This
* @param The database URL string. * method should only return <code>true</code> if the driver has been
* * certified as JDBC compliant.
* @return <code>true</code> if the drivers can connect to the database, *
* <code>false</code> otherwise. * @return <code>true</code> if the driver has been certified JDBC compliant,
* * <code>false</code> otherwise.
* @exception SQLException If an error occurs. */
*/ public boolean jdbcCompliant();
public abstract boolean }
acceptsURL(String url) throws SQLException;
/*************************************************************************/
/**
* This method connects to the specified database using the connection
* properties supplied. If the driver does not understand the database
* URL, it should return <code>null</code> instead of throwing an
* exception since the <code>DriverManager</code> will probe a driver
* in this manner.
*
* @param url The URL string for this connection.
* @param properties The list of database connection properties.
*
* @return A <code>Connection</code> object for the newly established
* connection, or <code>null</code> if the URL is not understood.
*
* @exception SQLException If an error occurs.
*/
public abstract Connection
connect(String url, Properties properties) throws SQLException;
} // interface Driver
...@@ -35,15 +35,14 @@ this exception to your version of the library, but you are not ...@@ -35,15 +35,14 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.io.PrintStream; import java.io.PrintStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector; import java.util.Vector;
import java.util.StringTokenizer;
/** /**
* This class manages the JDBC drivers in the system. It maintains a * This class manages the JDBC drivers in the system. It maintains a
...@@ -65,341 +64,280 @@ import java.util.Vector; ...@@ -65,341 +64,280 @@ import java.util.Vector;
*/ */
public class DriverManager public class DriverManager
{ {
/**
/* * This is the log stream for JDBC drivers.
* Class Variables */
*/ private static PrintStream log_stream;
/** /**
* This is the log stream for JDBC drivers. * This is the log writer for JDBC drivers.
*/ */
private static PrintStream log_stream; private static PrintWriter log_writer;
/** /**
* This is the log writer for JDBC drivers. * This is the login timeout used by JDBC drivers.
*/ */
private static PrintWriter log_writer; private static int login_timeout;
/** /**
* This is the login timeout used by JDBC drivers. * This is the list of JDBC drivers that are loaded.
*/ */
private static int login_timeout; private static Vector drivers;
// Hmm, seems like we might want to do a Hashtable and lookup by something,
/** // but what would it be?
* This is the list of JDBC drivers that are loaded.
*/ // Load all drivers on startup
private static Vector drivers; static
// Hmm, seems like we might want to do a Hashtable and lookup by something, {
// but what would it be? drivers = new Vector();
// Load all drivers on startup String driver_string = System.getProperty("jdbc.drivers");
static if (driver_string != null)
{ {
drivers = new Vector(); StringTokenizer st = new StringTokenizer(driver_string);
while (st.hasMoreTokens())
String driver_string = System.getProperty("jdbc.drivers"); {
if (driver_string != null) String driver_classname = st.nextToken();
{
StringTokenizer st = new StringTokenizer(driver_string); try
while (st.hasMoreTokens()) {
{ Class.forName(driver_classname); // The driver registers itself
String driver_classname = st.nextToken(); }
catch (Exception e) { ; } // Ignore not founds
try }
{ }
Class.forName(driver_classname); // The driver registers itself
} }
catch (Exception e) { ; } // Ignore not founds
} /** Can't be instantiated. */
} private DriverManager()
{
} }
/**
* This method returns the log writer being used by all JDBC drivers.
* This method should be used in place of the deprecated
* <code>getLogStream</code> method.
*
* @return The log writer in use by JDBC drivers.
*/
public static PrintWriter getLogWriter()
{
return log_writer;
}
/*************************************************************************/ /**
* This method sets the log writer being used by JDBC drivers. This is a
/* * system-wide parameter that affects all drivers. Note that since there
* Class Methods * is no way to retrieve a <code>PrintStream</code> from a
*/ * <code>PrintWriter</code>, this method cannot set the log stream in
* use by JDBC. Thus any older drivers may not see this setting.
/** *
* This method returns the login timeout in use by JDBC drivers systemwide. * @param out The new log writer for JDBC.
* */
* @return The login timeout. public static void setLogWriter(PrintWriter out)
*/ {
public static int DriverManager.log_writer = out;
getLoginTimeout() }
{
return(login_timeout);
}
/*************************************************************************/
/**
* This method set the login timeout used by JDBC drivers. This is a
* system-wide parameter that applies to all drivers.
*
* @param login_timeout The new login timeout value.
*/
public static void
setLoginTimeout(int login_timeout)
{
DriverManager.login_timeout = login_timeout;
}
/*************************************************************************/
/**
* This method returns the log writer being used by all JDBC drivers.
* This method should be used in place of the deprecated
* <code>getLogStream</code> method.
*
* @return The log writer in use by JDBC drivers.
*/
public static PrintWriter
getLogWriter()
{
return(log_writer);
}
/*************************************************************************/
/**
* This method sets the log writer being used by JDBC drivers. This is a
* system-wide parameter that affects all drivers. Note that since there
* is no way to retrieve a <code>PrintStream</code> from a
* <code>PrintWriter</code>, this method cannot set the log stream in
* use by JDBC. Thus any older drivers may not see this setting.
*
* @param log_writer The new log writer for JDBC.
*/
public static void
setLogWriter(PrintWriter log_writer)
{
DriverManager.log_writer = log_writer;
}
/*************************************************************************/
/**
* This method returns the log stream in use by JDBC.
*
* @return The log stream in use by JDBC.
*
* @deprecated Use <code>getLogWriter()</code> instead.
*/
public static PrintStream
getLogStream()
{
return(log_stream);
}
/*************************************************************************/
/**
* This method sets the log stream in use by JDBC.
*
* @param log_stream The log stream in use by JDBC.
*
* @deprecated Use <code>setLogWriter</code> instead.
*/
public static void
setLogStream(PrintStream log_stream)
{
DriverManager.log_stream = log_stream;
}
/*************************************************************************/
/**
* This method prints the specified line to the log stream.
*
* @param str The string to write to the log stream.
*/
public static void
println(String str)
{
if (log_stream != null) // Watch for user not using logging
log_stream.println(str);
}
/*************************************************************************/
/**
* This method registers a new driver with the manager. This is normally
* called by the driver itself in a static initializer.
*
* @param driver The new <code>Driver</code> to add.
*
* @exception SQLException If an error occurs.
*/
public static void
registerDriver(Driver driver) throws SQLException
{
if (!drivers.contains(driver))
drivers.addElement(driver);
}
/*************************************************************************/
/**
* This method de-registers a driver from the manager.
*
* @param driver The <code>Driver</code> to unregister.
*
* @exception SQLException If an error occurs.
*/
public static void
deregisterDriver(Driver driver) throws SQLException
{
if (drivers.contains(driver))
drivers.removeElement(driver);
}
/*************************************************************************/
/**
* This method returns a list of all the currently registered JDBC drivers
* that were loaded by the current <code>ClassLoader</code>.
*
* @return An <code>Enumeration</code> of all currently loaded JDBC drivers.
*/
public static Enumeration
getDrivers()
{
Vector v = new Vector();
Enumeration e = drivers.elements();
// Is this right?
ClassLoader cl = Thread.currentThread().getContextClassLoader();
while(e.hasMoreElements())
{
Object obj = e.nextElement();
ClassLoader loader = obj.getClass().getClassLoader();
if (loader == null)
loader = ClassLoader.getSystemClassLoader();
if (!loader.equals(cl))
continue;
v.addElement(obj);
}
return(v.elements());
}
/*************************************************************************/
/**
* This method returns a driver that can connect to the specified
* JDBC URL string. This will be selected from among drivers loaded
* at initialization time and those drivers manually loaded by the
* same class loader as the caller.
*
* @param url The JDBC URL string to find a driver for.
*
* @return A <code>Driver</code> that can connect to the specified
* URL, or <code>null</code> if a suitable driver cannot be found.
*
* @exception SQLException If an error occurs.
*/
public static Driver
getDriver(String url) throws SQLException
{
// FIXME: Limit driver search to the appropriate subset of loaded drivers.
Enumeration e = drivers.elements();
while(e.hasMoreElements())
{
Driver d = (Driver)e.nextElement();
if (d.acceptsURL(url))
return(d);
}
return(null);
}
/*************************************************************************/
/** /**
* This method attempts to return a connection to the specified * This method attempts to return a connection to the specified
* JDBC URL string. * JDBC URL string using the specified connection properties.
*
* @param url The JDBC URL string to connect to.
*
* @return A <code>Connection</code> to that URL.
*
* @exception SQLException If an error occurs.
*/
public static Connection
getConnection(String url) throws SQLException
{
return(getConnection(url, new Properties()));
}
/*************************************************************************/
/**
* This method attempts to return a connection to the specified
* JDBC URL string using the specified username and password.
* *
* @param url The JDBC URL string to connect to. * @param url The JDBC URL string to connect to.
* @param user The username to connect with. * @param properties The connection properties.
* @param password The password to connect with.
* *
* @return A <code>Connection</code> to that URL. * @return A <code>Connection</code> to that URL.
* *
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public static Connection public static Connection getConnection(String url, Properties properties)
getConnection(String url, String user, String password) throws SQLException throws SQLException
{ {
Properties p = new Properties(); Driver d = getDriver(url);
if (d == null)
if (user != null) throw new SQLException("Driver not found for URL: " + url);
p.setProperty("user", user);
if (password != null) return d.connect(url, properties);
p.setProperty("password", password); }
return(getConnection(url, p));
} /**
* This method attempts to return a connection to the specified
/*************************************************************************/ * JDBC URL string using the specified username and password.
*
* @param url The JDBC URL string to connect to.
* @param user The username to connect with.
* @param password The password to connect with.
* @return A <code>Connection</code> to that URL.
* @exception SQLException If an error occurs.
*/
public static Connection getConnection(String url, String user,
String password) throws SQLException
{
Properties p = new Properties();
if (user != null)
p.setProperty("user", user);
if (password != null)
p.setProperty("password", password);
return getConnection(url, p);
}
/**
* This method attempts to return a connection to the specified
* JDBC URL string.
*
* @param url The JDBC URL string to connect to.
*
* @return A <code>Connection</code> to that URL.
*
* @exception SQLException If an error occurs.
*/
public static Connection getConnection(String url) throws SQLException
{
return getConnection(url, new Properties());
}
/**
* This method returns a driver that can connect to the specified
* JDBC URL string. This will be selected from among drivers loaded
* at initialization time and those drivers manually loaded by the
* same class loader as the caller.
*
* @param url The JDBC URL string to find a driver for.
*
* @return A <code>Driver</code> that can connect to the specified
* URL, or <code>null</code> if a suitable driver cannot be found.
*
* @exception SQLException If an error occurs.
*/
public static Driver getDriver(String url) throws SQLException
{
// FIXME: Limit driver search to the appropriate subset of loaded drivers.
Enumeration e = drivers.elements();
while(e.hasMoreElements())
{
Driver d = (Driver)e.nextElement();
if (d.acceptsURL(url))
return d;
}
return null;
}
/**
* This method registers a new driver with the manager. This is normally
* called by the driver itself in a static initializer.
*
* @param driver The new <code>Driver</code> to add.
*
* @exception SQLException If an error occurs.
*/
public static void registerDriver(Driver driver) throws SQLException
{
if (! drivers.contains(driver))
drivers.addElement(driver);
}
/** /**
* This method attempts to return a connection to the specified * This method de-registers a driver from the manager.
* JDBC URL string using the specified connection properties.
*
* @param url The JDBC URL string to connect to.
* @param properties The connection properties.
* *
* @return A <code>Connection</code> to that URL. * @param driver The <code>Driver</code> to unregister.
* *
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public static Connection public static void deregisterDriver(Driver driver) throws SQLException
getConnection(String url, Properties properties) throws SQLException {
{ if (drivers.contains(driver))
Driver d = getDriver(url); drivers.removeElement(driver);
if (d == null) }
throw new SQLException("Driver not found for URL: " + url);
/**
return(d.connect(url, properties)); * This method returns a list of all the currently registered JDBC drivers
* that were loaded by the current <code>ClassLoader</code>.
*
* @return An <code>Enumeration</code> of all currently loaded JDBC drivers.
*/
public static Enumeration getDrivers()
{
Vector v = new Vector();
Enumeration e = drivers.elements();
// Is this right?
ClassLoader cl = Thread.currentThread().getContextClassLoader();
while(e.hasMoreElements())
{
Object obj = e.nextElement();
ClassLoader loader = obj.getClass().getClassLoader();
if (loader == null)
loader = ClassLoader.getSystemClassLoader();
if (! loader.equals(cl))
continue;
v.addElement(obj);
}
return v.elements();
}
/**
* This method set the login timeout used by JDBC drivers. This is a
* system-wide parameter that applies to all drivers.
*
* @param login_timeout The new login timeout value.
*/
public static void setLoginTimeout(int seconds)
{
DriverManager.login_timeout = login_timeout;
}
/**
* This method returns the login timeout in use by JDBC drivers systemwide.
*
* @return The login timeout.
*/
public static int getLoginTimeout()
{
return login_timeout;
}
/**
* This method sets the log stream in use by JDBC.
*
* @param log_stream The log stream in use by JDBC.
*
* @deprecated Use <code>setLogWriter</code> instead.
*/
public static void setLogStream(PrintStream out)
{
DriverManager.log_stream = log_stream;
}
/**
* This method returns the log stream in use by JDBC.
*
* @return The log stream in use by JDBC.
*
* @deprecated Use <code>getLogWriter()</code> instead.
*/
public static PrintStream getLogStream()
{
return log_stream;
}
/**
* This method prints the specified line to the log stream.
*
* @param str The string to write to the log stream.
*/
public static void println(String message)
{
if (log_stream != null) // Watch for user not using logging
log_stream.println(message);
}
} }
/*************************************************************************/
/*
* Constructors
*/
// Keep bozos from trying to instantiate us.
private
DriverManager()
{
;
}
} // class DriverManager
...@@ -39,64 +39,50 @@ exception statement from your version. */ ...@@ -39,64 +39,50 @@ exception statement from your version. */
package java.sql; package java.sql;
/** /**
* This class holds a driver property that can be used for querying or * This class holds a driver property that can be used for querying or
* setting driver configuration parameters. * setting driver configuration parameters.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class DriverPropertyInfo
{
/*
* Instance Variables
*/ */
public class DriverPropertyInfo
/**
* The name of the property.
*/
public String name;
/**
* This is the value of the property.
*/
public String value;
/**
* A description of the property, possibly <code>null</code>.
*/
public String description;
/**
* A flag indicating whether or not a value for this property is required
* in order to connect to the database.
*/
public boolean required;
/**
* If values are restricted to certain choices, this is the list of valid
* ones. Otherwise it is <code>null</code>.
*/
public String[] choices;
/*************************************************************************/
/*
* Constructors
*/
/**
* This method initializes a new instance of <code>DriverPropertyInfo</code>
* with the specified name and value. All other fields are defaulted.
*
* @param name The name of the property.
* @param value The value to assign to the property.
*/
public
DriverPropertyInfo(String name, String value)
{ {
this.name = name; /**
this.value = value; * The name of the property.
*/
public String name;
/**
* A description of the property, possibly <code>null</code>.
*/
public String description;
/**
* A flag indicating whether or not a value for this property is required
* in order to connect to the database.
*/
public boolean required;
/**
* This is the value of the property.
*/
public String value;
/**
* If values are restricted to certain choices, this is the list of valid
* ones. Otherwise it is <code>null</code>.
*/
public String[] choices;
/**
* This method initializes a new instance of <code>DriverPropertyInfo</code>
* with the specified name and value. All other fields are defaulted.
*
* @param name The name of the property.
* @param value The value to assign to the property.
*/
public DriverPropertyInfo(String name, String value)
{
this.name = name;
this.value = value;
}
} }
} // DriverPropertyInfo
/* ParameterMetaData.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.sql;
/**
* @since 1.4
*/
public interface ParameterMetaData
{
public static final int parameterNoNulls = 0;
public static final int parameterNullable = 1;
public static final int parameterNullableUnknown = 2;
public static final int parameterModeUnknown = 0;
public static final int parameterModeIn = 1;
public static final int parameterModeInOut = 2;
public static final int parameterModeOut = 4;
/**
* @since 1.4
*/
public int getParameterCount() throws SQLException;
/**
* @since 1.4
*/
public int isNullable(int param) throws SQLException;
/**
* @since 1.4
*/
public boolean isSigned(int param) throws SQLException;
/**
* @since 1.4
*/
public int getPrecision(int param) throws SQLException;
/**
* @since 1.4
*/
public int getScale(int param) throws SQLException;
/**
* @since 1.4
*/
public int getParameterType(int param) throws SQLException;
/**
* @since 1.4
*/
public String getParameterTypeName(int param) throws SQLException;
/**
* @since 1.4
*/
public String getParameterClassName(int param) throws SQLException;
/**
* @since 1.4
*/
public int getParameterMode(int param) throws SQLException;
}
...@@ -35,523 +35,404 @@ this exception to your version of the library, but you are not ...@@ -35,523 +35,404 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.io.InputStream; import java.io.InputStream;
import java.io.Reader; import java.io.Reader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL;
import java.util.Calendar; import java.util.Calendar;
/** /**
* This interface provides a mechanism for executing pre-compiled * This interface provides a mechanism for executing pre-compiled
* statements. This provides greater efficiency when calling the same * statements. This provides greater efficiency when calling the same
* statement multiple times. Parameters are allowed in a statement, * statement multiple times. Parameters are allowed in a statement,
* providings for maximum reusability. * providings for maximum reusability.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface PreparedStatement extends Statement public interface PreparedStatement extends Statement
{ {
/**
/** * This method executes a prepared SQL query and returns its ResultSet.
* This method populates the specified parameter with a SQL NULL value *
* for the specified type. * @return The ResultSet of the SQL statement.
* * @exception SQLException If an error occurs.
* @param index The index of the parameter to set. */
* @param type The SQL type identifier of the parameter from <code>Types</code> public ResultSet executeQuery() throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method executes an SQL INSERT, UPDATE or DELETE statement. SQL
public abstract void * statements that return nothing such as SQL DDL statements can be executed.
setNull(int index, int type) throws SQLException; *
* @return The result is either the row count for INSERT, UPDATE or DELETE
/*************************************************************************/ * statements; or 0 for SQL statements that return nothing.
* @exception SQLException If an error occurs.
/** */
* This method populates the specified parameter with a SQL NULL value public int executeUpdate() throws SQLException;
* for the specified type.
* /**
* @param index The index of the parameter to set. * This method populates the specified parameter with a SQL NULL value
* @param type The SQL type identifier of the parameter from <code>Types</code> * for the specified type.
* @param name The name of the data type, for user defined types. *
* * @param index The index of the parameter to set.
* @exception SQLException If an error occurs. * @param type The SQL type identifier of the parameter from <code>Types</code>
*/ *
public abstract void * @exception SQLException If an error occurs.
setNull(int index, int type, String name) throws SQLException; */
public void setNull(int parameterIndex, int sqlType) throws SQLException;
/*************************************************************************/
/**
/** * This method sets the specified parameter from the given Java
* This method sets the specified parameter from the given Java * <code>boolean</code> value.
* <code>boolean</code> value. *
* * @param index The index of the parameter value to set.
* @param index The index of the parameter value to set. * @param value The value of the parameter.
* @param value The value of the parameter. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public void setBoolean(int parameterIndex, boolean x) throws SQLException;
*/
public abstract void /**
setBoolean(int index, boolean value) throws SQLException; * This method sets the specified parameter from the given Java
* <code>byte</code> value.
/*************************************************************************/ *
* @param index The index of the parameter value to set.
/** * @param value The value of the parameter.
* This method sets the specified parameter from the given Java * @exception SQLException If an error occurs.
* <code>byte</code> value. */
* public void setByte(int parameterIndex, byte x) throws SQLException;
* @param index The index of the parameter value to set.
* @param value The value of the parameter. /**
* * This method sets the specified parameter from the given Java
* @exception SQLException If an error occurs. * <code>short</code> value.
*/ *
public abstract void * @param index The index of the parameter value to set.
setByte(int index, byte value) throws SQLException; * @param value The value of the parameter.
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public void setShort(int parameterIndex, short x) throws SQLException;
/**
* This method sets the specified parameter from the given Java /**
* <code>short</code> value. * This method sets the specified parameter from the given Java
* * <code>int</code> value.
* @param index The index of the parameter value to set. *
* @param value The value of the parameter. * @param index The index of the parameter value to set.
* * @param value The value of the parameter.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract void public void setInt(int parameterIndex, int x) throws SQLException;
setShort(int index, short value) throws SQLException;
/**
/*************************************************************************/ * This method sets the specified parameter from the given Java
* <code>long</code> value.
/** *
* This method sets the specified parameter from the given Java * @param index The index of the parameter value to set.
* <code>int</code> value. * @param value The value of the parameter.
* * @exception SQLException If an error occurs.
* @param index The index of the parameter value to set. */
* @param value The value of the parameter. public void setLong(int parameterIndex, long x) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method sets the specified parameter from the given Java
public abstract void * <code>float</code> value.
setInt(int index, int value) throws SQLException; *
* @param index The index of the parameter value to set.
/*************************************************************************/ * @param value The value of the parameter.
* @exception SQLException If an error occurs.
/** */
* This method sets the specified parameter from the given Java public void setFloat(int parameterIndex, float x) throws SQLException;
* <code>long</code> value.
* /**
* @param index The index of the parameter value to set. * This method sets the specified parameter from the given Java
* @param value The value of the parameter. * <code>double</code> value.
* *
* @exception SQLException If an error occurs. * @param index The index of the parameter value to set.
*/ * @param value The value of the parameter.
public abstract void * @exception SQLException If an error occurs.
setLong(int index, long value) throws SQLException; */
public void setDouble(int parameterIndex, double x) throws SQLException;
/*************************************************************************/
/**
/** * This method sets the specified parameter from the given Java
* This method sets the specified parameter from the given Java * <code>java.math.BigDecimal</code> value.
* <code>float</code> value. *
* * @param index The index of the parameter value to set.
* @param index The index of the parameter value to set. * @param value The value of the parameter.
* @param value The value of the parameter. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public void setBigDecimal(int parameterIndex, BigDecimal x) throws
*/ SQLException;
public abstract void
setFloat(int index, float value) throws SQLException; /**
* This method sets the specified parameter from the given Java
/*************************************************************************/ * <code>String</code> value.
*
/** * @param index The index of the parameter value to set.
* This method sets the specified parameter from the given Java * @param value The value of the parameter.
* <code>double</code> value. * @exception SQLException If an error occurs.
* */
* @param index The index of the parameter value to set. public void setString(int parameterIndex, String x) throws SQLException;
* @param value The value of the parameter.
* /**
* @exception SQLException If an error occurs. * This method sets the specified parameter from the given Java
*/ * <code>byte</code> array value.
public abstract void *
setDouble(int index, double value) throws SQLException; * @param index The index of the parameter value to set.
* @param value The value of the parameter.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public void setBytes(int parameterIndex, byte[] x) throws SQLException;
* This method sets the specified parameter from the given Java
* <code>String</code> value. /**
* * This method sets the specified parameter from the given Java
* @param index The index of the parameter value to set. * <code>java.sql.Date</code> value.
* @param value The value of the parameter. *
* * @param index The index of the parameter value to set.
* @exception SQLException If an error occurs. * @param value The value of the parameter.
*/ * @exception SQLException If an error occurs.
public abstract void */
setString(int index, String value) throws SQLException; public void setDate(int parameterIndex, Date x) throws SQLException;
/*************************************************************************/ /**
* This method sets the specified parameter from the given Java
/** * <code>java.sql.Time</code> value.
* This method sets the specified parameter from the given Java *
* <code>byte</code> array value. * @param index The index of the parameter value to set.
* * @param value The value of the parameter.
* @param index The index of the parameter value to set. * @exception SQLException If an error occurs.
* @param value The value of the parameter. */
* public void setTime(int parameterIndex, Time x) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract void * This method sets the specified parameter from the given Java
setBytes(int index, byte[] value) throws SQLException; * <code>java.sql.Timestamp</code> value.
*
/*************************************************************************/ * @param index The index of the parameter value to set.
* @param value The value of the parameter.
/** * @exception SQLException If an error occurs.
* This method sets the specified parameter from the given Java */
* <code>java.math.BigDecimal</code> value. public void setTimestamp(int parameterIndex, Timestamp x)
* throws SQLException;
* @param index The index of the parameter value to set.
* @param value The value of the parameter. /**
* * This method sets the specified parameter from the given Java
* @exception SQLException If an error occurs. * ASCII <code>InputStream</code> value.
*/ *
public abstract void * @param index The index of the parameter value to set.
setBigDecimal(int index, java.math.BigDecimal value) throws SQLException; * @param value The value of the parameter.
* @param length The number of bytes in the stream.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public void setAsciiStream(int parameterIndex, InputStream x, int length)
* This method sets the specified parameter from the given Java throws SQLException;
* <code>java.sql.Date</code> value.
* /**
* @param index The index of the parameter value to set. * This method sets the specified parameter from the given Java
* @param value The value of the parameter. * Unicode UTF-8 <code>InputStream</code> value.
* *
* @exception SQLException If an error occurs. * @param index The index of the parameter value to set.
*/ * @param value The value of the parameter.
public abstract void * @param length The number of bytes in the stream.
setDate(int index, java.sql.Date value) throws SQLException; * @exception SQLException If an error occurs.
* @deprecated
/*************************************************************************/ */
public void setUnicodeStream(int parameterIndex, InputStream x, int length)
/** throws SQLException;
* This method sets the specified parameter from the given Java
* <code>java.sql.Date</code> value. /**
* * This method sets the specified parameter from the given Java
* @param index The index of the parameter value to set. * binary <code>InputStream</code> value.
* @param value The value of the parameter. *
* @param calendar The <code>Calendar</code> to use for timezone and locale. * @param index The index of the parameter value to set.
* * @param value The value of the parameter.
* @exception SQLException If an error occurs. * @param length The number of bytes in the stream.
*/ * @exception SQLException If an error occurs.
public abstract void */
setDate(int index, java.sql.Date value, Calendar calendar) throws SQLException; public void setBinaryStream(int parameterIndex, InputStream x, int length)
throws SQLException;
/*************************************************************************/
/**
/** * This method clears all of the input parameter that have been
* This method sets the specified parameter from the given Java * set on this statement.
* <code>java.sql.Time</code> value. *
* * @exception SQLException If an error occurs.
* @param index The index of the parameter value to set. */
* @param value The value of the parameter. public void clearParameters() throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method sets the specified parameter from the given Java
public abstract void * <code>Object</code> value. The specified SQL object type will be used.
setTime(int index, java.sql.Time value) throws SQLException; *
* @param index The index of the parameter value to set.
/*************************************************************************/ * @param value The value of the parameter.
* @param type The SQL type to use for the parameter, from <code>Types</code>
/** * @param scale The scale of the value, for numeric values only.
* This method sets the specified parameter from the given Java * @exception SQLException If an error occurs.
* <code>java.sql.Time</code> value. * @see Types
* */
* @param index The index of the parameter value to set. public void setObject(int parameterIndex, Object x, int targetSqlType,
* @param value The value of the parameter. int scale) throws SQLException;
* @param calendar The <code>Calendar</code> to use for timezone and locale.
* /**
* @exception SQLException If an error occurs. * This method sets the specified parameter from the given Java
*/ * <code>Object</code> value. The specified SQL object type will be used.
public abstract void *
setTime(int index, java.sql.Time value, Calendar calendar) throws SQLException; * @param index The index of the parameter value to set.
* @param value The value of the parameter.
/*************************************************************************/ * @param type The SQL type to use for the parameter, from <code>Types</code>
* @exception SQLException If an error occurs.
/** * @see Types
* This method sets the specified parameter from the given Java */
* <code>java.sql.Timestamp</code> value. public void setObject(int parameterIndex, Object x, int targetSqlType)
* throws SQLException;
* @param index The index of the parameter value to set.
* @param value The value of the parameter. /**
* * This method sets the specified parameter from the given Java
* @exception SQLException If an error occurs. * <code>Object</code> value. The default object type to SQL type mapping
*/ * will be used.
public abstract void *
setTimestamp(int index, java.sql.Timestamp value) throws SQLException; * @param index The index of the parameter value to set.
* @param value The value of the parameter.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public void setObject(int parameterIndex, Object x) throws SQLException;
* This method sets the specified parameter from the given Java
* <code>java.sql.Timestamp</code> value. /**
* * This method executes a prepared SQL query.
* @param index The index of the parameter value to set. * Some prepared statements return multiple results; the execute method
* @param value The value of the parameter. * handles these complex statements as well as the simpler form of
* @param calendar The <code>Calendar</code> to use for timezone and locale. * statements handled by executeQuery and executeUpdate.
* *
* @exception SQLException If an error occurs. * @return The result of the SQL statement.
*/ * @exception SQLException If an error occurs.
public abstract void */
setTimestamp(int index, java.sql.Timestamp value, Calendar calendar) public boolean execute() throws SQLException;
throws SQLException;
/**
/*************************************************************************/ * This method adds a set of parameters to the batch for JDBC 2.0.
* @exception SQLException If an error occurs.
/** */
* This method sets the specified parameter from the given Java public void addBatch() throws SQLException;
* ASCII <code>InputStream</code> value.
* /**
* @param index The index of the parameter value to set. * This method sets the specified parameter from the given Java
* @param value The value of the parameter. * character <code>Reader</code> value.
* @param length The number of bytes in the stream. *
* * @param index The index of the parameter value to set.
* @exception SQLException If an error occurs. * @param value The value of the parameter.
*/ * @param length The number of bytes in the stream.
public abstract void * @exception SQLException If an error occurs.
setAsciiStream(int index, InputStream value, int length) throws SQLException; */
public void setCharacterStream(int parameterIndex, Reader reader,
/*************************************************************************/ int length) throws SQLException;
/** /**
* This method sets the specified parameter from the given Java * This method sets the specified parameter from the given Java
* Unicode UTF-8 <code>InputStream</code> value. * <code>Ref</code> value. The default object type to SQL type mapping
* * will be used.
* @param index The index of the parameter value to set. *
* @param value The value of the parameter. * @param index The index of the parameter value to set.
* @param length The number of bytes in the stream. * @param value The value of the parameter.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
*/ public void setRef(int i, Ref x) throws SQLException;
public abstract void
setUnicodeStream(int index, InputStream value, int length) throws SQLException; /**
* This method sets the specified parameter from the given Java
/*************************************************************************/ * <code>Blob</code> value. The default object type to SQL type mapping
* will be used.
/** *
* This method sets the specified parameter from the given Java * @param index The index of the parameter value to set.
* binary <code>InputStream</code> value. * @param value The value of the parameter.
* * @exception SQLException If an error occurs.
* @param index The index of the parameter value to set. */
* @param value The value of the parameter. public void setBlob(int i, Blob x) throws SQLException;
* @param length The number of bytes in the stream.
* /**
* @exception SQLException If an error occurs. * This method sets the specified parameter from the given Java
*/ * <code>Clob</code> value. The default object type to SQL type mapping
public abstract void * will be used.
setBinaryStream(int index, InputStream value, int length) throws SQLException; *
* @param index The index of the parameter value to set.
/*************************************************************************/ * @param value The value of the parameter.
* @exception SQLException If an error occurs.
/** */
* This method sets the specified parameter from the given Java public void setClob(int i, Clob x) throws SQLException;
* character <code>Reader</code> value.
* /**
* @param index The index of the parameter value to set. * This method sets the specified parameter from the given Java
* @param value The value of the parameter. * <code>Array</code> value. The default object type to SQL type mapping
* @param length The number of bytes in the stream. * will be used.
* *
* @exception SQLException If an error occurs. * @param index The index of the parameter value to set.
*/ * @param value The value of the parameter.
public abstract void * @exception SQLException If an error occurs.
setCharacterStream(int index, Reader value, int length) throws SQLException; */
public void setArray(int i, Array x) throws SQLException;
/*************************************************************************/
/**
/** * This method returns meta data for the result set from this statement.
* This method sets the specified parameter from the given Java *
* <code>Ref</code> value. The default object type to SQL type mapping * @return Meta data for the result set from this statement.
* will be used. * @exception SQLException If an error occurs.
* */
* @param index The index of the parameter value to set. public ResultSetMetaData getMetaData() throws SQLException;
* @param value The value of the parameter.
* /**
* @exception SQLException If an error occurs. * This method sets the specified parameter from the given Java
*/ * <code>java.sql.Date</code> value.
public abstract void *
setRef(int index, Ref value) throws SQLException; * @param index The index of the parameter value to set.
* @param value The value of the parameter.
/*************************************************************************/ * @param calendar The <code>Calendar</code> to use for timezone and locale.
* @exception SQLException If an error occurs.
/** */
* This method sets the specified parameter from the given Java public void setDate(int parameterIndex, Date x, Calendar cal)
* <code>Blob</code> value. The default object type to SQL type mapping throws SQLException;
* will be used.
* /**
* @param index The index of the parameter value to set. * This method sets the specified parameter from the given Java
* @param value The value of the parameter. * <code>java.sql.Time</code> value.
* *
* @exception SQLException If an error occurs. * @param index The index of the parameter value to set.
*/ * @param value The value of the parameter.
public abstract void * @param calendar The <code>Calendar</code> to use for timezone and locale.
setBlob(int index, Blob value) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public void setTime(int parameterIndex, Time x, Calendar cal)
throws SQLException;
/**
* This method sets the specified parameter from the given Java /**
* <code>Clob</code> value. The default object type to SQL type mapping * This method sets the specified parameter from the given Java
* will be used. * <code>java.sql.Timestamp</code> value.
* *
* @param index The index of the parameter value to set. * @param index The index of the parameter value to set.
* @param value The value of the parameter. * @param value The value of the parameter.
* * @param calendar The <code>Calendar</code> to use for timezone and locale.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract void public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
setClob(int index, Clob value) throws SQLException; throws SQLException;
/*************************************************************************/ /**
* This method populates the specified parameter with a SQL NULL value
/** * for the specified type.
* This method sets the specified parameter from the given Java *
* <code>Array</code> value. The default object type to SQL type mapping * @param index The index of the parameter to set.
* will be used. * @param type The SQL type identifier of the parameter from <code>Types</code>
* * @param name The name of the data type, for user defined types.
* @param index The index of the parameter value to set. * @exception SQLException If an error occurs.
* @param value The value of the parameter. */
* public void setNull(int paramIndex, int sqlType, String typeName)
* @exception SQLException If an error occurs. throws SQLException;
*/
public abstract void /**
setArray(int index, Array value) throws SQLException; * @since 1.4
*/
/*************************************************************************/ public void setURL(int parameterIndex, URL x) throws SQLException;
/** /**
* This method sets the specified parameter from the given Java * @since 1.4
* <code>Object</code> value. The default object type to SQL type mapping */
* will be used. public ParameterMetaData getParameterMetaData() throws SQLException;
* }
* @param index The index of the parameter value to set.
* @param value The value of the parameter.
*
* @exception SQLException If an error occurs.
*/
public abstract void
setObject(int index, Object value) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>Object</code> value. The specified SQL object type will be used.
*
* @param index The index of the parameter value to set.
* @param value The value of the parameter.
* @param type The SQL type to use for the parameter, from <code>Types</code>
*
* @exception SQLException If an error occurs.
*
* @see Types
*/
public abstract void
setObject(int index, Object value, int type) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>Object</code> value. The specified SQL object type will be used.
*
* @param index The index of the parameter value to set.
* @param value The value of the parameter.
* @param type The SQL type to use for the parameter, from <code>Types</code>
* @param scale The scale of the value, for numeric values only.
*
* @exception SQLException If an error occurs.
*
* @see Types
*/
public abstract void
setObject(int index, Object value, int type, int scale) throws SQLException;
/*************************************************************************/
/**
* This method adds a set of parameters to the batch for JDBC 2.0.
*
* @exception SQLException If an error occurs.
*/
public abstract void
addBatch() throws SQLException;
/*************************************************************************/
/**
* This method clears all of the input parameter that have been
* set on this statement.
*
* @exception SQLException If an error occurs.
*/
public abstract void
clearParameters() throws SQLException;
/*************************************************************************/
/**
* This method returns meta data for the result set from this statement.
*
* @return Meta data for the result set from this statement.
*
* @exception SQLException If an error occurs.
*/
public abstract ResultSetMetaData
getMetaData() throws SQLException;
/*************************************************************************/
/**
* This method executes a prepared SQL query.
* Some prepared statements return multiple results; the execute method
* handles these complex statements as well as the simpler form of
* statements handled by executeQuery and executeUpdate.
*
* @return The result of the SQL statement.
*
* @exception SQLException If an error occurs.
*/
public abstract boolean
execute() throws SQLException;
/*************************************************************************/
/**
* This method executes a prepared SQL query and returns its ResultSet.
*
* @return The ResultSet of the SQL statement.
*
* @exception SQLException If an error occurs.
*/
public abstract ResultSet
executeQuery() throws SQLException;
/*************************************************************************/
/**
* This method executes an SQL INSERT, UPDATE or DELETE statement. SQL
* statements that return nothing such as SQL DDL statements can be executed.
*
* @return The result is either the row count for INSERT, UPDATE or DELETE
* statements; or 0 for SQL statements that return nothing.
*
* @exception SQLException If an error occurs.
*/
public abstract int
executeUpdate() throws SQLException;
} // interface PreparedStatement
...@@ -35,28 +35,41 @@ this exception to your version of the library, but you are not ...@@ -35,28 +35,41 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.sql; package java.sql;
import java.util.Map;
/** /**
* This interface provides a mechanism for obtaining information about * This interface provides a mechanism for obtaining information about
* a SQL structured type * a SQL structured type
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ * @since 1.2
public interface Ref */
public interface Ref
{ {
/**
* This method returns the fully qualified name of the SQL structured
* type of the referenced item.
*
* @return The fully qualified name of the SQL structured type.
* @exception SQLException If an error occurs.
* @since 1.2
*/
public String getBaseTypeName() throws SQLException;
/** /**
* This method returns the fully qualified name of the SQL structured * @since 1.4
* type of the referenced item. */
* public Object getObject(Map map) throws SQLException;
* @return The fully qualified name of the SQL structured type.
* /**
* @exception SQLException If an error occurs. * @since 1.4
*/ */
public abstract String public Object getObject() throws SQLException;
getBaseTypeName() throws SQLException;
} // interface Ref
/**
* @since 1.4
*/
public void setObject(Object value) throws SQLException;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
/* ResultSetMetaData.java -- Returns information about the ResultSet /* ResultSetMetaData.java -- Returns information about the ResultSet
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -39,351 +39,243 @@ exception statement from your version. */ ...@@ -39,351 +39,243 @@ exception statement from your version. */
package java.sql; package java.sql;
/** /**
* This interface provides a mechanism for obtaining information about * This interface provides a mechanism for obtaining information about
* the columns that are present in a <code>ResultSet</code>. * the columns that are present in a <code>ResultSet</code>.
* <p> * <p>
* Note that in this class column indexes start at 1, not 0. * Note that in this class column indexes start at 1, not 0.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface ResultSetMetaData public interface ResultSetMetaData
{ {
/**
/** * The column does not allow NULL's.
* The column does not allow NULL's. */
*/ public static final int columnNoNulls = 0;
public static final int columnNoNulls = 0;
/**
/** * The column allows NULL's.
* The column allows NULL's. */
*/ public static final int columnNullable = 1;
public static final int columnNullable = 1;
/**
/** * It is unknown whether or not the column allows NULL's.
* It is unknown whether or not the column allows NULL's. */
*/ public static final int columnNullableUnknown = 2;
public static final int columnNullableUnknown = 2;
/**
/*************************************************************************/ * This method returns the number of columns in the result set.
*
/** * @return The number of columns in the result set.
* This method returns the number of columns in the result set. * @exception SQLException If an error occurs.
* */
* @return The number of columns in the result set. public int getColumnCount() throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method test whether or not the column is an auto-increment column.
public abstract int * Auto-increment columns are read-only.
getColumnCount() throws SQLException; *
* @param index The index of the column to test.
/*************************************************************************/ * @return <code>true</code> if the column is auto-increment, <code>false</code>
* otherwise.
/** * @exception SQLException If an error occurs.
* This method test whether or not the column is an auto-increment column. */
* Auto-increment columns are read-only. public boolean isAutoIncrement(int column) throws SQLException;
*
* @param index The index of the column to test. /**
* * This method tests whether or not a column is case sensitive in its values.
* @return <code>true</code> if the column is auto-increment, <code>false</code> *
* otherwise. * @param index The index of the column to test.
* * @return <code>true</code> if the column value is case sensitive,
* @exception SQLException If an error occurs. * <code>false</code> otherwise.
*/ * @exception SQLException If an error occurs.
public abstract boolean */
isAutoIncrement(int index) throws SQLException; public boolean isCaseSensitive(int column) throws SQLException;
/*************************************************************************/ /**
* This method tests whether not the specified column can be used in
/** * a WHERE clause.
* This method tests whether or not a column is case sensitive in its values. *
* * @param index The index of the column to test.
* @param index The index of the column to test. * @return <code>true</code> if the column may be used in a WHERE clause,
* * <code>false</code> otherwise.
* @return <code>true</code> if the column value is case sensitive, * @exception SQLException If an error occurs.
* <code>false</code> otherwise. */
* public boolean isSearchable(int column) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract boolean * This method tests whether or not the column stores a monetary value.
isCaseSensitive(int index) throws SQLException; *
* @param index The index of the column to test.
/*************************************************************************/ * @return <code>true</code> if the column contains a monetary value,
* <code>false</code> otherwise.
/** * @exception SQLException If an error occurs.
* This method tests whether not the specified column can be used in */
* a WHERE clause. public boolean isCurrency(int column) throws SQLException;
*
* @param index The index of the column to test. /**
* * This method returns a value indicating whether or not the specified
* @return <code>true</code> if the column may be used in a WHERE clause, * column may contain a NULL value.
* <code>false</code> otherwise. *
* * @param index The index of the column to test.
* @exception SQLException If an error occurs. * @return A constant indicating whether or not the column can contain NULL,
*/ * which will be one of <code>columnNoNulls</code>,
public abstract boolean * <code>columnNullable</code>, or <code>columnNullableUnknown</code>.
isSearchable(int index) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public int isNullable(int column) throws SQLException;
/** /**
* This method tests whether or not the column stores a monetary value. * This method tests whether or not the value of the specified column
* * is signed or unsigned.
* @param index The index of the column to test. *
* * @param index The index of the column to test.
* @return <code>true</code> if the column contains a monetary value, * @return <code>true</code> if the column value is signed, <code>false</code>
* <code>false</code> otherwise. * otherwise.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
*/ public boolean isSigned(int column) throws SQLException;
public abstract boolean
isCurrency(int index) throws SQLException; /**
* This method returns the maximum number of characters that can be used
/*************************************************************************/ * to display a value in this column.
*
/** * @param index The index of the column to check.
* This method returns a value indicating whether or not the specified * @return The maximum number of characters that can be used to display a
* column may contain a NULL value. * value for this column.
* * @exception SQLException If an error occurs.
* @param index The index of the column to test. */
* public int getColumnDisplaySize(int column) throws SQLException;
* @return A constant indicating whether or not the column can contain NULL,
* which will be one of <code>columnNoNulls</code>, /**
* <code>columnNullable</code>, or <code>columnNullableUnknown</code>. * This method returns a string that should be used as a caption for this
* * column for user display purposes.
* @exception SQLException If an error occurs. *
*/ * @param index The index of the column to check.
public abstract int * @return A display string for the column.
isNullable(int index) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public String getColumnLabel(int column) throws SQLException;
/** /**
* This method tests whether or not the value of the specified column * This method returns the name of the specified column.
* is signed or unsigned. *
* * @param index The index of the column to return the name of.
* @param index The index of the column to test. * @return The name of the column.
* * @exception SQLException If an error occurs.
* @return <code>true</code> if the column value is signed, <code>false</code> */
* otherwise. public String getColumnName(int column) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method returns the name of the schema that contains the specified
public abstract boolean * column.
isSigned(int index) throws SQLException; *
* @param index The index of the column to check the schema name for.
/*************************************************************************/ * @return The name of the schema that contains the column.
* @exception SQLException If an error occurs.
/** */
* This method returns the maximum number of characters that can be used public String getSchemaName(int column) throws SQLException;
* to display a value in this column.
* /**
* @param index The index of the column to check. * This method returns the precision of the specified column, which is the
* * number of decimal digits it contains.
* @return The maximum number of characters that can be used to display a *
* value for this column. * @param index The index of the column to check the precision on.
* * @return The precision of the specified column.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract int public int getPrecision(int column) throws SQLException;
getColumnDisplaySize(int index) throws SQLException;
/**
/*************************************************************************/ * This method returns the scale of the specified column, which is the
* number of digits to the right of the decimal point.
/** *
* This method returns a string that should be used as a caption for this * @param index The index column to check the scale of.
* column for user display purposes. * @return The scale of the column.
* * @exception SQLException If an error occurs.
* @param index The index of the column to check. */
* public int getScale(int column) throws SQLException;
* @return A display string for the column.
* /**
* @exception SQLException If an error occurs. * This method returns the name of the table containing the specified
*/ * column.
public abstract String *
getColumnLabel(int index) throws SQLException; * @param index The index of the column to check the table name for.
* @return The name of the table containing the column.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public String getTableName(int column) throws SQLException;
* This method returns the name of the specified column.
* /**
* @param index The index of the column to return the name of. * This method returns the name of the catalog containing the specified
* * column.
* @return The name of the column. *
* * @param index The index of the column to check the catalog name for.
* @exception SQLException If an error occurs. * @return The name of the catalog containing the column.
*/ * @exception SQLException If an error occurs.
public abstract String */
getColumnName(int index) throws SQLException; public String getCatalogName(int column) throws SQLException;
/*************************************************************************/ /**
* This method returns the SQL type of the specified column. This will
/** * be one of the constants from <code>Types</code>.
* This method returns the name of the schema that contains the specified *
* column. * @param index The index of the column to check the SQL type of.
* * @return The SQL type for this column.
* @param index The index of the column to check the schema name for. * @exception SQLException If an error occurs.
* * @see Types
* @return The name of the schema that contains the column. */
* public int getColumnType(int column) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract String * This method returns the name of the SQL type for this column.
getSchemaName(int index) throws SQLException; *
* @param index The index of the column to check the SQL type name for.
/*************************************************************************/ * @return The name of the SQL type for this column.
* @exception SQLException If an error occurs.
/** */
* This method returns the precision of the specified column, which is the public String getColumnTypeName(int column) throws SQLException;
* number of decimal digits it contains.
* /**
* @param index The index of the column to check the precision on. * This method tests whether or not the specified column is read only.
* *
* @return The precision of the specified column. * @param index The index of the column to check.
* * @return <code>true</code> if the column is read only, <code>false</code>
* @exception SQLException If an error occurs. * otherwise.
*/ * @exception SQLException If an error occurs.
public abstract int */
getPrecision(int index) throws SQLException; public boolean isReadOnly(int column) throws SQLException;
/*************************************************************************/ /**
* This method tests whether or not the column may be writable. This
/** * does not guarantee that a write will be successful.
* This method returns the scale of the specified column, which is the *
* number of digits to the right of the decimal point. * @param index The index of the column to check for writability.
* * @return <code>true</code> if the column may be writable,
* @param index The index column to check the scale of. * <code>false</code> otherwise.
* * @exception SQLException If an error occurs.
* @return The scale of the column. */
* public boolean isWritable(int column) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract int * This method tests whether or not the column is writable. This
getScale(int index) throws SQLException; * does guarantee that a write will be successful.
*
/*************************************************************************/ * @param index The index of the column to check for writability.
* @return <code>true</code> if the column is writable,
/** * <code>false</code> otherwise.
* This method returns the name of the table containing the specified * @exception SQLException If an error occurs.
* column. */
* public boolean isDefinitelyWritable(int column) throws SQLException;
* @param index The index of the column to check the table name for.
* /**
* @return The name of the table containing the column. * This method returns the name of the Java class which will be used to
* * create objects representing the data in this column.
* @exception SQLException If an error occurs. *
*/ * @param index The index of the column to check.
public abstract String * @return The name of the Java class that will be used for values in
getTableName(int index) throws SQLException; * this column.
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public String getColumnClassName(int column) throws SQLException;
/** }
* This method returns the name of the catalog containing the specified
* column.
*
* @param index The index of the column to check the catalog name for.
*
* @return The name of the catalog containing the column.
*
* @exception SQLException If an error occurs.
*/
public abstract String
getCatalogName(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the SQL type of the specified column. This will
* be one of the constants from <code>Types</code>.
*
* @param index The index of the column to check the SQL type of.
*
* @return The SQL type for this column.
*
* @exception SQLException If an error occurs.
*
* @see Types
*/
public abstract int
getColumnType(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the name of the SQL type for this column.
*
* @param index The index of the column to check the SQL type name for.
*
* @return The name of the SQL type for this column.
*
* @exception SQLException If an error occurs.
*/
public abstract String
getColumnTypeName(int index) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified column is read only.
*
* @param index The index of the column to check.
*
* @return <code>true</code> if the column is read only, <code>false</code>
* otherwise.
*
* @exception SQLException If an error occurs.
*/
public abstract boolean
isReadOnly(int index) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the column may be writable. This
* does not guarantee that a write will be successful.
*
* @param index The index of the column to check for writability.
*
* @return <code>true</code> if the column may be writable,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*/
public abstract boolean
isWritable(int index) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the column is writable. This
* does guarantee that a write will be successful.
*
* @param index The index of the column to check for writability.
*
* @return <code>true</code> if the column is writable,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*/
public abstract boolean
isDefinitelyWritable(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the name of the Java class which will be used to
* create objects representing the data in this column.
*
* @param index The index of the column to check.
*
* @return The name of the Java class that will be used for values in
* this column.
*
* @exception SQLException If an error occurs.
*/
public abstract String
getColumnClassName(int index) throws SQLException;
} // interface ResultSetMetaData
...@@ -39,47 +39,34 @@ exception statement from your version. */ ...@@ -39,47 +39,34 @@ exception statement from your version. */
package java.sql; package java.sql;
/** /**
* This interface is used for mapping SQL data to user defined datatypes. * This interface is used for mapping SQL data to user defined datatypes.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface SQLData public interface SQLData
{ {
/**
* This method returns the user defined datatype name for this object.
*
* @return The user defined data type name for this object.
* @exception SQLException If an error occurs.
*/
public String getSQLTypeName() throws SQLException;
/** /**
* This method returns the user defined datatype name for this object. * This method populates the data in the object from the specified stream.
* *
* @return The user defined data type name for this object. * @param stream The stream to read the data from.
* * @param name The data type name of the data on the stream.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract String public void readSQL(SQLInput stream, String typeName) throws SQLException;
getSQLTypeName() throws SQLException;
/*************************************************************************/
/**
* This method populates the data in the object from the specified stream.
*
* @param stream The stream to read the data from.
* @param name The data type name of the data on the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
readSQL(SQLInput stream, String name) throws SQLException;
/*************************************************************************/
/**
* This method writes the data in this object to the specified stream.
*
* @param stream The stream to write the data to.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeSQL(SQLOutput stream) throws SQLException;
} // interface SQLData
/**
* This method writes the data in this object to the specified stream.
*
* @param stream The stream to write the data to.
* @exception SQLException If an error occurs.
*/
public void writeSQL(SQLOutput stream) throws SQLException;
}
...@@ -39,183 +39,129 @@ exception statement from your version. */ ...@@ -39,183 +39,129 @@ exception statement from your version. */
package java.sql; package java.sql;
/** /**
* This exception is thrown when a database error occurs. * This exception is thrown when a database error occurs.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class SQLException extends Exception
{
/*************************************************************************/
/*
* Instance Variables
*/ */
public class SQLException extends Exception
/**
* This is the next exception in the chain
* @serialized
*/
private SQLException next;
/**
* This is the state of the SQL statement at the time of the error.
* @serialized
*/
private String SQLState;
/**
* The vendor error code for this error
* @serialized
*/
private int vendorCode;
/*************************************************************************/
/**
* Static Variables
*/
/**
* This is the serialization UID for this class
*/
private static final long serialVersionUID = 2135244094396331484L;
/*************************************************************************/
/*
* Constructors
*/
/**
* This method initializes a new instance of <code>SQLException</code>
* that does not have a descriptive messages and SQL state, and which
* has a vendor error code of 0.
*/
public
SQLException()
{
this(null, null, 0);
}
/*************************************************************************/
/**
* This method initializes a new instance of <code>SQLException</code>
* with the specified descriptive error message. The SQL state of this
* instance will be <code>null</code> and the vendor error code will be 0.
*
* @param message A string describing the nature of the error.
*/
public
SQLException(String message)
{ {
this(message, null, 0); static final long serialVersionUID = 2135244094396331484L;
/**
* This is the next exception in the chain
*/
private SQLException next;
/**
* This is the state of the SQL statement at the time of the error.
*/
private String SQLState;
/**
* The vendor error code for this error
*/
private int vendorCode;
/**
* This method initializes a nwe instance of <code>SQLException</code>
* with the specified descriptive error message, SQL state string, and
* vendor code.
*
* @param message A string describing the nature of the error.
* @param SQLState A string containing the SQL state of the error.
* @param vendorCode The vendor error code associated with this error.
*/
public SQLException(String message, String SQLState, int vendorCode)
{
super(message);
this.SQLState = SQLState;
this.vendorCode = vendorCode;
}
/**
* This method initializes a new instance of <code>SQLException</code>
* with the specified descriptive error message and SQL state string.
* The vendor error code of this instance will be 0.
*
* @param message A string describing the nature of the error.
* @param SQLState A string containing the SQL state of the error.
*/
public SQLException(String message, String SQLState)
{
this(message, SQLState, 0);
}
/**
* This method initializes a new instance of <code>SQLException</code>
* with the specified descriptive error message. The SQL state of this
* instance will be <code>null</code> and the vendor error code will be 0.
*
* @param message A string describing the nature of the error.
*/
public SQLException(String message)
{
this(message, null, 0);
}
/**
* This method initializes a new instance of <code>SQLException</code>
* that does not have a descriptive messages and SQL state, and which
* has a vendor error code of 0.
*/
public SQLException()
{
this(null, null, 0);
}
/**
* This method returns the SQLState information associated with this
* error. The value returned is a <code>String</code> which is formatted
* using the XOPEN SQL state conventions.
*
* @return The SQL state, which may be <code>null</code>.
*/
public String getSQLState()
{
return SQLState;
}
/**
* This method returns the vendor specific error code associated with
* this error.
*
* @return The vendor specific error code associated with this error.
*/
public int getErrorCode()
{
return vendorCode;
}
/**
* This method returns the exception that is chained to this object.
*
* @return The exception chained to this object, which may be
* <code>null</code>.
*/
public SQLException getNextException()
{
return next;
}
/**
* This method adds a new exception to the end of the chain of exceptions
* that are chained to this object.
*
* @param e The exception to add to the end of the chain.
*/
public void setNextException(SQLException e)
{
if (e == null)
return;
SQLException list_entry = this;
while (list_entry.getNextException() != null)
list_entry = list_entry.getNextException();
list_entry.next = e;
}
} }
/*************************************************************************/
/**
* This method initializes a new instance of <code>SQLException</code>
* with the specified descriptive error message and SQL state string.
* The vendor error code of this instance will be 0.
*
* @param message A string describing the nature of the error.
* @param SQLState A string containing the SQL state of the error.
*/
public
SQLException(String message, String SQLState)
{
this(message, SQLState, 0);
}
/*************************************************************************/
/**
* This method initializes a nwe instance of <code>SQLException</code>
* with the specified descriptive error message, SQL state string, and
* vendor code.
*
* @param message A string describing the nature of the error.
* @param SQLState A string containing the SQL state of the error.
* @param vendorCode The vendor error code associated with this error.
*/
public
SQLException(String message, String SQLState, int vendorCode)
{
super(message);
this.SQLState = SQLState;
this.vendorCode = vendorCode;
}
/*************************************************************************/
/*
* Instance Methods
*/
/**
* This method returns the SQLState information associated with this
* error. The value returned is a <code>String</code> which is formatted
* using the XOPEN SQL state conventions.
*
* @return The SQL state, which may be <code>null</code>.
*/
public String
getSQLState()
{
return(SQLState);
}
/*************************************************************************/
/**
* This method returns the vendor specific error code associated with
* this error.
*
* @return The vendor specific error code associated with this error.
*/
public int
getErrorCode()
{
return(vendorCode);
}
/*************************************************************************/
/**
* This method returns the exception that is chained to this object.
*
* @return The exception chained to this object, which may be
* <code>null</code>.
*/
public SQLException
getNextException()
{
return(next);
}
/*************************************************************************/
/**
* This method adds a new exception to the end of the chain of exceptions
* that are chained to this object.
*
* @param e The exception to add to the end of the chain.
*/
public void
setNextException(SQLException e)
{
if (e == null)
return;
SQLException list_entry = this;
while (list_entry.getNextException() != null)
list_entry = list_entry.getNextException();
list_entry.next = e;
}
} // class SQLException
/* SQLInput.java -- Read SQL values from a stream /* SQLInput.java -- Read SQL values from a stream
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,303 +41,219 @@ package java.sql; ...@@ -41,303 +41,219 @@ package java.sql;
import java.io.InputStream; import java.io.InputStream;
import java.io.Reader; import java.io.Reader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL;
/** /**
* This interface provides methods for reading values from a stream * This interface provides methods for reading values from a stream
* that is connected to a SQL structured or distinct type. It is used * that is connected to a SQL structured or distinct type. It is used
* for custom mapping of user defined data types. * for custom mapping of user defined data types.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface SQLInput public interface SQLInput
{ {
/**
/*************************************************************************/ * This method reads the next item from the stream a Java
* <code>String</code>.
/** *
* This method reads the next item from the stream a Java * @return The value read from the stream as a <code>String</code>.
* <code>String</code>. * @exception SQLException If an error occurs.
* */
* @return The value read from the stream as a <code>String</code>. public String readString() throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method reads the next item from the stream a Java
public abstract String * <code>boolean</code>.
readString() throws SQLException; *
* @return The value read from the stream as a <code>boolean</code>.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public boolean readBoolean() throws SQLException;
* This method reads the next item from the stream a Java
* <code>boolean</code>. /**
* * This method reads the next item from the stream a Java
* @return The value read from the stream as a <code>boolean</code>. * <code>byte</code>.
* *
* @exception SQLException If an error occurs. * @return The value read from the stream as a <code>byte</code>.
*/ * @exception SQLException If an error occurs.
public abstract boolean */
readBoolean() throws SQLException; public byte readByte() throws SQLException;
/*************************************************************************/ /**
* This method reads the next item from the stream a Java
/** * <code>short</code>.
* This method reads the next item from the stream a Java *
* <code>byte</code>. * @return The value read from the stream as a <code>short</code>.
* * @exception SQLException If an error occurs.
* @return The value read from the stream as a <code>byte</code>. */
* public short readShort() throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract byte * This method reads the next item from the stream a Java
readByte() throws SQLException; * <code>int</code>.
*
/*************************************************************************/ * @return The value read from the stream as an <code>int</code>.
* @exception SQLException If an error occurs.
/** */
* This method reads the next item from the stream a Java public int readInt() throws SQLException;
* <code>short</code>.
* /**
* @return The value read from the stream as a <code>short</code>. * This method reads the next item from the stream a Java
* * <code>long</code>.
* @exception SQLException If an error occurs. *
*/ * @return The value read from the stream as a <code>long</code>.
public abstract short * @exception SQLException If an error occurs.
readShort() throws SQLException; */
public long readLong() throws SQLException;
/*************************************************************************/
/**
/** * This method reads the next item from the stream a Java
* This method reads the next item from the stream a Java * <code>float</code>.
* <code>int</code>. *
* * @return The value read from the stream as a <code>float</code>.
* @return The value read from the stream as an <code>int</code>. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public float readFloat() throws SQLException;
*/
public abstract int /**
readInt() throws SQLException; * This method reads the next item from the stream a Java
* <code>double</code>.
/*************************************************************************/ *
* @return The value read from the stream as a <code>double</code>.
/** * @exception SQLException If an error occurs.
* This method reads the next item from the stream a Java */
* <code>long</code>. public double readDouble() throws SQLException;
*
* @return The value read from the stream as a <code>long</code>. /**
* * This method reads the next item from the stream a Java
* @exception SQLException If an error occurs. * <code>BigDecimal</code>.
*/ *
public abstract long * @return The value read from the stream as a <code>BigDecimal</code>.
readLong() throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public BigDecimal readBigDecimal() throws SQLException;
/** /**
* This method reads the next item from the stream a Java * This method reads the next item from the stream a Java
* <code>float</code>. * byte array
* *
* @return The value read from the stream as a <code>float</code>. * @return The value read from the stream as a byte array.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
*/ public byte[] readBytes() throws SQLException;
public abstract float
readFloat() throws SQLException; /**
* This method reads the next item from the stream a Java
/*************************************************************************/ * <code>java.sql.Date</code>.
*
/** * @return The value read from the stream as a <code>java.sql.Date</code>.
* This method reads the next item from the stream a Java * @exception SQLException If an error occurs.
* <code>double</code>. */
* public Date readDate() throws SQLException;
* @return The value read from the stream as a <code>double</code>.
* /**
* @exception SQLException If an error occurs. * This method reads the next item from the stream a Java
*/ * <code>java.sql.Time</code>.
public abstract double *
readDouble() throws SQLException; * @return The value read from the stream as a <code>java.sql.Time</code>.
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public Time readTime() throws SQLException;
/**
* This method reads the next item from the stream a Java /**
* <code>BigDecimal</code>. * This method reads the next item from the stream a Java
* * <code>java.sql.Timestamp</code>.
* @return The value read from the stream as a <code>BigDecimal</code>. *
* * @return The value read from the stream as a <code>java.sql.Timestamp</code>.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract BigDecimal public Timestamp readTimestamp() throws SQLException;
readBigDecimal() throws SQLException;
/**
/*************************************************************************/ * This method reads the next item from the stream a character
* <code>Reader</code>.
/** *
* This method reads the next item from the stream a Java * @return The value read from the stream as a <code>Reader</code>.
* byte array * @exception SQLException If an error occurs.
* */
* @return The value read from the stream as a byte array. public Reader readCharacterStream() throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method reads the next item from the stream a ASCII text
public abstract byte[] * <code>InputStream</code>.
readBytes() throws SQLException; *
* @return The value read from the stream as an <code>InputStream</code>.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public InputStream readAsciiStream() throws SQLException;
* This method reads the next item from the stream a Java
* <code>java.sql.Date</code>. /**
* * This method reads the next item from the stream a binary
* @return The value read from the stream as a <code>java.sql.Date</code>. * <code>InputStream</code>.
* *
* @exception SQLException If an error occurs. * @return The value read from the stream as an <code>InputStream</code>.
*/ * @exception SQLException If an error occurs.
public abstract java.sql.Date */
readDate() throws SQLException; public InputStream readBinaryStream() throws SQLException;
/*************************************************************************/ /**
* This method reads the next item from the stream a Java
/** * <code>Object</code>.
* This method reads the next item from the stream a Java *
* <code>java.sql.Time</code>. * @return The value read from the stream as an <code>Object</code>.
* * @exception SQLException If an error occurs.
* @return The value read from the stream as a <code>java.sql.Time</code>. */
* public Object readObject() throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract java.sql.Time * This method reads the next item from the stream a Java SQL
readTime() throws SQLException; * <code>Ref</code>.
*
/*************************************************************************/ * @return The value read from the stream as an <code>Ref</code>.
* @exception SQLException If an error occurs.
/** */
* This method reads the next item from the stream a Java public Ref readRef() throws SQLException;
* <code>java.sql.Timestamp</code>.
* /**
* @return The value read from the stream as a <code>java.sql.Timestamp</code>. * This method reads the next item from the stream a Java SQL
* * <code>Blob</code>.
* @exception SQLException If an error occurs. *
*/ * @return The value read from the stream as a <code>Blob</code>.
public abstract java.sql.Timestamp * @exception SQLException If an error occurs.
readTimestamp() throws SQLException; */
public Blob readBlob() throws SQLException;
/*************************************************************************/
/**
/** * This method reads the next item from the stream a Java SQL
* This method reads the next item from the stream a ASCII text * <code>Clob</code>.
* <code>InputStream</code>. *
* * @return The value read from the stream as a <code>Clob</code>.
* @return The value read from the stream as an <code>InputStream</code>. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public Clob readClob() throws SQLException;
*/
public abstract InputStream /**
readAsciiStream() throws SQLException; * This method reads the next item from the stream a Java SQL
* <code>Array</code>.
/*************************************************************************/ *
* @return The value read from the stream as an <code>Array</code>.
/** * @exception SQLException If an error occurs.
* This method reads the next item from the stream a binary */
* <code>InputStream</code>. public Array readArray() throws SQLException;
*
* @return The value read from the stream as an <code>InputStream</code>. /**
* * This method tests whether or not the last value read was a SQL
* @exception SQLException If an error occurs. * NULL value.
*/ *
public abstract InputStream * @return <code>true</code> if the last value read was a NULL,
readBinaryStream() throws SQLException; * <code>false</code> otherwise.
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public boolean wasNull() throws SQLException;
/**
* This method reads the next item from the stream a character /**
* <code>Reader</code>. * @since 1.4
* */
* @return The value read from the stream as a <code>Reader</code>. public URL readURL() throws SQLException;
* }
* @exception SQLException If an error occurs.
*/
public abstract Reader
readCharacterStream() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>Object</code>.
*
* @return The value read from the stream as an <code>Object</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Object
readObject() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java SQL
* <code>Ref</code>.
*
* @return The value read from the stream as an <code>Ref</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Ref
readRef() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java SQL
* <code>Blob</code>.
*
* @return The value read from the stream as a <code>Blob</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Blob
readBlob() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java SQL
* <code>Clob</code>.
*
* @return The value read from the stream as a <code>Clob</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Clob
readClob() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java SQL
* <code>Array</code>.
*
* @return The value read from the stream as an <code>Array</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Array
readArray() throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the last value read was a SQL
* NULL value.
*
* @return <code>true</code> if the last value read was a NULL,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*/
public abstract boolean
wasNull() throws SQLException;
} // interface SQLInput
/* SQLOutput.java -- Write SQL values to a stream /* SQLOutput.java -- Write SQL values to a stream
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,302 +41,217 @@ package java.sql; ...@@ -41,302 +41,217 @@ package java.sql;
import java.io.InputStream; import java.io.InputStream;
import java.io.Reader; import java.io.Reader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL;
/** /**
* This interface provides methods for writing Java types to a SQL stream. * This interface provides methods for writing Java types to a SQL stream.
* It is used for implemented custom type mappings for user defined data * It is used for implemented custom type mappings for user defined data
* types. * types.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface SQLOutput public interface SQLOutput
{ {
/**
/*************************************************************************/ * This method writes the specified Java <code>String</code>
* to the SQL stream.
/** *
* This method writes the specified Java <code>String</code> * @param value The value to write to the stream.
* to the SQL stream. * @exception SQLException If an error occurs.
* */
* @param value The value to write to the stream. public void writeString(String x) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method writes the specified Java <code>boolean</code>
public abstract void * to the SQL stream.
writeString(String value) throws SQLException; *
* @param value The value to write to the stream.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public void writeBoolean(boolean x) throws SQLException;
* This method writes the specified Java <code>boolean</code>
* to the SQL stream. /**
* * This method writes the specified Java <code>byte</code>
* @param value The value to write to the stream. * to the SQL stream.
* *
* @exception SQLException If an error occurs. * @param value The value to write to the stream.
*/ * @exception SQLException If an error occurs.
public abstract void */
writeBoolean(boolean value) throws SQLException; public void writeByte(byte x) throws SQLException;
/*************************************************************************/ /**
* This method writes the specified Java <code>short</code>
/** * to the SQL stream.
* This method writes the specified Java <code>byte</code> *
* to the SQL stream. * @param value The value to write to the stream.
* * @exception SQLException If an error occurs.
* @param value The value to write to the stream. */
* public void writeShort(short x) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract void * This method writes the specified Java <code>int</code>
writeByte(byte value) throws SQLException; * to the SQL stream.
*
/*************************************************************************/ * @param value The value to write to the stream.
* @exception SQLException If an error occurs.
/** */
* This method writes the specified Java <code>short</code> public void writeInt(int x) throws SQLException;
* to the SQL stream.
* /**
* @param value The value to write to the stream. * This method writes the specified Java <code>long</code>
* * to the SQL stream.
* @exception SQLException If an error occurs. *
*/ * @param value The value to write to the stream.
public abstract void * @exception SQLException If an error occurs.
writeShort(short value) throws SQLException; */
public void writeLong(long x) throws SQLException;
/*************************************************************************/
/**
/** * This method writes the specified Java <code>float</code>
* This method writes the specified Java <code>int</code> * to the SQL stream.
* to the SQL stream. *
* * @param value The value to write to the stream.
* @param value The value to write to the stream. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public void writeFloat(float x) throws SQLException;
*/
public abstract void /**
writeInt(int value) throws SQLException; * This method writes the specified Java <code>double</code>
* to the SQL stream.
/*************************************************************************/ *
* @param value The value to write to the stream.
/** * @exception SQLException If an error occurs.
* This method writes the specified Java <code>long</code> */
* to the SQL stream. public void writeDouble(double x) throws SQLException;
*
* @param value The value to write to the stream. /**
* * This method writes the specified Java <code>BigDecimal</code>
* @exception SQLException If an error occurs. * to the SQL stream.
*/ *
public abstract void * @param value The value to write to the stream.
writeLong(long value) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public void writeBigDecimal(BigDecimal x) throws SQLException;
/** /**
* This method writes the specified Java <code>float</code> * This method writes the specified Java <code>byte</code> array
* to the SQL stream. * to the SQL stream.
* *
* @param value The value to write to the stream. * @param value The value to write to the stream.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
*/ public void writeBytes(byte[] x) throws SQLException;
public abstract void
writeFloat(float value) throws SQLException; /**
* This method writes the specified Java <code>java.sql.Date</code>
/*************************************************************************/ * to the SQL stream.
*
/** * @param value The value to write to the stream.
* This method writes the specified Java <code>double</code> * @exception SQLException If an error occurs.
* to the SQL stream. */
* public void writeDate(Date x) throws SQLException;
* @param value The value to write to the stream.
* /**
* @exception SQLException If an error occurs. * This method writes the specified Java <code>java.sql.Time</code>
*/ * to the SQL stream.
public abstract void *
writeDouble(double value) throws SQLException; * @param value The value to write to the stream.
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public void writeTime(Time x) throws SQLException;
/**
* This method writes the specified Java <code>BigDecimal</code> /**
* to the SQL stream. * This method writes the specified Java <code>java.sql.Timestamp</code>
* * to the SQL stream.
* @param value The value to write to the stream. *
* * @param value The value to write to the stream.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract void public void writeTimestamp(Timestamp x) throws SQLException;
writeBigDecimal(BigDecimal value) throws SQLException;
/**
/*************************************************************************/ * This method writes the specified Java character stream
* to the SQL stream.
/** *
* This method writes the specified Java <code>byte</code> array * @param value The value to write to the stream.
* to the SQL stream. * @exception SQLException If an error occurs.
* */
* @param value The value to write to the stream. public void writeCharacterStream(Reader x) throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method writes the specified ASCII text stream
public abstract void * to the SQL stream.
writeBytes(byte[] value) throws SQLException; *
* @param value The value to write to the stream.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public void writeAsciiStream(InputStream x) throws SQLException;
* This method writes the specified Java <code>java.sql.Date</code>
* to the SQL stream. /**
* * This method writes the specified uninterpreted binary byte stream
* @param value The value to write to the stream. * to the SQL stream.
* *
* @exception SQLException If an error occurs. * @param value The value to write to the stream.
*/ * @exception SQLException If an error occurs.
public abstract void */
writeDate(java.sql.Date value) throws SQLException; public void writeBinaryStream(InputStream x) throws SQLException;
/*************************************************************************/ /**
* This method writes the specified Java <code>SQLData</code> object
/** * to the SQL stream.
* This method writes the specified Java <code>java.sql.Time</code> *
* to the SQL stream. * @param value The value to write to the stream.
* * @exception SQLException If an error occurs.
* @param value The value to write to the stream. */
* public void writeObject(SQLData x) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract void * This method writes the specified Java SQL <code>Ref</code> object
writeTime(java.sql.Time value) throws SQLException; * to the SQL stream.
*
/*************************************************************************/ * @param value The value to write to the stream.
* @exception SQLException If an error occurs.
/** */
* This method writes the specified Java <code>java.sql.Timestamp</code> public void writeRef(Ref x) throws SQLException;
* to the SQL stream.
* /**
* @param value The value to write to the stream. * This method writes the specified Java SQL <code>Blob</code> object
* * to the SQL stream.
* @exception SQLException If an error occurs. *
*/ * @param value The value to write to the stream.
public abstract void * @exception SQLException If an error occurs.
writeTimestamp(java.sql.Timestamp value) throws SQLException; */
public void writeBlob(Blob x) throws SQLException;
/*************************************************************************/
/**
/** * This method writes the specified Java SQL <code>Clob</code> object
* This method writes the specified Java character stream * to the SQL stream.
* to the SQL stream. *
* * @param value The value to write to the stream.
* @param value The value to write to the stream. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public void writeClob(Clob x) throws SQLException;
*/
public abstract void /**
writeCharacterStream(Reader value) throws SQLException; * This method writes the specified Java SQL <code>Struct</code> object
* to the SQL stream.
/*************************************************************************/ *
* @param value The value to write to the stream.
/** * @exception SQLException If an error occurs.
* This method writes the specified uninterpreted binary byte stream */
* to the SQL stream. public void writeStruct(Struct x) throws SQLException;
*
* @param value The value to write to the stream. /**
* * This method writes the specified Java SQL <code>Array</code> object
* @exception SQLException If an error occurs. * to the SQL stream.
*/ *
public abstract void * @param value The value to write to the stream.
writeBinaryStream(InputStream value) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public void writeArray(Array x) throws SQLException;
/** /**
* This method writes the specified ASCII text stream * @since 1.4
* to the SQL stream. */
* public void writeURL(URL x) throws SQLException;
* @param value The value to write to the stream. }
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeAsciiStream(InputStream value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>SQLData</code> object
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeObject(SQLData value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java SQL <code>Ref</code> object
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeRef(Ref value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java SQL <code>Blob</code> object
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeBlob(Blob value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java SQL <code>Clob</code> object
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeClob(Clob value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java SQL <code>Struct</code> object
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeStruct(Struct value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java SQL <code>Array</code> object
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeArray(Array value) throws SQLException;
} // interface SQLOutput
/* SQLPermission.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.sql;
import java.security.BasicPermission;
/**
* @since 1.3
*/
public final class SQLPermission extends BasicPermission
{
public SQLPermission(String name)
{
super(name);
}
public SQLPermission(String name, String actions)
{
super(name, actions);
}
}
/* SQLWarning.java -- Database access warnings. /* SQLWarning.java -- Database access warnings.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -39,120 +39,82 @@ exception statement from your version. */ ...@@ -39,120 +39,82 @@ exception statement from your version. */
package java.sql; package java.sql;
/** /**
* This exception is thrown when a database warning occurs. * This exception is thrown when a database warning occurs.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class SQLWarning extends SQLException
{
/*************************************************************************/
/**
* Static Variables
*/
/**
* This is the serialization UID for this class
*/
private static final long serialVersionUID = 3917336774604784856L;
/*************************************************************************/
/*
* Constructors
*/ */
public class SQLWarning extends SQLException
/**
* This method initializes a new instance of <code>SQLWarning</code>
* that does not have a descriptive messages and SQL state, and which
* has a vendor error code of 0.
*/
public
SQLWarning()
{
this(null, null, 0);
}
/*************************************************************************/
/**
* This method initializes a new instance of <code>SQLWarning</code>
* with the specified descriptive error message. The SQL state of this
* instance will be <code>null</code> and the vendor error code will be 0.
*
* @param message A string describing the nature of the error.
*/
public
SQLWarning(String message)
{
this(message, null, 0);
}
/*************************************************************************/
/**
* This method initializes a new instance of <code>SQLWarning</code>
* with the specified descriptive error message and SQL state string.
* The vendor error code of this instance will be 0.
*
* @param message A string describing the nature of the error.
* @param SQLState A string containing the SQL state of the error.
*/
public
SQLWarning(String message, String SQLState)
{ {
this(message, SQLState, 0); static final long serialVersionUID = 3917336774604784856L;
/**
* This method initializes a nwe instance of <code>SQLWarning</code>
* with the specified descriptive error message, SQL state string, and
* vendor code.
*
* @param message A string describing the nature of the error.
* @param SQLState A string containing the SQL state of the error.
* @param vendorCode The vendor error code associated with this error.
*/
public SQLWarning(String reason, String SQLState, int vendorCode)
{
super(reason, SQLState, vendorCode);
}
/**
* This method initializes a new instance of <code>SQLWarning</code>
* with the specified descriptive error message and SQL state string.
* The vendor error code of this instance will be 0.
*
* @param message A string describing the nature of the error.
* @param SQLState A string containing the SQL state of the error.
*/
public SQLWarning(String message, String SQLState)
{
super(message, SQLState);
}
/**
* This method initializes a new instance of <code>SQLWarning</code>
* with the specified descriptive error message. The SQL state of this
* instance will be <code>null</code> and the vendor error code will be 0.
*
* @param message A string describing the nature of the error.
*/
public SQLWarning(String message)
{
super(message);
}
/**
* This method initializes a new instance of <code>SQLWarning</code>
* that does not have a descriptive messages and SQL state, and which
* has a vendor error code of 0.
*/
public SQLWarning()
{
super();
}
/**
* This method returns the exception that is chained to this object.
*
* @return The exception chained to this object, which may be
* <code>null</code>.
*/
public SQLWarning getNextWarning()
{
return (SQLWarning) super.getNextException();
}
/**
* This method adds a new exception to the end of the chain of exceptions
* that are chained to this object.
*
* @param w The exception to add to the end of the chain.
*/
public void setNextWarning(SQLWarning w)
{
super.setNextException(w);
}
} }
/*************************************************************************/
/**
* This method initializes a nwe instance of <code>SQLWarning</code>
* with the specified descriptive error message, SQL state string, and
* vendor code.
*
* @param message A string describing the nature of the error.
* @param SQLState A string containing the SQL state of the error.
* @param vendorCode The vendor error code associated with this error.
*/
public
SQLWarning(String message, String SQLState, int vendorCode)
{
super(message, SQLState, vendorCode);
}
/*************************************************************************/
/*
* Instance Methods
*/
/**
* This method returns the exception that is chained to this object.
*
* @return The exception chained to this object, which may be
* <code>null</code>.
*/
public SQLWarning
getNextWarning()
{
return((SQLWarning)super.getNextException());
}
/*************************************************************************/
/**
* This method adds a new exception to the end of the chain of exceptions
* that are chained to this object.
*
* @param e The exception to add to the end of the chain.
*/
public void
setNextWarning(SQLWarning e)
{
super.setNextException(e);
}
} // class SQLWarning
/* SavePoint.java -- Returns information about the ResultSet
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.sql;
/**
* @since 1.4
*/
public interface Savepoint
{
/**
* @since 1.4
*/
public int getSavepointId() throws SQLException;
/**
* @since 1.4
*/
public String getSavepointName() throws SQLException;
}
/* Statement.java -- Interface for executing SQL statements. /* Statement.java -- Interface for executing SQL statements.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -39,386 +39,328 @@ exception statement from your version. */ ...@@ -39,386 +39,328 @@ exception statement from your version. */
package java.sql; package java.sql;
/** /**
* This interface provides a mechanism for executing SQL statements. * This interface provides a mechanism for executing SQL statements.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface Statement public interface Statement
{ {
public static final int CLOSE_CURRENT_RESULT = 1;
/** public static final int KEEP_CURRENT_RESULT = 2;
* This method executes the specified SQL SELECT statement and returns a public static final int CLOSE_ALL_RESULTS = 3;
* (possibly empty) <code>ResultSet</code> with the results of the query. public static final int SUCCESS_NO_INFO = -2;
* public static final int EXECUTE_FAILED = -3;
* @param sql The SQL statement to execute. public static final int RETURN_GENERATED_KEYS = 1;
* public static final int NO_GENERATED_KEYS = 2;
* @return The result set of the SQL statement.
* /**
* @exception SQLException If an error occurs. * This method executes the specified SQL SELECT statement and returns a
*/ * (possibly empty) <code>ResultSet</code> with the results of the query.
public abstract ResultSet *
executeQuery(String sql) throws SQLException; * @param sql The SQL statement to execute.
* @return The result set of the SQL statement.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public ResultSet executeQuery(String sql) throws SQLException;
* This method executes the specified SQL INSERT, UPDATE, or DELETE statement
* and returns the number of rows affected, which may be 0. /**
* * This method executes the specified SQL INSERT, UPDATE, or DELETE statement
* @param sql The SQL statement to execute. * and returns the number of rows affected, which may be 0.
* *
* @return The number of rows affected by the SQL statement. * @param sql The SQL statement to execute.
* * @return The number of rows affected by the SQL statement.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract int public int executeUpdate(String sql) throws SQLException;
executeUpdate(String sql) throws SQLException;
/**
/*************************************************************************/ * This method closes the statement and frees any associated resources.
*
/** * @exception SQLException If an error occurs.
* This method closes the statement and frees any associated resources. */
* public void close() throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract void * This method returns the maximum length of any column value in bytes.
close() throws SQLException; *
* @return The maximum length of any column value in bytes.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public int getMaxFieldSize() throws SQLException;
* This method returns the maximum length of any column value in bytes.
* /**
* @return The maximum length of any column value in bytes. * This method sets the limit for the maximum length of any column in bytes.
* *
* @exception SQLException If an error occurs. * @param maxsize The new maximum length of any column in bytes.
*/ * @exception SQLException If an error occurs.
public abstract int */
getMaxFieldSize() throws SQLException; public void setMaxFieldSize(int max) throws SQLException;
/*************************************************************************/ /**
* This method returns the maximum possible number of rows in a result set.
/** *
* This method sets the limit for the maximum length of any column in bytes. * @return The maximum possible number of rows in a result set.
* * @exception SQLException If an error occurs.
* @param maxsize The new maximum length of any column in bytes. */
* public int getMaxRows() throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract void * This method sets the maximum number of rows that can be present in a
setMaxFieldSize(int maxsize) throws SQLException; * result set.
*
/*************************************************************************/ * @param maxrows The maximum possible number of rows in a result set.
* @exception SQLException If an error occurs.
/** */
* This method returns the maximum possible number of rows in a result set. public void setMaxRows(int max) throws SQLException;
*
* @return The maximum possible number of rows in a result set. /**
* * This method sets the local escape processing mode on or off. The
* @exception SQLException If an error occurs. * default value is on.
*/ *
public abstract int * @param escape <code>true</code> to enable local escape processing,
getMaxRows() throws SQLException; * <code>false</code> to disable it.
* @exception SQLException If an error occurs.
/*************************************************************************/ */
public void setEscapeProcessing(boolean enable) throws SQLException;
/**
* This method sets the maximum number of rows that can be present in a /**
* result set. * The method returns the number of seconds a statement may be in process
* * before timing out. A value of 0 means there is no timeout.
* @param maxrows The maximum possible number of rows in a result set. *
* * @return The SQL statement timeout in seconds.
* @exception SQLException If an error occurs. * @exception SQLException If an error occurs.
*/ */
public abstract void public int getQueryTimeout() throws SQLException;
setMaxRows(int maxrows) throws SQLException;
/**
/*************************************************************************/ * This method sets the number of seconds a statement may be in process
* before timing out. A value of 0 means there is no timeout.
/** *
* This method sets the local escape processing mode on or off. The * @param timeout The new SQL statement timeout value.
* default value is on. * @exception SQLException If an error occurs.
* */
* @param escape <code>true</code> to enable local escape processing, public void setQueryTimeout(int seconds) throws SQLException;
* <code>false</code> to disable it.
* /**
* @exception SQLException If an error occurs. * This method cancels an outstanding statement, if the database supports
*/ * that operation.
public abstract void *
setEscapeProcessing(boolean esacpe) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public void cancel() throws SQLException;
/** /**
* The method returns the number of seconds a statement may be in process * This method returns the first SQL warning attached to this statement.
* before timing out. A value of 0 means there is no timeout. * Subsequent warnings will be chained to this one.
* *
* @return The SQL statement timeout in seconds. * @return The first SQL warning for this statement.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
*/ public SQLWarning getWarnings() throws SQLException;
public abstract int
getQueryTimeout() throws SQLException; /**
* This method clears any SQL warnings that have been attached to this
/*************************************************************************/ * statement.
*
/** * @exception SQLException If an error occurs.
* This method sets the number of seconds a statement may be in process */
* before timing out. A value of 0 means there is no timeout. public void clearWarnings() throws SQLException;
*
* @param timeout The new SQL statement timeout value. /**
* * This method sets the cursor name that will be used by the result set.
* @exception SQLException If an error occurs. *
*/ * @param name The cursor name to use for this statement.
public abstract void * @exception SQLException If an error occurs.
setQueryTimeout(int timeout) throws SQLException; */
public void setCursorName(String name) throws SQLException;
/*************************************************************************/
/**
/** * This method executes an arbitrary SQL statement of any time. The
* This method cancels an outstanding statement, if the database supports * methods <code>getResultSet</code>, <code>getMoreResults</code> and
* that operation. * <code>getUpdateCount</code> retrieve the results.
* *
* @exception SQLException If an error occurs. * @return <code>true</code> if a result set was returned, <code>false</code>
*/ * if an update count was returned.
public abstract void * @exception SQLException If an error occurs.
cancel() throws SQLException; */
public boolean execute(String sql) throws SQLException;
/*************************************************************************/
/**
/** * This method returns the result set of the SQL statement that was
* This method returns the first SQL warning attached to this statement. * executed. This should be called only once per result set returned.
* Subsequent warnings will be chained to this one. *
* * @return The result set of the query, or <code>null</code> if there was
* @return The first SQL warning for this statement. * no result set (for example, if the statement was an UPDATE).
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. * @see execute
*/ */
public abstract SQLWarning public ResultSet getResultSet() throws SQLException;
getWarnings() throws SQLException;
/**
/*************************************************************************/ * This method returns the update count of the SQL statement that was
* executed. This should be called only once per executed SQL statement.
/** *
* This method clears any SQL warnings that have been attached to this * @return The update count of the query, or -1 if there was no update
* statement. * count (for example, if the statement was a SELECT).
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. * @see execute
*/ */
public abstract void public int getUpdateCount() throws SQLException;
clearWarnings() throws SQLException;
/**
/*************************************************************************/ * This method advances the result set pointer to the next result set,
* which can then be retrieved using <code>getResultSet</code>
/** *
* This method sets the cursor name that will be used by the result set. * @return <code>true</code> if there is another result set,
* * <code>false</code> otherwise (for example, the next result is an
* @param name The cursor name to use for this statement. * update count).
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. * @see execute
*/ */
public abstract void public boolean getMoreResults() throws SQLException;
setCursorName(String name) throws SQLException;
/**
/*************************************************************************/ * This method informs the driver which direction the result set will
* be accessed in.
/** *
* This method executes an arbitrary SQL statement of any time. The * @param direction The direction the result set will be accessed in (?????)
* methods <code>getResultSet</code>, <code>getMoreResults</code> and * @exception SQLException If an error occurs.
* <code>getUpdateCount</code> retrieve the results. */
* public void setFetchDirection(int direction) throws SQLException;
* @return <code>true</code> if a result set was returned, <code>false</code>
* if an update count was returned. /**
* * This method returns the current direction that the driver thinks the
* @exception SQLException If an error occurs. * result set will be accessed int.
*/ *
public abstract boolean * @return The direction the result set will be accessed in (????)
execute(String sql) throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public int getFetchDirection() throws SQLException;
/** /**
* This method returns the result set of the SQL statement that was * This method informs the driver how many rows it should fetch from the
* executed. This should be called only once per result set returned. * database at a time.
* *
* @return The result set of the query, or <code>null</code> if there was * @param numrows The number of rows the driver should fetch at a time
* no result set (for example, if the statement was an UPDATE). * to populate the result set.
* * @exception SQLException If an error occurs.
* @exception SQLException If an error occurs. */
* public void setFetchSize(int rows) throws SQLException;
* @see execute
*/ /**
public abstract ResultSet * This method returns the number of rows the driver believes should be
getResultSet() throws SQLException; * fetched from the database at a time.
*
/*************************************************************************/ * @return The number of rows that will be fetched from the database at a time.
* @exception SQLException If an error occurs.
/** */
* This method returns the update count of the SQL statement that was public int getFetchSize() throws SQLException;
* executed. This should be called only once per executed SQL statement.
* /**
* @return The update count of the query, or -1 if there was no update * This method returns the concurrency type of the result set for this
* count (for example, if the statement was a SELECT). * statement. This will be one of the concurrency types defined in
* * <code>ResultSet</code>.
* @exception SQLException If an error occurs. *
* * @return The concurrency type of the result set for this statement.
* @see execute * @exception SQLException If an error occurs.
*/ * @see ResultSet
public abstract int */
getUpdateCount() throws SQLException; public int getResultSetConcurrency() throws SQLException;
/*************************************************************************/ /**
* This method returns the result set type for this statement. This will
/** * be one of the result set types defined in <code>ResultSet</code>.
* This method advances the result set pointer to the next result set, *
* which can then be retrieved using <code>getResultSet</code> * @return The result set type for this statement.
* * @exception SQLException If an error occurs.
* @return <code>true</code> if there is another result set, * @see ResultSet
* <code>false</code> otherwise (for example, the next result is an */
* update count). public int getResultSetType() throws SQLException;
*
* @exception SQLException If an error occurs. /**
* * This method adds a SQL statement to a SQL batch. A driver is not
* @see execute * required to implement this method.
*/ *
public abstract boolean * @param sql The sql statement to add to the batch.
getMoreResults() throws SQLException; * @exception SQLException If an error occurs.
*/
/*************************************************************************/ public void addBatch(String sql) throws SQLException;
/** /**
* This method returns the current direction that the driver thinks the * This method clears out any SQL statements that have been populated in
* result set will be accessed int. * the current batch. A driver is not required to implement this method.
* *
* @return The direction the result set will be accessed in (????) * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public void clearBatch() throws SQLException;
*/
public abstract int /**
getFetchDirection() throws SQLException; * This method executes the SQL batch and returns an array of update
* counts - one for each SQL statement in the batch - ordered in the same
/*************************************************************************/ * order the statements were added to the batch. A driver is not required
* to implement this method.
/** *
* This method informs the driver which direction the result set will * @return An array of update counts for this batch.
* be accessed in. * @exception SQLException If an error occurs.
* */
* @param direction The direction the result set will be accessed in (?????) public int[] executeBatch() throws SQLException;
*
* @exception SQLException If an error occurs. /**
*/ * This method returns the <code>Connection</code> instance that was
public abstract void * used to create this object.
setFetchDirection(int direction) throws SQLException; *
* @return The connection used to create this object.
/*************************************************************************/ * @exception SQLException If an error occurs.
*/
/** public Connection getConnection() throws SQLException;
* This method returns the number of rows the driver believes should be
* fetched from the database at a time. /**
* * @since 1.4
* @return The number of rows that will be fetched from the database at a time. */
* public boolean getMoreResults(int current) throws SQLException;
* @exception SQLException If an error occurs.
*/ /**
public abstract int * @since 1.4
getFetchSize() throws SQLException; */
public ResultSet getGeneratedKeys() throws SQLException;
/*************************************************************************/
/**
/** * @since 1.4
* This method informs the driver how many rows it should fetch from the */
* database at a time. public int executeUpdate(String sql, int autoGeneratedKeys)
* throws SQLException;
* @param numrows The number of rows the driver should fetch at a time
* to populate the result set. /**
* * @since 1.4
* @exception SQLException If an error occurs. */
*/ public int executeUpdate(String sql, int[] columnIndexes)
public abstract void throws SQLException;
setFetchSize(int numrows) throws SQLException;
/**
/*************************************************************************/ * @since 1.4
*/
/** public int executeUpdate(String sql, String[] columnNames)
* This method returns the concurrency type of the result set for this throws SQLException;
* statement. This will be one of the concurrency types defined in
* <code>ResultSet</code>. /**
* * @since 1.4
* @return The concurrency type of the result set for this statement. */
* public boolean execute(String sql, int autoGeneratedKeys)
* @exception SQLException If an error occurs. throws SQLException;
*
* @see ResultSet /**
*/ * @since 1.4
public abstract int */
getResultSetConcurrency() throws SQLException; public boolean execute(String sql, int[] columnIndexes) throws SQLException;
/*************************************************************************/ /**
* @since 1.4
/** */
* This method returns the result set type for this statement. This will public boolean execute(String sql, String[] columnNames)
* be one of the result set types defined in <code>ResultSet</code>. throws SQLException;
*
* @return The result set type for this statement. /**
* * @since 1.4
* @exception SQLException If an error occurs. */
* public int getResultSetHoldability() throws SQLException;
* @see ResultSet }
*/
public abstract int
getResultSetType() throws SQLException;
/*************************************************************************/
/**
* This method adds a SQL statement to a SQL batch. A driver is not
* required to implement this method.
*
* @param sql The sql statement to add to the batch.
*
* @exception SQLException If an error occurs.
*/
public abstract void
addBatch(String sql) throws SQLException;
/*************************************************************************/
/**
* This method clears out any SQL statements that have been populated in
* the current batch. A driver is not required to implement this method.
*
* @exception SQLException If an error occurs.
*/
public abstract void
clearBatch() throws SQLException;
/*************************************************************************/
/**
* This method executes the SQL batch and returns an array of update
* counts - one for each SQL statement in the batch - ordered in the same
* order the statements were added to the batch. A driver is not required
* to implement this method.
*
* @return An array of update counts for this batch.
*
* @exception SQLException If an error occurs.
*/
public abstract int[]
executeBatch() throws SQLException;
/*************************************************************************/
/**
* This method returns the <code>Connection</code> instance that was
* used to create this object.
*
* @return The connection used to create this object.
*
* @exception SQLException If an error occurs.
*/
public abstract Connection
getConnection() throws SQLException;
} // interface Statement
/* Struct.java -- Mapping for a SQL structured type. /* Struct.java -- Mapping for a SQL structured type.
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,51 +41,37 @@ package java.sql; ...@@ -41,51 +41,37 @@ package java.sql;
import java.util.Map; import java.util.Map;
/** /**
* This interface implements the standard type mapping for a SQL * This interface implements the standard type mapping for a SQL
* structured type. * structured type.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface Struct public interface Struct
{ {
/**
/** * This method returns the name of the SQL structured type for this
* This method returns the name of the SQL structured type for this * object.
* object. *
* * @return The SQL structured type name.
* @return The SQL structured type name. * @exception SQLException If an error occurs.
* */
* @exception SQLException If an error occurs. public String getSQLTypeName() throws SQLException;
*/
public abstract String /**
getSQLTypeName() throws SQLException; * This method returns the attributes of this SQL structured type.
*
/*************************************************************************/ * @return The attributes of this structure type.
* @exception SQLException If an error occurs.
/** */
* This method returns the attributes of this SQL structured type. public Object[] getAttributes() throws SQLException;
*
* @return The attributes of this structure type. /**
* * This method returns the attributes of this SQL structured type.
* @exception SQLException If an error occurs. * The specified map of type mappings overrides the default mappings.
*/ *
public abstract Object[] * @param map The map of SQL type mappings.
getAttributes() throws SQLException; * @return The attributes of this structure type.
* @exception SQLException If a error occurs.
/*************************************************************************/ */
public Object[] getAttributes(Map map) throws SQLException;
/** }
* This method returns the attributes of this SQL structured type.
* The specified map of type mappings overrides the default mappings.
*
* @param map The map of SQL type mappings.
*
* @return The attributes of this structure type.
*
* @exception SQLException If a error occurs.
*/
public abstract Object[]
getAttributes(Map map) throws SQLException;
} // interface Struct
/* Time.java -- Wrapper around java.util.Date /* Time.java -- Wrapper around java.util.Date
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,113 +41,81 @@ package java.sql; ...@@ -41,113 +41,81 @@ package java.sql;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
/** /**
* This class is a wrapper around java.util.Date to allow the JDBC * This class is a wrapper around java.util.Date to allow the JDBC
* driver to identify the value as a SQL Time. * driver to identify the value as a SQL Time.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Time extends java.util.Date
{
/*
* Class Variables
*/
/**
* Used for parsing and formatting this date.
*/
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
/**
* This is the serialization UID for this class.
*/
private static final long serialVersionUID = 8397324403548013681L;
/*************************************************************************/
/*
* Class Methods
*/
/**
* This method returns a new instance of this class by parsing a
* date in JDBC format into a Java date.
*
* @param str The string to parse.
*
* @return The resulting <code>java.sql.Time</code> value.
*/
public static Time
valueOf(String str)
{
try
{
java.util.Date d = (java.util.Date)sdf.parseObject(str);
return(new Time(d.getTime()));
}
catch(Exception e)
{
return(null);
}
}
/*************************************************************************/
/*
* Constructors
*/ */
public class Time extends java.util.Date
/**
* This method initializes a new instance of this class with the
* specified year, month, and day.
*
* @param hour The hour for this Time (0-23)
* @param minute The minute for this time (0-59)
* @param second The second for this time (0-59)
*
* @deprecated
*/
public
Time(int hour, int minute, int second)
{
super(System.currentTimeMillis());
setHours(hour);
setMinutes(minute);
setSeconds(second);
}
/*************************************************************************/
/**
* This method initializes a new instance of this class with the
* specified time value representing the number of seconds since
* Jan 1, 1970 at 12:00 midnight GMT.
*
* @param time The time value to intialize this <code>Time</code> to.
*/
public
Time(long date)
{ {
super(date); static final long serialVersionUID = 8397324403548013681L;
}
/**
/*************************************************************************/ * Used for parsing and formatting this date.
*/
/* private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
* Instance Methods
*/
/**
* This method returns a new instance of this class by parsing a
* date in JDBC format into a Java date.
*
* @param str The string to parse.
* @return The resulting <code>java.sql.Time</code> value.
*/
public static Time valueOf(String str)
{
try
{
java.util.Date d = (java.util.Date) sdf.parseObject(str);
return new Time(d.getTime());
}
catch (Exception e)
{
return null;
}
}
/**
* This method initializes a new instance of this class with the
* specified year, month, and day.
*
* @param hour The hour for this Time (0-23)
* @param minute The minute for this time (0-59)
* @param second The second for this time (0-59)
* @deprecated
*/
public Time(int hour, int minute, int second)
{
super(System.currentTimeMillis());
setHours(hour);
setMinutes(minute);
setSeconds(second);
}
/**
* This method initializes a new instance of this class with the
* specified time value representing the number of seconds since
* Jan 1, 1970 at 12:00 midnight GMT.
*
* @param time The time value to intialize this <code>Time</code> to.
*/
public Time(long date)
{
super(date);
}
/**
* This method returns this date in JDBC format.
*
* @return This date as a string.
*/
public String
toString()
{
return sdf.format(this);
}
/**
* This method returns this date in JDBC format.
*
* @return This date as a string.
*/
public String
toString()
{
return(sdf.format(this));
} }
} // class Time
...@@ -41,261 +41,215 @@ package java.sql; ...@@ -41,261 +41,215 @@ package java.sql;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
/** /**
* This class is a wrapper around java.util.Date to allow the JDBC * This class is a wrapper around java.util.Date to allow the JDBC
* driver to identify the value as a SQL Timestamp. Note that this * driver to identify the value as a SQL Timestamp. Note that this
* class also adds an additional field for nano-seconds, and so * class also adds an additional field for nano-seconds, and so
* is not completely identical to <code>java.util.Date</code> as * is not completely identical to <code>java.util.Date</code> as
* the <code>java.sql.Date</code> and <code>java.sql.Time</code> * the <code>java.sql.Date</code> and <code>java.sql.Time</code>
* classes are. * classes are.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public class Timestamp extends java.util.Date public class Timestamp extends java.util.Date
{ {
static final long serialVersionUID = 3581463369166924961L;
/* /**
* Class Variables * Used for parsing and formatting this date.
*/ */
/**
* Used for parsing and formatting this date.
*/
// Millisecond will have to be close enough for now. // Millisecond will have to be close enough for now.
private static SimpleDateFormat parse_sdf = private static SimpleDateFormat parse_sdf =
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSS"); new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSS");
private static SimpleDateFormat format_sdf = private static SimpleDateFormat format_sdf =
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/** /**
* This is the serialization UID for this class. * The nanosecond value for this object
*/ */
private static final long serialVersionUID = 3581463369166924961L; private int nanos;
/*************************************************************************/ /**
* This method returns a new instance of this class by parsing a
/* * date in JDBC format into a Java date.
* Instance Variables *
*/ * @param str The string to parse.
* @return The resulting <code>java.sql.Timestamp</code> value.
/** */
* @serial The nanosecond value for this object public static Timestamp valueOf(String str)
*/ {
private int nanos; try
{
/*************************************************************************/ Date d = (Date) parse_sdf.parseObject(str);
return new Timestamp(d.getTime());
/* }
* Class Methods catch (Exception e)
*/ {
return null;
/** }
* This method returns a new instance of this class by parsing a }
* date in JDBC format into a Java date.
* /**
* @param str The string to parse. * This method initializes a new instance of this class with the
* * specified year, month, and day.
* @return The resulting <code>java.sql.Timestamp</code> value. *
*/ * @param year The year for this Timestamp (year - 1900)
public static Timestamp * @param month The month for this Timestamp (0-11)
valueOf(String str) * @param day The day for this Timestamp (1-31)
{ * @param hour The hour for this Timestamp (0-23)
try * @param minute The minute for this Timestamp (0-59)
{ * @param second The second for this Timestamp (0-59)
Date d = (Date)parse_sdf.parseObject(str); * @param nanos The nanosecond value for this Timestamp (0 to 999,999,9999)
return(new Timestamp(d.getTime())); * @deprecated
} */
catch(Exception e) public Timestamp(int year, int month, int day, int hour, int minute,
{ int second, int nanos)
return(null); {
} super(year, month, day, hour, minute, second);
} this.nanos = nanos;
}
/*************************************************************************/
/**
/* * This method initializes a new instance of this class with the
* Constructors * specified time value representing the number of seconds since
*/ * Jan 1, 1970 at 12:00 midnight GMT.
*
/** * @param time The time value to intialize this <code>Time</code> to.
* This method initializes a new instance of this class with the */
* specified year, month, and day. public Timestamp(long date)
* {
* @param year The year for this Timestamp (year - 1900) super(date);
* @param month The month for this Timestamp (0-11) }
* @param day The day for this Timestamp (1-31)
* @param hour The hour for this Timestamp (0-23) /**
* @param minute The minute for this Timestamp (0-59) * This method returns this date in JDBC format.
* @param second The second for this Timestamp (0-59) *
* @param nanos The nanosecond value for this Timestamp (0 to 999,999,9999) * @return This date as a string.
* */
* @deprecated public String toString()
*/ {
public return format_sdf.format(this) + "." + getNanos();
Timestamp(int year, int month, int day, int hour, int minute, int second, }
int nanos)
{ /**
super(year, month, day, hour, minute, second); * This method returns the nanosecond value for this object.
* @return The nanosecond value for this object.
this.nanos = nanos; */
} public int getNanos()
{
/*************************************************************************/ return nanos;
}
/**
* This method initializes a new instance of this class with the /**
* specified time value representing the number of seconds since * This method sets the nanosecond value for this object.
* Jan 1, 1970 at 12:00 midnight GMT. *
* * @param nanos The nanosecond value for this object.
* @param time The time value to intialize this <code>Time</code> to. */
*/ public void setNanos(int nanos)
public {
Timestamp(long date) this.nanos = nanos;
{ }
super(date);
} /**
* This methods tests whether this object is earlier than the specified
/*************************************************************************/ * object.
*
/* * @param ts The other <code>Timestamp</code> to test against.
* Instance Methods * @return <code>true</code> if this object is earlier than the other object,
*/ * <code>false</code> otherwise.
*/
/** public boolean before(Timestamp ts)
* This method returns this date in JDBC format. {
* if (ts.getTime() > getTime())
* @return This date as a string. return true;
*/
public String if (ts.getNanos() > getNanos())
toString() return true;
{
return(format_sdf.format(this) + "." + getNanos()); return false;
}
/**
* This methods tests whether this object is later than the specified
* object.
*
* @param ts The other <code>Timestamp</code> to test against.
*
* @return <code>true</code> if this object is later than the other object,
* <code>false</code> otherwise.
*/
public boolean after(Timestamp ts)
{
if (ts.getTime() < getTime())
return true;
if (ts.getNanos() < getNanos())
return true;
return false;
}
/**
* This method these the specified <code>Object</code> for equality
* against this object. This will be true if an only if the specified
* object is an instance of <code>Timestamp</code> and has the same
* time value fields.
*
* @param obj The object to test against for equality.
*
* @return <code>true</code> if the specified object is equal to this
* object, <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
if (obj == null)
return false;
if (!(obj instanceof Timestamp))
return false;
return equals((Timestamp) obj);
}
/**
* This method tests the specified timestamp for equality against this
* object. This will be true if and only if the specified object is
* not <code>null</code> and contains all the same time value fields
* as this object.
*
* @param ts The <code>Timestamp</code> to test against for equality.
*
* @return <code>true</code> if the specified object is equal to this
* object, <code>false</code> otherwise.
*/
public boolean equals(Timestamp ts)
{
if (ts == null)
return false;
if (ts.getTime() != getTime())
return false;
if (ts.getNanos() != getNanos())
return false;
return true;
}
/**
* @since 1.2
*/
/*
public int compareTo(Timestamp ts)
{
}*/
/**
* @since 1.2
*//*
public int compareTo(Object obj)
{
return compareTo((Timestamp) obj);
}*/
} }
/*************************************************************************/
/**
* This method returns the nanosecond value for this object.
*
* @return The nanosecond value for this object.
*/
public int
getNanos()
{
return(nanos);
}
/*************************************************************************/
/**
* This method sets the nanosecond value for this object.
*
* @param nanos The nanosecond value for this object.
*/
public void
setNanos(int nanos)
{
this.nanos = nanos;
}
/*************************************************************************/
/**
* This methods tests whether this object is earlier than the specified
* object.
*
* @param ts The other <code>Timestamp</code> to test against.
*
* @return <code>true</code> if this object is earlier than the other object,
* <code>false</code> otherwise.
*/
public boolean
before(Timestamp ts)
{
if (ts.getTime() > getTime())
return(true);
if (ts.getNanos() > getNanos())
return(true);
return(false);
}
/*************************************************************************/
/**
* This methods tests whether this object is later than the specified
* object.
*
* @param ts The other <code>Timestamp</code> to test against.
*
* @return <code>true</code> if this object is later than the other object,
* <code>false</code> otherwise.
*/
public boolean
after(Timestamp ts)
{
if (ts.getTime() < getTime())
return(true);
if (ts.getNanos() < getNanos())
return(true);
return(false);
}
/*************************************************************************/
/**
* This method these the specified <code>Object</code> for equality
* against this object. This will be true if an only if the specified
* object is an instance of <code>Timestamp</code> and has the same
* time value fields.
*
* @param obj The object to test against for equality.
*
* @return <code>true</code> if the specified object is equal to this
* object, <code>false</code> otherwise.
*/
public boolean
equals(Object obj)
{
if (obj == null)
return(false);
if (!(obj instanceof Timestamp))
return(false);
return(equals((Timestamp)obj));
}
/*************************************************************************/
/**
* This method tests the specified timestamp for equality against this
* object. This will be true if and only if the specified object is
* not <code>null</code> and contains all the same time value fields
* as this object.
*
* @param ts The <code>Timestamp</code> to test against for equality.
*
* @return <code>true</code> if the specified object is equal to this
* object, <code>false</code> otherwise.
*/
public boolean
equals(Timestamp ts)
{
if (ts == null)
return(false);
if (ts.getTime() != getTime())
return(false);
if (ts.getNanos() != getNanos())
return(false);
return(true);
}
} // class Timestamp
...@@ -39,49 +39,47 @@ exception statement from your version. */ ...@@ -39,49 +39,47 @@ exception statement from your version. */
package java.sql; package java.sql;
/** /**
* This class contains constants that are used to identify SQL data types. * This class contains constants that are used to identify SQL data types.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public class Types public class Types
{ {
// These should be self explanatory. People need a SQL book, not
// These should be self explanatory. People need a SQL book, not // Javadoc comments for these.
// Javadoc comments for these. public static final int BIT = -7;
public static final int TINYINT = -6;
public static final int BIT = -7; public static final int SMALLINT = 5;
public static final int TINYINT = -6; public static final int INTEGER = 4;
public static final int SMALLINT = 5; public static final int BIGINT = -5;
public static final int INTEGER = 4; public static final int FLOAT = 6;
public static final int BIGINT = -5; public static final int REAL = 7;
public static final int FLOAT = 6; public static final int DOUBLE = 8;
public static final int REAL = 7; public static final int NUMERIC = 2;
public static final int DOUBLE = 8; public static final int DECIMAL = 3;
public static final int NUMERIC = 2; public static final int CHAR = 1;
public static final int DECIMAL = 3; public static final int VARCHAR = 12;
public static final int CHAR = 1; public static final int LONGVARCHAR = -1;
public static final int VARCHAR = 12; public static final int DATE = 91;
public static final int LONGVARCHAR = -1; public static final int TIME = 92;
public static final int DATE = 91; public static final int TIMESTAMP = 93;
public static final int TIME = 92; public static final int BINARY = -2;
public static final int TIMESTAMP = 93; public static final int VARBINARY = -3;
public static final int BINARY = -2; public static final int LONGVARBINARY = -4;
public static final int VARBINARY = -3; public static final int NULL = 0;
public static final int LONGVARBINARY = -4; public static final int OTHER = 1111;
public static final int NULL = 0; public static final int JAVA_OBJECT = 2000;
public static final int OTHER = 1111; public static final int DISTINCT = 2001;
public static final int JAVA_OBJECT = 2000; public static final int STRUCT = 2002;
public static final int DISTINCT = 2001; public static final int ARRAY = 2003;
public static final int STRUCT = 2002; public static final int BLOB = 2004;
public static final int ARRAY = 2003; public static final int CLOB = 2005;
public static final int BLOB = 2004; public static final int REF = 2006;
public static final int CLOB = 2005; public static final int DATALINK = 70;
public static final int REF = 2006; public static final int BOOLEAN = 16;
// This class can't be instantiated. // This class can't be instantiated.
private Types () private Types()
{ {
} }
}
} // class Types
/* ConnectionEvent.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.sql.SQLException;
import java.util.EventObject;
/**
* @since 1.4
*/
public class ConnectionEvent extends EventObject
{
private SQLException sqlException;
/**
* @since 1.4
*/
public ConnectionEvent(PooledConnection con)
{
super(con);
}
/**
* @since 1.4
*/
public ConnectionEvent(PooledConnection con, SQLException ex)
{
super(con);
this.sqlException = ex;
}
/**
* @since 1.4
*/
public SQLException getSQLException()
{
return sqlException;
}
}
/* ConnectionEventListener.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.util.EventListener;
/**
* @since 1.4
*/
public interface ConnectionEventListener extends EventListener
{
/**
* @since 1.4
*/
public void connectionClosed(ConnectionEvent event);
/**
* @since 1.4
*/
public void connectionErrorOccurred(ConnectionEvent event);
}
/* ConnectionPoolDataSource.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.io.PrintWriter;
import java.sql.SQLException;
/**
* @since 1.4
*/
public interface ConnectionPoolDataSource
{
/**
* @since 1.4
*/
public PooledConnection getPooledConnection() throws SQLException;
/**
* @since 1.4
*/
public PooledConnection getPooledConnection(String user, String password)
throws SQLException;
/**
* @since 1.4
*/
public PrintWriter getLogWriter() throws SQLException;
/**
* @since 1.4
*/
public void setLogWriter(PrintWriter out) throws SQLException;
/**
* @since 1.4
*/
public void setLoginTimeout(int seconds) throws SQLException;
/**
* @since 1.4
*/
public int getLoginTimeout() throws SQLException;
}
/* DataSource.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
/**
* @since 1.4
*/
public interface DataSource
{
/**
* @since 1.4
*/
public Connection getConnection() throws SQLException;
/**
* @since 1.4
*/
public Connection getConnection(String username, String password)
throws SQLException;
/**
* @since 1.4
*/
public PrintWriter getLogWriter() throws SQLException;
/**
* @since 1.4
*/
public void setLogWriter(PrintWriter out) throws SQLException;
/**
* @since 1.4
*/
public void setLoginTimeout(int seconds) throws SQLException;
/**
* @since 1.4
*/
public int getLoginTimeout() throws SQLException;
}
/* PooledConnection.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.sql.Connection;
import java.sql.SQLException;
/**
* @since 1.4
*/
public interface PooledConnection
{
/**
* @since 1.4
*/
public Connection getConnection() throws SQLException;
/**
* @since 1.4
*/
public void close() throws SQLException;
/**
* @since 1.4
*/
public void addConnectionEventListener(ConnectionEventListener listener);
/**
* @since 1.4
*/
public void removeConnectionEventListener(ConnectionEventListener listener);
}
/* RowSet.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;
/**
* @since 1.4
*/
public interface RowSet extends ResultSet
{
/**
* @since 1.4
*/
public String getUrl() throws SQLException;
/**
* @since 1.4
*/
public void setUrl(String url) throws SQLException;
/**
* @since 1.4
*/
public String getDataSourceName();
/**
* @since 1.4
*/
public void setDataSourceName(String name) throws SQLException;
/**
* @since 1.4
*/
public String getUsername();
/**
* @since 1.4
*/
public void setUsername(String name) throws SQLException;
/**
* @since 1.4
*/
public String getPassword();
/**
* @since 1.4
*/
public void setPassword(String password) throws SQLException;
/**
* @since 1.4
*/
public int getTransactionIsolation();
/**
* @since 1.4
*/
public void setTransactionIsolation(int level) throws SQLException;
/**
* @since 1.4
*/
public Map getTypeMap() throws SQLException;
/**
* @since 1.4
*/
public void setTypeMap(Map map) throws SQLException;
/**
* @since 1.4
*/
public String getCommand();
/**
* @since 1.4
*/
public void setCommand(String cmd) throws SQLException;
/**
* @since 1.4
*/
public boolean isReadOnly();
/**
* @since 1.4
*/
public void setReadOnly(boolean value) throws SQLException;
/**
* @since 1.4
*/
public int getMaxFieldSize() throws SQLException;
/**
* @since 1.4
*/
public void setMaxFieldSize(int max) throws SQLException;
/**
* @since 1.4
*/
public int getMaxRows() throws SQLException;
/**
* @since 1.4
*/
public void setMaxRows(int max) throws SQLException;
/**
* @since 1.4
*/
public boolean getEscapeProcessing() throws SQLException;
/**
* @since 1.4
*/
public void setEscapeProcessing(boolean enable) throws SQLException;
/**
* @since 1.4
*/
public int getQueryTimeout() throws SQLException;
/**
* @since 1.4
*/
public void setQueryTimeout(int seconds) throws SQLException;
/**
* @since 1.4
*/
public void setType(int type) throws SQLException;
/**
* @since 1.4
*/
public void setConcurrency(int concurrency) throws SQLException;
/**
* @since 1.4
*/
public void setNull(int parameterIndex, int sqlType) throws SQLException;
/**
* @since 1.4
*/
public void setNull(int paramIndex, int sqlType, String typeName) throws
SQLException;
/**
* @since 1.4
*/
public void setBoolean(int parameterIndex, boolean x) throws SQLException;
/**
* @since 1.4
*/
public void setByte(int parameterIndex, byte x) throws SQLException;
/**
* @since 1.4
*/
public void setShort(int parameterIndex, short x) throws SQLException;
/**
* @since 1.4
*/
public void setInt(int parameterIndex, int x) throws SQLException;
/**
* @since 1.4
*/
public void setLong(int parameterIndex, long x) throws SQLException;
/**
* @since 1.4
*/
public void setFloat(int parameterIndex, float x) throws SQLException;
/**
* @since 1.4
*/
public void setDouble(int parameterIndex, double x) throws SQLException;
/**
* @since 1.4
*/
public void setBigDecimal(int parameterIndex, BigDecimal x) throws
SQLException;
/**
* @since 1.4
*/
public void setString(int parameterIndex, String x) throws SQLException;
/**
* @since 1.4
*/
public void setBytes(int parameterIndex, byte[] x) throws SQLException;
/**
* @since 1.4
*/
public void setDate(int parameterIndex, Date x) throws SQLException;
/**
* @since 1.4
*/
public void setTime(int parameterIndex, Time x) throws SQLException;
/**
* @since 1.4
*/
public void setTimestamp(int parameterIndex, Timestamp x) throws
SQLException;
/**
* @since 1.4
*/
public void setAsciiStream(int parameterIndex, InputStream x, int length)
throws SQLException;
/**
* @since 1.4
*/
public void setBinaryStream(int parameterIndex, InputStream x, int length)
throws SQLException;
/**
* @since 1.4
*/
public void setCharacterStream(int parameterIndex, Reader reader, int
length) throws SQLException;
/**
* @since 1.4
*/
public void setObject(int parameterIndex, Object x, int targetSqlType, int
scale) throws SQLException;
/**
* @since 1.4
*/
public void setObject(int parameterIndex, Object x, int targetSqlType)
throws SQLException;
/**
* @since 1.4
*/
public void setObject(int parameterIndex, Object x) throws SQLException;
/**
* @since 1.4
*/
public void setRef(int i, Ref x) throws SQLException;
/**
* @since 1.4
*/
public void setBlob(int i, Blob x) throws SQLException;
/**
* @since 1.4
*/
public void setClob(int i, Clob x) throws SQLException;
/**
* @since 1.4
*/
public void setArray(int i, Array x) throws SQLException;
/**
* @since 1.4
*/
public void setDate(int parameterIndex, Date x, Calendar cal) throws
SQLException;
/**
* @since 1.4
*/
public void setTime(int parameterIndex, Time x, Calendar cal) throws
SQLException;
/**
* @since 1.4
*/
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
throws SQLException;
/**
* @since 1.4
*/
public void clearParameters() throws SQLException;
/**
* @since 1.4
*/
public void execute() throws SQLException;
/**
* @since 1.4
*/
public void addRowSetListener(RowSetListener listener);
/**
* @since 1.4
*/
public void removeRowSetListener(RowSetListener listener);
}
/* RowSetEvent.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.util.EventObject;
/**
* @since 1.4
*/
public class RowSetEvent extends EventObject
{
public RowSetEvent(RowSet source)
{
super(source);
}
}
/* RowSetInternal.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* @since 1.4
*/
public interface RowSetInternal
{
/**
* @since 1.4
*/
public Object[] getParams() throws SQLException;
/**
* @since 1.4
*/
public Connection getConnection() throws SQLException;
/**
* @since 1.4
*/
public void setMetaData(RowSetMetaData md) throws SQLException;
/**
* @since 1.4
*/
public ResultSet getOriginal() throws SQLException;
/**
* @since 1.4
*/
public ResultSet getOriginalRow() throws SQLException;
}
/* RowSetListener.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.util.EventListener;
/**
* @since 1.4
*/
public interface RowSetListener extends EventListener
{
/**
* @since 1.4
*/
public void rowSetChanged(RowSetEvent event);
/**
* @since 1.4
*/
public void rowChanged(RowSetEvent event);
/**
* @since 1.4
*/
public void cursorMoved(RowSetEvent event);
}
/* RowSetMetaData.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
/**
* @since 1.4
*/
public interface RowSetMetaData extends ResultSetMetaData
{
/**
* @since 1.4
*/
public void setColumnCount(int columnCount) throws SQLException;
/**
* @since 1.4
*/
public void setAutoIncrement(int columnIndex, boolean property)
throws SQLException;
/**
* @since 1.4
*/
public void setCaseSensitive(int columnIndex, boolean property)
throws SQLException;
/**
* @since 1.4
*/
public void setSearchable(int columnIndex, boolean property)
throws SQLException;
/**
* @since 1.4
*/
public void setCurrency(int columnIndex, boolean property)
throws SQLException;
/**
* @since 1.4
*/
public void setNullable(int columnIndex, int property) throws SQLException;
/**
* @since 1.4
*/
public void setSigned(int columnIndex, boolean property)
throws SQLException;
/**
* @since 1.4
*/
public void setColumnDisplaySize(int columnIndex, int size)
throws SQLException;
/**
* @since 1.4
*/
public void setColumnLabel(int columnIndex, String label)
throws SQLException;
/**
* @since 1.4
*/
public void setColumnName(int columnIndex, String columnName)
throws SQLException;
/**
* @since 1.4
*/
public void setSchemaName(int columnIndex, String schemaName)
throws SQLException;
/**
* @since 1.4
*/
public void setPrecision(int columnIndex, int precision)
throws SQLException;
/**
* @since 1.4
*/
public void setScale(int columnIndex, int scale) throws SQLException;
/**
* @since 1.4
*/
public void setTableName(int columnIndex, String tableName)
throws SQLException;
/**
* @since 1.4
*/
public void setCatalogName(int columnIndex, String catalogName)
throws SQLException;
/**
* @since 1.4
*/
public void setColumnType(int columnIndex, int SQLType) throws SQLException;
/**
* @since 1.4
*/
public void setColumnTypeName(int columnIndex, String typeName)
throws SQLException;
}
/* RowSetReader.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.sql.SQLException;
/**
* @since 1.4
*/
public interface RowSetReader
{
/**
* @since 1.4
*/
public void readData(RowSetInternal caller) throws SQLException;
}
/* RowSetWriter.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.sql.SQLException;
/**
* @since 1.4
*/
public interface RowSetWriter
{
/**
* @since 1.4
*/
public boolean writeData(RowSetInternal caller) throws SQLException;
}
/* XAConnection.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.sql.SQLException;
import javax.transaction.xa.XAResource;
/**
* @since 1.4
*/
public interface XAConnection extends PooledConnection
{
/**
* @since 1.4
*/
public XAResource getXAResource() throws SQLException;
}
/* XADataSource.java
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath 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 for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.sql;
import java.io.PrintWriter;
import java.sql.SQLException;
/**
* @since 1.4
*/
public interface XADataSource
{
/**
* @since 1.4
*/
public XAConnection getXAConnection() throws SQLException;
/**
* @since 1.4
*/
public XAConnection getXAConnection(String user, String password) throws
SQLException;
/**
* @since 1.4
*/
public PrintWriter getLogWriter() throws SQLException;
/**
* @since 1.4
*/
public void setLogWriter(PrintWriter out) throws SQLException;
/**
* @since 1.4
*/
public void setLoginTimeout(int seconds) throws SQLException;
/**
* @since 1.4
*/
public int getLoginTimeout() throws SQLException;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment