Array.java: New file from classpath.

* Array.java: New file from classpath.
	* BatchUpdateException.java: Ditto.
	* Blob.java: Ditto.
	* Clob.java: Ditto.
	* Ref.java: Ditto.
	* SQLData.java: Ditto.
	* SQLInput.java: Ditto.
	* SQLOutput.java: Ditto.
	* Struct.java: Ditto.
	* CallableStatement.java: Merged file from claspath.
	* Connection.java: Ditto.
	* DataTruncation.java: Ditto.
	* DatabaseMetaData.java: Ditto.
	* DriverManager.java: Ditto.
	* PreparedStatement.java: Ditto.
	* ResultSet.java: Ditto.
	* ResultSetMetaData.java: Ditto.
	* SQLException.java: Ditto.
	* SQLWarning.java: Ditto.
	* Statement.java: Ditto.
	* Types.java: Ditto.

From-SVN: r37906
This commit is contained in:
Warren Levy 2000-12-01 01:48:34 +00:00 committed by Warren Levy
parent 95ac07b0f4
commit 6934615b97
22 changed files with 3810 additions and 20 deletions

View File

@ -1,3 +1,27 @@
2000-11-30 Warren Levy <warrenl@cygnus.com>
* Array.java: New file from classpath.
* BatchUpdateException.java: Ditto.
* Blob.java: Ditto.
* Clob.java: Ditto.
* Ref.java: Ditto.
* SQLData.java: Ditto.
* SQLInput.java: Ditto.
* SQLOutput.java: Ditto.
* Struct.java: Ditto.
* CallableStatement.java: Merged file from claspath.
* Connection.java: Ditto.
* DataTruncation.java: Ditto.
* DatabaseMetaData.java: Ditto.
* DriverManager.java: Ditto.
* PreparedStatement.java: Ditto.
* ResultSet.java: Ditto.
* ResultSetMetaData.java: Ditto.
* SQLException.java: Ditto.
* SQLWarning.java: Ditto.
* Statement.java: Ditto.
* Types.java: Ditto.
2000-11-29 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/natSystem.cc (init_properties): Set user.language and

226
libjava/java/sql/Array.java Normal file
View File

@ -0,0 +1,226 @@
/* Array.java -- Interface for accessing SQL array object
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
import java.util.Map;
/**
* This interface provides methods for accessing SQL array types
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface Array
{
/**
* This method returns the name of the SQL type of the elements in this
* array. This name is database specific.
*
* @param The name of the SQL type of the elements in this array.
*
* @exception SQLException If an error occurs.
*/
public abstract String
getBaseTypeName() throws SQLException;
/*************************************************************************/
/**
* This method 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.
*
* @exception SQLException If an error occurs.
*
* @see Types
*/
public abstract int
getBaseType() throws SQLException;
/*************************************************************************/
/**
* This method returns the contents of this array. This object returned
* will be an array of Java objects of the appropriate types.
*
* @return The contents of the array as an array of Java objects.
*
* @exception SQLException If an error occurs.
*/
public abstract Object
getArray() throws SQLException;
/*************************************************************************/
/**
* This method returns the contents of this array. The specified
* <code>Map</code> will be used to override selected mappings between
* SQL types and Java classes.
*
* @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.
*/
public abstract Object
getArray(Map map) throws SQLException;
/*************************************************************************/
/**
* This method returns a portion of this array starting at index
* <code>offset</code> into the array and continuing for <code>length</code>
* elements. Fewer than the requested number of elements will be
* returned if the array does not contain the requested number of elements.
* The object returned will be an array of Java objects of
* the appropriate types.
*
* @param offset The offset into this array to start returning elements from.
* @param count The requested number of elements to return.
*
* @return The requested portion of the array.
*
* @exception SQLException If an error occurs.
*/
public abstract Object
getArray(long offset, int count) throws SQLException;
/*************************************************************************/
/**
* This method returns a portion of this array starting at index
* <code>offset</code> into the array and continuing for <code>length</code>
* elements. Fewer than the requested number of elements will be
* 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
* Java class mappings.
*
* @param offset The offset into this array to start returning elements from.
* @param count The requested number of elements to return.
* @param map A mapping of SQL types to Java classes.
*
* @return The requested portion of the array.
*
* @exception SQLException If an error occurs.
*/
public abstract Object
getArray(long index, int count, Map map) throws SQLException;
/*************************************************************************/
/**
* This method returns the elements in the array as a <code>ResultSet</code>.
* 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.
*
* @return The elements of this array as a <code>ResultSet</code>.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract ResultSet
getResultSet() throws SQLException;
/*************************************************************************/
/**
* This method returns the elements in the array as a <code>ResultSet</code>.
* 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 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.
*
* @see ResultSet
*/
public abstract 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 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

View File

@ -0,0 +1,169 @@
/* BatchUpdateException.java -- Exception for batch oriented SQL errors
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
/**
* This class extends <code>SQLException</code> to count the successful
* updates in each statement in a batch that was successfully updated prior
* to the error.
*
* @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
*/
/**
* 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

120
libjava/java/sql/Blob.java Normal file
View File

@ -0,0 +1,120 @@
/* Blob.java -- Access a SQL Binary Large OBject.
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
import java.io.InputStream;
/**
* This interface specified methods for accessing a SQL BLOB (Binary
* Large OBject) type.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface Blob
{
/*************************************************************************/
/**
* This method returns the number of bytes in the BLOB.
*
* @return The number of bytes in the BLOB.
*
* @exception SQLException If an error occurs.
*/
public abstract long
length() throws SQLException;
/*************************************************************************/
/**
* This method returns up to the requested bytes of this BLOB as a
* <code>byte</code> array.
*
* @param offset 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.
*/
public abstract byte[]
getBytes(long offset, int length) throws SQLException;
/*************************************************************************/
/**
* This method returns a stream that will read the bytes of the BLOB.
*
* @return A stream that will read the bytes of the BLOB.
*
* @exception SQLException If an error occurs.
*/
public abstract InputStream
getBinaryStream() 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.
*
* @param pattern The byte pattern to search for.
* @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.
*
* @exception SQLException If an error occurs.
*/
public abstract long
position(byte[] pattern, long offset) 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
* used as the search pattern.
*
* @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.
*
* @return The offset at which the pattern is first found, or -1 if the
* pattern is not found.
*
* @exception SQLException If an error occurs.
*/
public abstract long
position(Blob pattern, long offset) throws SQLException;
} // interface Blob

View File

@ -1,5 +1,5 @@
/* CallableStatement.java -- A statement for calling stored procedures.
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -31,6 +31,7 @@ import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Map;
/**
* This interface provides a mechanism for calling stored procedures.
@ -86,6 +87,22 @@ getObject(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>Object</code>.
*
* @param index The index of the parameter to return.
* @param map The mapping to use for conversion from SQL to Java types.
*
* @return The parameter value as an <code>Object</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Object
getObject(int index, Map map) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>boolean</code>.
@ -191,6 +208,21 @@ getDouble(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>BigDecimal</code>.
*
* @param index The index of the parameter to return.
*
* @return The parameter value as a <code>BigDecimal</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract BigDecimal
getBigDecimal(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>BigDecimal</code>.
@ -237,6 +269,22 @@ getDate(int index) throws SQLException;
/*************************************************************************/
/**
* 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.
* @param calendar The <code>Calendar</code> to use for timezone and locale.
*
* @return The parameter value as a <code>java.sql.Date</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract java.sql.Date
getDate(int index, Calendar calendar) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>java.sql.Time</code>.
@ -252,6 +300,22 @@ getTime(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>java.sql.Time</code>.
*
* @param index The index of the parameter to return.
* @param calendar The <code>Calendar</code> to use for timezone and locale.
*
* @return The parameter value as a <code>java.sql.Time</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract java.sql.Time
getTime(int index, Calendar calendar) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>java.sql.Timestamp</code>.
@ -267,6 +331,82 @@ getTimestamp(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>java.sql.Timestamp</code>.
*
* @param index The index of the parameter to return.
* @param calendar The <code>Calendar</code> to use for timezone and locale.
*
* @return The parameter value as a <code>java.sql.Timestamp</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract java.sql.Timestamp
getTimestamp(int index, Calendar calendar) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>Ref</code>.
*
* @param index The index of the parameter to return.
*
* @return The parameter value as a <code>Ref</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Ref
getRef(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>Blob</code>.
*
* @param index The index of the parameter to return.
*
* @return The parameter value as a <code>Blob</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Blob
getBlob(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <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.
*/
public abstract Clob
getClob(int index) throws SQLException;
/*************************************************************************/
/**
* This method returns the value of the specified parameter as a Java
* <code>Array</code>.
*
* @param index The index of the parameter to return.
*
* @return The parameter value as a <code>Array</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract Array
getArray(int index) throws SQLException;
/*************************************************************************/
/**
* This method registers the specified parameter as an output parameter
* of the specified SQL type.
@ -281,6 +421,21 @@ registerOutParameter(int index, int type) throws SQLException;
/*************************************************************************/
/**
* This method registers the specified parameter as an output parameter
* of the specified SQL type.
*
* @param index The index of the parameter to register as output.
* @param type The SQL type value from <code>Types</code>.
* @param name The user defined data type name.
*
* @exception SQLException If an error occurs.
*/
public abstract void
registerOutParameter(int index, int type, String name) throws SQLException;
/*************************************************************************/
/**
* This method registers the specified parameter as an output parameter
* of the specified SQL type and scale.

136
libjava/java/sql/Clob.java Normal file
View File

@ -0,0 +1,136 @@
/* Clob.java -- Access Character Large OBjects
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
import java.io.InputStream;
import java.io.Reader;
/**
* This interface contains methods for accessing a SQL CLOB (Character
* Large OBject) type.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface Clob
{
/**
* This method returns 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.
*/
public abstract Reader
getCharacterStream() 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>String</code>). The search begins at the specified index.
*
* @param pattern The character pattern to search for, passed as a
* <code>String</code>.
* @param offset. 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.
*/
public abstract long
position(String pattern, long offset) 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 pattern The character pattern to search for, passed as a
* <code>Clob</code>.
* @param offset. 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.
*/
public abstract long
position(Clob pattern, long offset) throws SQLException;
} // interface Clob

View File

@ -27,6 +27,8 @@ executable file might be covered by the GNU General Public License. */
package java.sql;
import java.util.Map;
/**
* This interface provides methods for managing a connection to a database.
*
@ -91,6 +93,28 @@ createStatement() throws SQLException;
/*************************************************************************/
/**
* This method creates a new SQL statement with the specified type and
* concurrency. Valid values for these parameters are specified in the
* <code>ResultSet</code> class.
*
* @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>Statement</code> object.
*
* @exception SQLException If an error occurs.
*
* @see Statement
* @see ResultSet
*/
public abstract Statement
createStatement(int resultSetType, int resultSetConcurrency)
throws SQLException;
/*************************************************************************/
/**
* This method creates a new <code>PreparedStatement</code> for the specified
* SQL string. This method is designed for use with parameterized
@ -110,6 +134,32 @@ prepareStatement(String sql) throws SQLException;
/*************************************************************************/
/**
* This method creates a new <code>PreparedStatement</code> for the specified
* SQL string. This method is designed for use with parameterized
* statements. 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>PreparedStatement</code>.
*
* @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
@ -130,6 +180,32 @@ 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.
@ -309,12 +385,10 @@ getTransactionIsolation() throws SQLException;
/*************************************************************************/
/**
* This method sets the transaction isolation level using one of the
* constants defined in this interface.
* This method sets the current transaction isolation mode. This must
* be one of the constants defined in this interface.
*
* @param level The transaction isolation level to change to; must be
* one of the TRANSACTION_* isolation values with the exception of
* TRANSACTION_NONE; some databases may not support other values.
* @param level The transaction isolation level.
*
* @exception SQLException If an error occurs.
*/
@ -346,5 +420,32 @@ getWarnings() throws SQLException;
public abstract void
clearWarnings() throws SQLException;
/*************************************************************************/
/**
* This method returns the mapping of SQL types to Java classes
* currently in use by this connection. This mapping will have no
* entries unless they have been manually added.
*
* @return The SQL type to Java class mapping.
*
* @exception SQLException If an error occurs.
*/
public abstract Map
getTypeMap() throws SQLException;
/*************************************************************************/
/**
* This method sets the mapping table for SQL types to Java classes.
* Any entries in this map override the defaults.
*
* @param map The new SQL mapping table.
*
* @exception SQLException If an error occurs.
*/
public abstract void
setTypeMap(Map map) throws SQLException;
} // interface Connection

View File

@ -33,7 +33,7 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class DataTruncation extends SQLWarning implements java.io.Serializable
public class DataTruncation extends SQLWarning
{
/*************************************************************************/
@ -72,6 +72,15 @@ private boolean read;
*/
private int transferSize;
/*************************************************************************/
/**
* Static Variables
*/
/**
* This is the serialization UID for this class
*/
private static final long serialVersionUID = 6464298989504059473L;
/*************************************************************************/

View File

@ -2456,5 +2456,276 @@ public abstract ResultSet
getIndexInfo(String catalog, String schema, String table, boolean unique,
boolean approx) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the datbase supports the specified
* result type.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type is supported,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
supportsResultSetType(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether the specified result set type and result set
* concurrency type are supported by the database.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
* @param concur The desired concurrency type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type is supported,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
supportsResultSetConcurrency(int type, int concur) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type sees its
* own updates.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type sees its own updates,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
ownUpdatesAreVisible(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type sees its
* own deletes.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type sees its own deletes,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
ownDeletesAreVisible(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type sees its
* own inserts.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type sees its own inserts,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
ownInsertsAreVisible(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type sees
* updates committed by others.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type sees other updates,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
othersUpdatesAreVisible(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type sees
* deletes committed by others.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type sees other deletes,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
othersDeletesAreVisible(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type sees
* inserts committed by others.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type sees other inserts,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
othersInsertsAreVisible(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type can detect
* a visible update by calling the <code>rowUpdated</code> method.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type can detect visible updates
* using <code>rowUpdated</code>, <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
updatesAreDetected(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type can detect
* a visible delete by calling the <code>rowUpdated</code> method.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type can detect visible deletes
* using <code>rowUpdated</code>, <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
deletesAreDetected(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the specified result set type can detect
* a visible insert by calling the <code>rowUpdated</code> method.
*
* @param type The desired result type, which is one of the constants
* defined in <code>ResultSet</code>.
*
* @return <code>true</code> if the result set type can detect visible inserts
* using <code>rowUpdated</code>, <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract boolean
insertsAreDetected(int type) throws SQLException;
/*************************************************************************/
/**
* This method tests whether or not the database supports batch updates.
*
* @return <code>true</code> if batch updates are supported,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
*/
public abstract boolean
supportsBatchUpdates() throws SQLException;
/*************************************************************************/
/**
* This method returns the list of user defined data types in use. These
* are returned as a <code>ResultSet</code> with the following columns:
* <p>
* <ol>
* <li>TYPE_CAT - The catalog name, which may be <code>null</code>.
* <li>TYPE_SCEHM - The schema name, which may be <code>null</code>.
* <li>TYPE_NAME - The user defined data type name.
* <li>CLASS_NAME - The Java class name this type maps to.
* <li>DATA_TYPE - A type identifer from <code>Types</code> for this type.
* This will be one of <code>JAVA_OBJECT</code>, <code>STRUCT</code>, or
* <code>DISTINCT</code>.
* <li>REMARKS - Comments about this data type.
* </ol>
*
* @param catalog The catalog to retrieve information from, or the empty string
* to return entities not associated with a catalog, or <code>null</code>
* to return information from all catalogs.
* @param schema The schema to retrieve information from, or the empty string
* to return entities not associated with a schema.
* @param typePattern The type name pattern to match.
* @param types The type identifer patterns (from <code>Types</code>) to
* match.
*
* @return A <code>ResultSet</code> with the requested type information
*
* @exception SQLException If an error occurs.
*/
public abstract ResultSet
getUDTs(String catalog, String schema, String typePattern, int[] types)
throws SQLException;
/*************************************************************************/
/**
* This method returns the <code>Connection</code> object that was used
* to generate the metadata in this object.
*
* @return The connection for this object.
*
* @exception SQLException If an error occurs.
*/
public abstract Connection
getConnection() throws SQLException;
} // interface DatabaseMetaData

View File

@ -1,5 +1,5 @@
/* DriverManager.java -- Manage JDBC drivers
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -137,6 +137,38 @@ setLoginTimeout(int 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.
*
@ -186,9 +218,11 @@ println(String str)
* 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)
registerDriver(Driver driver) throws SQLException
{
if (!drivers.contains(driver))
drivers.addElement(driver);
@ -200,9 +234,11 @@ registerDriver(Driver 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)
deregisterDriver(Driver driver) throws SQLException
{
if (drivers.contains(driver))
drivers.removeElement(driver);
@ -211,15 +247,30 @@ deregisterDriver(Driver driver)
/*************************************************************************/
/**
* This method returns a list of all the currently loaded JDBC drivers which
* the current caller has access to.
* 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()
{
return(drivers.elements());
Vector v = new Vector();
Enumeration e = drivers.elements();
// Is this right?
ClassLoader cl = Thread.currentThread().getContextClassLoader();
while(e.hasMoreElements())
{
Object obj = e.nextElement();
if (!obj.getClass().getClassLoader().equals(cl))
continue;
v.addElement(obj);
}
return(v.elements());
}
/*************************************************************************/

View File

@ -30,6 +30,7 @@ package java.sql;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.util.Calendar;
/**
* This interface provides a mechanism for executing pre-compiled
@ -56,6 +57,21 @@ setNull(int index, int type) throws SQLException;
/*************************************************************************/
/**
* This method populates the specified parameter with a SQL NULL value
* for the specified type.
*
* @param index The index of the parameter to set.
* @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.
*
* @exception SQLException If an error occurs.
*/
public abstract void
setNull(int index, int type, String name) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>boolean</code> value.
@ -210,6 +226,21 @@ setDate(int index, java.sql.Date value) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>java.sql.Date</code> value.
*
* @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.
*/
public abstract void
setDate(int index, java.sql.Date value, Calendar calendar) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>java.sql.Time</code> value.
@ -224,6 +255,21 @@ setTime(int index, java.sql.Time value) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>java.sql.Time</code> value.
*
* @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.
*/
public abstract void
setTime(int index, java.sql.Time value, Calendar calendar) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>java.sql.Timestamp</code> value.
@ -238,6 +284,22 @@ setTimestamp(int index, java.sql.Timestamp value) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>java.sql.Timestamp</code> value.
*
* @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.
*/
public abstract void
setTimestamp(int index, java.sql.Timestamp value, Calendar calendar)
throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* ASCII <code>InputStream</code> value.
@ -283,6 +345,81 @@ setBinaryStream(int index, InputStream value, int length) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* character <code>Reader</code> value.
*
* @param index The index of the parameter value to set.
* @param value The value of the parameter.
* @param length The number of bytes in the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
setCharacterStream(int index, Reader value, int length) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <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.
*
* @exception SQLException If an error occurs.
*/
public abstract void
setRef(int index, Ref value) 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.
*
* @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
setBlob(int index, Blob value) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>Clob</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.
*
* @exception SQLException If an error occurs.
*/
public abstract void
setClob(int index, Clob value) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>Array</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.
*
* @exception SQLException If an error occurs.
*/
public abstract void
setArray(int index, Array value) throws SQLException;
/*************************************************************************/
/**
* This method sets the specified parameter from the given Java
* <code>Object</code> value. The default object type to SQL type mapping
@ -333,6 +470,16 @@ 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.
@ -344,6 +491,18 @@ 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

51
libjava/java/sql/Ref.java Normal file
View File

@ -0,0 +1,51 @@
/* Ref.java -- Reference to a SQL structured type.
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
/**
* This interface provides a mechanism for obtaining information about
* a SQL structured type
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
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.
*/
public abstract String
getBaseTypeName() throws SQLException;
} // interface Ref

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* ResultSetMetaData.java -- Returns information about the ResultSet
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -358,5 +358,21 @@ isWritable(int index) throws SQLException;
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

View File

@ -0,0 +1,74 @@
/* SQLData.java -- Custom mapping for a user defined datatype
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
/**
* This interface is used for mapping SQL data to user defined datatypes.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
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 abstract String
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

View File

@ -32,7 +32,7 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class SQLException extends Exception implements java.io.Serializable
public class SQLException extends Exception
{
/*************************************************************************/
@ -59,6 +59,15 @@ private String SQLState;
*/
private int vendorCode;
/*************************************************************************/
/**
* Static Variables
*/
/**
* This is the serialization UID for this class
*/
private static final long serialVersionUID = 2135244094396331484L;
/*************************************************************************/

View File

@ -0,0 +1,332 @@
/* SQLInput.java -- Read SQL values from a stream
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
/**
* This interface provides methods for reading values from a stream
* that is connected to a SQL structured or distinct type. It is used
* for custom mapping of user defined data types.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface SQLInput
{
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>String</code>.
*
* @return The value read from the stream as a <code>String</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract String
readString() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>boolean</code>.
*
* @return The value read from the stream as a <code>boolean</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract boolean
readBoolean() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>byte</code>.
*
* @return The value read from the stream as a <code>byte</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract byte
readByte() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>short</code>.
*
* @return The value read from the stream as a <code>short</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract short
readShort() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>int</code>.
*
* @return The value read from the stream as an <code>int</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract int
readInt() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>long</code>.
*
* @return The value read from the stream as a <code>long</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract long
readLong() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>float</code>.
*
* @return The value read from the stream as a <code>float</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract float
readFloat() 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.
*/
public abstract double
readDouble() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>BigDecimal</code>.
*
* @return The value read from the stream as a <code>BigDecimal</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract BigDecimal
readBigDecimal() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* byte array
*
* @return The value read from the stream as a byte array.
*
* @exception SQLException If an error occurs.
*/
public abstract byte[]
readBytes() 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>.
*
* @exception SQLException If an error occurs.
*/
public abstract java.sql.Date
readDate() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a Java
* <code>java.sql.Time</code>.
*
* @return The value read from the stream as a <code>java.sql.Time</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract java.sql.Time
readTime() throws SQLException;
/*************************************************************************/
/**
* 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>java.sql.Timestamp</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract java.sql.Timestamp
readTimestamp() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a ASCII text
* <code>InputStream</code>.
*
* @return The value read from the stream as an <code>InputStream</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract InputStream
readAsciiStream() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a binary
* <code>InputStream</code>.
*
* @return The value read from the stream as an <code>InputStream</code>.
*
* @exception SQLException If an error occurs.
*/
public abstract InputStream
readBinaryStream() throws SQLException;
/*************************************************************************/
/**
* This method reads the next item from the stream a character
* <code>Reader</code>.
*
* @return The value read from the stream as a <code>Reader</code>.
*
* @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

View File

@ -0,0 +1,331 @@
/* SQLOutput.java -- Write SQL values to a stream
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
/**
* This interface provides methods for writing Java types to a SQL stream.
* It is used for implemented custom type mappings for user defined data
* types.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface SQLOutput
{
/*************************************************************************/
/**
* This method writes the specified Java <code>String</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeString(String value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>boolean</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeBoolean(boolean value) throws SQLException;
/*************************************************************************/
/**
* 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.
*/
public abstract void
writeByte(byte value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>short</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeShort(short value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>int</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeInt(int value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>long</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeLong(long value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>float</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeFloat(float 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.
*/
public abstract void
writeDouble(double value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>BigDecimal</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeBigDecimal(BigDecimal value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>byte</code> array
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeBytes(byte[] 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.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeDate(java.sql.Date value) throws SQLException;
/*************************************************************************/
/**
* 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.
*/
public abstract void
writeTime(java.sql.Time value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java <code>java.sql.Timestamp</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeTimestamp(java.sql.Timestamp value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified Java character stream
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeCharacterStream(Reader value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified uninterpreted binary byte stream
* to the SQL stream.
*
* @param value The value to write to the stream.
*
* @exception SQLException If an error occurs.
*/
public abstract void
writeBinaryStream(InputStream value) throws SQLException;
/*************************************************************************/
/**
* This method writes the specified ASCII text stream
* to the SQL stream.
*
* @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

View File

@ -32,11 +32,22 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class SQLWarning extends SQLException implements java.io.Serializable
public class SQLWarning extends SQLException
{
/*************************************************************************/
/**
* Static Variables
*/
/**
* This is the serialization UID for this class
*/
private static final long serialVersionUID = 3917336774604784856L;
/*************************************************************************/
/*
* Constructors
*/
@ -132,7 +143,5 @@ setNextWarning(SQLWarning e)
super.setNextException(e);
}
private static final long serialVersionUID = 3917336774604784856L;
} // class SQLWarning

View File

@ -1,5 +1,5 @@
/* Statement.java -- Interface for executing SQL statements.
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -273,5 +273,141 @@ getUpdateCount() throws SQLException;
public abstract boolean
getMoreResults() throws SQLException;
/*************************************************************************/
/**
* This method returns the current direction that the driver thinks the
* result set will be accessed int.
*
* @return The direction the result set will be accessed in (????)
*
* @exception SQLException If an error occurs.
*/
public abstract int
getFetchDirection() throws SQLException;
/*************************************************************************/
/**
* This method informs the driver which direction the result set will
* be accessed in.
*
* @param direction The direction the result set will be accessed in (?????)
*
* @exception SQLException If an error occurs.
*/
public abstract void
setFetchDirection(int direction) throws SQLException;
/*************************************************************************/
/**
* This method returns the number of rows the driver believes should be
* 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.
*/
public abstract int
getFetchSize() throws SQLException;
/*************************************************************************/
/**
* This method informs the driver how many rows it should fetch from the
* database at a time.
*
* @param numrows The number of rows the driver should fetch at a time
* to populate the result set.
*
* @exception SQLException If an error occurs.
*/
public abstract void
setFetchSize(int numrows) throws SQLException;
/*************************************************************************/
/**
* This method returns the concurrency type of the result set for this
* statement. This will be one of the concurrency types defined in
* <code>ResultSet</code>.
*
* @return The concurrency type of the result set for this statement.
*
* @exception SQLException If an error occurs.
*
* @see ResultSet
*/
public abstract 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>.
*
* @return The result set type for this statement.
*
* @exception SQLException If an error occurs.
*
* @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

View File

@ -0,0 +1,80 @@
/* Struct.java -- Mapping for a SQL structured type.
Copyright (C) 1999, 2000 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.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.sql;
import java.util.Map;
/**
* This interface implements the standard type mapping for a SQL
* structured type.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface Struct
{
/**
* This method returns the name of the SQL structured type for this
* object.
*
* @return The SQL structured type name.
*
* @exception SQLException If an error occurs.
*/
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.
*/
public abstract Object[]
getAttributes() 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

View File

@ -59,6 +59,13 @@ public static final int VARBINARY = -3;
public static final int LONGVARBINARY = -4;
public static final int NULL = 0;
public static final int OTHER = 1111;
public static final int JAVA_OBJECT = 2000;
public static final int DISTINCT = 2001;
public static final int STRUCT = 2002;
public static final int ARRAY = 2003;
public static final int BLOB = 2004;
public static final int CLOB = 2005;
public static final int REF = 2006;
} // class Types