You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/03/15 15:57:17 UTC

svn commit: r386087 [39/45] - in /incubator/harmony/enhanced/classlib/trunk: make/ make/patternsets/ modules/jndi/ modules/jndi/META-INF/ modules/jndi/make/ modules/jndi/make/common/ modules/jndi/src/ modules/jndi/src/main/ modules/jndi/src/main/java/ ...

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLInput.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLInput.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLInput.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLInput.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,281 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+import java.math.BigDecimal;
+import java.io.Reader;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * The SQLInput interface defines operations which apply to a type of input
+ * stream which carries a series of values which represent an instance of an SQL
+ * structured type or SQL distinct type.
+ * <p>
+ * SQLInput interface is used for custom mapping of SQL User Defined Types
+ * (UDTs)to Java classes. It is used by JDBC drivers below the level of the
+ * public interfaces and application programs do not normally use the SQLInput
+ * methods directly. Reader methods such as readLong and readBytes provide means
+ * to read values from an SQLInput stream.
+ * <p>
+ * When the getObject method is called with an object which implements the
+ * SQLData interface, the JDBC driver determines the SQL type of the UDT being
+ * mapped by caling the SQLData.getSQLType method. The driver creates an
+ * instance of an SQLInput stream, filling the stream with the attributes of the
+ * UDT. The SQLInput stream is passed to the SQLData.readSQL method which then
+ * calls the SQLInput reader methods to read the attributes.
+ * 
+ */
+public interface SQLInput {
+
+	/**
+	 * Returns the next attribute in the stream in the form of a String.
+	 * 
+	 * @return the next attribute as a String. null if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public String readString() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a boolean.
+	 * 
+	 * @return the next attribute as a boolean. false if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public boolean readBoolean() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a byte.
+	 * 
+	 * @return the next attribute as a byte. 0 if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public byte readByte() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a short.
+	 * 
+	 * @return the next attribute as a short. 0 if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public short readShort() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of an int.
+	 * 
+	 * @return the next attribute as an int. 0 if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public int readInt() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a long.
+	 * 
+	 * @return the next attribute as a long. 0 if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public long readLong() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a float.
+	 * 
+	 * @return the next attribute as a float. 0 if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public float readFloat() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a double.
+	 * 
+	 * @return the next attribute as a double. 0 if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public double readDouble() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a
+	 * java.math.BigDecimal.
+	 * 
+	 * @return the attribute as a java.math.BigDecimal. null if the read returns
+	 *         SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public BigDecimal readBigDecimal() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a byte array.
+	 * 
+	 * @return the attribute as a byte array. null if the read returns SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public byte[] readBytes() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a java.sql.Date.
+	 * 
+	 * @return the next attribute as a java.sql.Date. null if the value is SQL
+	 *         NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Date readDate() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a java.sql.Time.
+	 * 
+	 * @return the attribute as a java.sql.Time. null if the read returns SQL
+	 *         NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Time readTime() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a
+	 * java.sql.Timestamp.
+	 * 
+	 * @return the attribute as a java.sql.Timestamp. null if the read returns
+	 *         SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Timestamp readTimestamp() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a Unicode
+	 * character stream embodied as a java.io.Reader.
+	 * 
+	 * @return the next attribute as a java.io.Reader. null if the value is SQL
+	 *         NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Reader readCharacterStream() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of an ASCII
+	 * character stream embodied as a java.io.InputStream.
+	 * 
+	 * @return the next attribute as a java.io.InputStream. null if the value is
+	 *         SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public InputStream readAsciiStream() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a stream of bytes
+	 * embodied as a java.io.InputStream.
+	 * 
+	 * @return the next attribute as a java.io.InputStream. null if the value is
+	 *         SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public InputStream readBinaryStream() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a
+	 * java.lang.Object.
+	 * <p>
+	 * The type of the Object returned is determined by the type mapping for
+	 * this JDBC driver, including any customized mappings in force. A type map
+	 * is given to the SQLInput by the JDBC driver before the SQLInput is given
+	 * to the application.
+	 * <p>
+	 * If the attribute is an SQL structured or distinct type, its SQL type is
+	 * determined. If the streams type map contains an element for that SQL
+	 * type, the driver creates an object of relevant type and invokes the
+	 * method SQLData.readSQL on it, which reads supplementary data from the
+	 * stream using whichever protocol is defined for that method.
+	 * 
+	 * @return the next attribute as an Object. null if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Object readObject() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a java.sql.Ref.
+	 * 
+	 * @return the next attribute as a java.sql.Ref. null if the value is SQL
+	 *         NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Ref readRef() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a java.sql.Blob.
+	 * 
+	 * @return the next attribute as a java.sql.Blob. null if the value is SQL
+	 *         NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Blob readBlob() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a java.sql.Clob.
+	 * 
+	 * @return the next attribute as a java.sql.Clob. null if the value is SQL
+	 *         NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Clob readClob() throws SQLException;
+
+	/**
+	 * Returns the next attribute in the stream in the form of a java.sql.Array.
+	 * 
+	 * @return the next attribute as an Array. null if the value is SQL NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public Array readArray() throws SQLException;
+
+	/**
+	 * Reports whether the last value read was SQL NULL.
+	 * 
+	 * @return true if the last value read was SQL NULL, false otherwise.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public boolean wasNull() throws SQLException;
+
+	/**
+	 * Reads the next attribute in the stream (SQL DATALINK value) and returns
+	 * it as a java.net.URL object.
+	 * 
+	 * @return the next attribute as a java.net.URL. null if the value is SQL
+	 *         NULL.
+	 * @throws SQLException
+	 *             if there is a database error
+	 */
+	public URL readURL() throws SQLException;
+
+} // end interface SQLInput
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLOutput.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLOutput.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLOutput.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLOutput.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,208 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package java.sql;
+
+import java.math.BigDecimal;
+import java.io.Reader;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * The interface for an output stream used to write attributes of an SQL User Defined Type to
+ * the database.  This interface is used for custom mapping of types and is called by the JDBC
+ * driver.  It is not expected that this interface is used by applications.
+ * <p>
+ * When an object which implements the SQLData interface is used as an argument to an SQL statement,
+ * the JDBC driver calls the method <code>SQLData.getSQLType</code> to establish the type of the
+ * SQL UDT that is being passed.  The driver then creates an SQLOutput stream and passes it to the
+ * <code>SQLData.writeSQL</code> method, which in turn uses the appropriate SQLOutput writer methods
+ * to write the data from the SQLData object into the stream according to the defined mapping. 
+ * 
+ */
+public interface SQLOutput {
+	
+	/**
+	 * Write a String value into the output stream.
+	 * @param theString the String to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeString(String theString) throws SQLException;
+	
+	/**
+	 * Write a boolean value into the output stream.
+	 * @param theFlag the boolean value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeBoolean(boolean theFlag) throws SQLException;
+	
+	/**
+	 * Write a byte value into the output stream.
+	 * @param theByte the byte value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeByte(byte theByte) throws SQLException;
+	
+	/**
+	 * Write a short value into the output stream.
+	 * @param theShort the short value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeShort(short theShort) throws SQLException;
+	
+	/**
+	 * Write an int value into the output stream.
+	 * @param theInt the int value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeInt(int theInt) throws SQLException;
+	
+	/**
+	 * Write a long value into the output stream.
+	 * @param theLong the long value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeLong(long theLong) throws SQLException;
+	
+	/**
+	 * Write a float value into the output stream.
+	 * @param theFloat the float value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeFloat(float theFloat) throws SQLException;
+	
+	/**
+	 * Write a double value into the output stream.
+	 * @param theDouble the double value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeDouble(double theDouble) throws SQLException;
+	
+	/**
+	 * Write a java.math.BigDecimal value into the output stream.
+	 * @param theBigDecimal the BigDecimal value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeBigDecimal(BigDecimal theBigDecimal) throws SQLException;
+	
+	/**
+	 * Write an array of bytes into the output stream.
+	 * @param theBytes the array of bytes to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeBytes(byte[] theBytes) throws SQLException;
+	
+	/**
+	 * Write a java.sql.Date value into the output stream.
+	 * @param theDate the Date value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeDate(Date theDate) throws SQLException;
+	
+	/**
+	 * Write a java.sql.Time value into the output stream.
+	 * @param theTime the Time value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeTime(Time theTime) throws SQLException;
+	
+	/**
+	 * Write a java.sql.Timestamp value into the output stream.
+	 * @param theTimestamp the Timestamp value to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeTimestamp(Timestamp theTimestamp) throws SQLException;
+	
+	/**
+	 * Write a stream of Unicode characters into the output stream.
+	 * @param theStream the stream of Unicode characters to write, as a java.io.Reader object
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeCharacterStream(Reader theStream) throws SQLException;
+	
+	/**
+	 * Write a stream of ASCII characters into the output stream.
+	 * @param theStream the stream of ASCII characters to write, as a java.io.InputStream object
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeAsciiStream(InputStream theStream) throws SQLException;
+	
+	/**
+	 * Write a stream of uninterpreted bytes into the output stream.
+	 * @param theStream the stream of bytes to write, as a java.io.InputStream object
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeBinaryStream(InputStream theStream) throws SQLException;
+	
+	/**
+	 * Write an SQLData object into the output stream.
+	 * <p>
+	 * If the SQLData object is null, writes SQL NULL to the stream.
+	 * <p>
+	 * Otherwise, calls the <code>SQLData.writeSQL</code> method of the object, which
+	 * writes the object's attributes to the stream by calling the appropriate SQLOutput writer
+	 * methods for each attribute, in order.  The order of the attributes is the order they are
+	 * listed in the SQL definition of the User Defined Type.
+	 * @param theObject the SQLData object to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeObject(SQLData theObject) throws SQLException;
+	
+	/**
+	 * Write an SQL Ref value into the output stream.
+	 * @param theRef the java.sql.Ref object to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeRef(Ref theRef) throws SQLException;
+	
+	/**
+	 * Write an SQL Blob value into the output stream.
+	 * @param theBlob the java.sql.Blob object to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeBlob(Blob theBlob) throws SQLException;
+	
+	/**
+	 * Write an SQL Clob value into the output stream.
+	 * @param theClob the java.sql.Clob object to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeClob(Clob theClob) throws SQLException;
+	
+	/**
+	 * Write an SQL Struct value into the output stream.
+	 * @param theStruct the java.sql.Struct object to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeStruct(Struct theStruct) throws SQLException;
+	
+	/**
+	 * Write an SQL Array value into the output stream.
+	 * @param theArray the java.sql.Array object to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeArray(Array theArray) throws SQLException;
+	
+	/**
+	 * Write an SQL DATALINK value into the output stream.
+	 * @param theURL the Datalink value as a java.net.URL to write
+	 * @throws SQLException if a database error occurs
+	 */
+	public void writeURL(URL theURL) throws SQLException;
+	
+} // end interface SQLOutput
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLPermission.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLPermission.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLPermission.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLPermission.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,56 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package java.sql;
+
+import java.security.BasicPermission;
+import java.security.Guard;
+import java.io.Serializable;
+
+/**
+ * Permission relating to security access control in the java.sql package.
+ * <p>
+ * Currently, the only permission supported has the name "setLog".  The setLog permission
+ * controls whether a Java application or applet can open a logging stream using the 
+ * DriverManager.setLogWriter method or the DriverManager.setLogStream method.  This is a
+ * potentially dangerous operation since the logging stream can contain usernames, passwords 
+ */
+public final class SQLPermission extends BasicPermission implements Guard, Serializable {
+	
+	private static final long serialVersionUID = -1439323187199563495L;
+
+	/**
+	 * Creates a new SQLPermission object with the specified name.
+	 * @param name the name to use for this SQLPermission
+	 */
+	public SQLPermission(String name) {
+		super( name );
+		//if (name != "setLog") throw new IllegalArgumentException();	
+	} // end method SQLPermissions( String )
+    
+	/**
+	 * Creates a new SQLPermission object with the specified name.
+	 * @param name is the name of the SQLPermission.  Currently only "setLog" is allowed.
+	 * @param actions is currently unused and should be set to null
+	 */
+	public SQLPermission(String name, String actions) {
+    	super( name, null );
+    	//if (name != "setLog") throw new IllegalArgumentException(); 
+    } // end method SQLPermissions( String, String )
+    
+} // end class SQLPermission
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLWarning.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLWarning.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLWarning.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLWarning.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,93 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package java.sql;
+
+import java.io.Serializable;
+
+/**
+ * An exception class that holds information about Database access warnings.
+ * 
+ */
+public class SQLWarning extends SQLException implements Serializable {
+	
+	private static final long serialVersionUID = 3917336774604784856L;
+	
+	private SQLWarning chainedWarning = null;
+
+	/** 
+	 * Creates an SQLWarning object.
+	 * The Reason string is set to null, the SQLState string is set to null and the Error Code is set
+	 * to 0.
+	 */
+	public SQLWarning() {
+		super();
+	} // end method SQLWarning()
+
+	/**
+	 * Creates an SQLWarning object.
+	 * The Reason string is set to the given reason string, the SQLState string is set to null and the
+	 * Error Code is set to 0.
+	 * @param theReason
+	 */
+	public SQLWarning(String theReason) {
+		super(theReason);
+	} // end method SQLWarning( String )
+
+	/**
+	 * Creates an SQLWarning object.
+	 * The Reason string is set to the given reason string, the SQLState string is set to the given
+	 * SQLState string and the Error Code is set to 0.
+	 * @param theReason the string to use as the Reason string
+	 * @param theSQLState the string to use as the SQLState string
+	 */
+	public SQLWarning(String theReason, String theSQLState) {
+		super(theReason, theSQLState);
+	} // end method SQLWarning( String, String )
+
+	/**
+	 * Creates an SQLWarning object.
+	 * The Reason string is set to the given reason string, the SQLState string is set to the given
+	 * SQLState string and the Error Code is set to the given ErrorCode value.
+	 * @param theReason
+	 * @param theSQLState
+	 * @param theErrorCode
+	 */
+	public SQLWarning(String theReason, String theSQLState, int theErrorCode) {
+		super(theReason, theSQLState, theErrorCode);
+	} // end method SQLWarning( String, String, int )
+	
+	/**
+	 * Gets the SQLWarning chained to this SQLWarning object.
+	 * @return the SQLWarning chained to this SQLWarning.  null if no SQLWarning is
+	 * chained to this SQLWarning.
+	 */
+	public SQLWarning 	getNextWarning() {
+		return chainedWarning;
+	} // end method getNextWarning()
+	
+    /**
+     * Chains a supplied SQLWarning to this SQLWarning.
+     * @param w the SQLWarning to chain to this SQLWarning.
+     */ 
+	public void setNextWarning(SQLWarning w) {
+		chainedWarning = w;
+		return;
+	} // end method setNextWarning( SQLWarning )
+  
+} // end class SQLWarning
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Savepoint.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Savepoint.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Savepoint.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Savepoint.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,44 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package java.sql;
+
+/**
+ * A Savepoint is an instant during the current transaction that can be utilised by a 
+ * Rollback from the Connection.rollback method. Rolling back to a particular Savepoint means
+ * that all changes that occurred after that Savepoint are removed.
+ * 
+ */
+public interface Savepoint {
+
+	/**
+	 * Returns the constructed ID for this Savepoint.
+	 * @return the ID for this Savepoint.
+	 * @throws SQLException
+	 */
+	public int getSavepointId() throws SQLException;
+
+	/**
+	 * Returns the name for this Savepoint.
+	 * 
+	 * @return the name of this Savepoint.
+	 * @throws SQLException
+	 */
+	public String 	getSavepointName() throws SQLException;
+    	
+} // end interface Savepoint
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Statement.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Statement.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Statement.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Statement.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,621 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+/**
+ * Interface used for executing static SQL statements and returning their
+ * results.
+ * 
+ * By default, an object implementing the Statement interface can returns
+ * results as ResultSets. For any given Statement object, only one ResultSet can
+ * be open at one time. A call to any of the execution methods of Statement will
+ * cause any previously created ResultSet object for that Statement to be closed
+ * implicitly.
+ * <p>
+ * To have multiple ResultSet objects open concurrently, multiple Statement
+ * objects must be used.
+ * 
+ */
+public interface Statement {
+
+	/**
+	 * Passing this constant to getMoreResults implies that all ResultSet
+	 * objects previously kept open should be closed.
+	 */
+	public static final int CLOSE_ALL_RESULTS = 3;
+
+	/**
+	 * Passing this constant to getMoreResults implies that the current
+	 * ResultSet object should be closed
+	 */
+	public static final int CLOSE_CURRENT_RESULT = 1;
+
+	/**
+	 * Indicates that an error was encountered during execution of a batch
+	 * statement.
+	 */
+	public static final int EXECUTE_FAILED = -3;
+
+	/**
+	 * Passing this constant to getMoreResults implies that the current
+	 * ResultSet object should not be closed.
+	 */
+	public static final int KEEP_CURRENT_RESULT = 2;
+
+	/**
+	 * Indicates that generated keys should not be accessible for retrieval.
+	 */
+	public static final int NO_GENERATED_KEYS = 2;
+
+	/**
+	 * Indicates that generated keys should be accessible for retrieval.
+	 */
+	public static final int RETURN_GENERATED_KEYS = 1;
+
+	/**
+	 * Indicates that a batch statement was executed with a successful result,
+	 * but a count of the number of rows it affected is unavailable.
+	 */
+	public static final int SUCCESS_NO_INFO = -2;
+
+	/**
+	 * Adds a specified SQL commands to the list of commands for this Statement.
+	 * <p>
+	 * The list of commands is executed by invoking the
+	 * <code>executeBatch</code> method.
+	 * 
+	 * @param sql
+	 *            the SQL command as a String. Typically an INSERT or UPDATE
+	 *            statement.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or the database
+	 *             does not support batch updates
+	 */
+	public void addBatch(String sql) throws SQLException;
+
+	/**
+	 * Cancels this Statement execution if both the database and the JDBC driver
+	 * support aborting an SQL statement in flight. This method can be used by
+	 * one thread to stop a Statement that is being executed on another thread.
+	 * 
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public void cancel() throws SQLException;
+
+	/**
+	 * Clears the current list of SQL commands for this Statement.
+	 * 
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or the database
+	 *             does not support batch updates
+	 */
+	public void clearBatch() throws SQLException;
+
+	/**
+	 * Clears all SQLWarnings from this Statement.
+	 * 
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public void clearWarnings() throws SQLException;
+
+	/**
+	 * Releases this Statement's database and JDBC driver resources.
+	 * <p>
+	 * Using this method to release these resources as soon as possible is
+	 * strongly recommended. It is not a good idea to rely on these resources
+	 * being released when the Statement object is finalized during garbage
+	 * collection. Doing so can result in unpredictable performance
+	 * characteristics for the application.
+	 * 
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public void close() throws SQLException;
+
+	/**
+	 * Executes a supplied SQL statement. This may return multiple ResultSets.
+	 * <p>
+	 * Use the <code>getResultSet</code> or <code>getUpdateCount</code>
+	 * methods to get the first result and <code>getMoreResults</code> to get
+	 * any subsequent results.
+	 * 
+	 * @param sql
+	 *            the SQL statement to execute
+	 * @return true if the first result is a ResultSet, false if the first
+	 *         result is an update count or if there is no result
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public boolean execute(String sql) throws SQLException;
+
+	/**
+	 * Executes a supplied SQL statement. This may return multiple ResultSets.
+	 * This method allows control of whether auto-generated Keys should be made
+	 * available for retrieval, if the SQL statement is an INSERT statement.
+	 * <p>
+	 * Use the <code>getResultSet</code> or <code>getUpdateCount</code>
+	 * methods to get the first result and <code>getMoreResults</code> to get
+	 * any subsequent results.
+	 * 
+	 * @param sql
+	 *            the SQL statement to execute
+	 * @param autoGeneratedKeys
+	 *            a flag indicating whether to make auto generated keys
+	 *            available for retrieval. This parameter must be one of
+	 *            Statement.NO_GENERATED_KEYS or Statement.RETURN_GENERATED_KEYS
+	 * @return true if results exists and the first result is a ResultSet, false
+	 *         if the first result is an update count or if there is no result
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public boolean execute(String sql, int autoGeneratedKeys)
+			throws SQLException;
+
+	/**
+	 * Executes the supplied SQL statement. This may return multiple ResultSets.
+	 * This method allows retrieval of auto generated keys specified by the
+	 * supplied array of column indexes, if the SQL statement is an INSERT
+	 * statement.
+	 * <p>
+	 * Use the <code>getResultSet</code> or <code>getUpdateCount</code>
+	 * methods to get the first result and <code>getMoreResults</code> to get
+	 * any subsequent results.
+	 * 
+	 * @param sql
+	 *            the SQL statement to execute
+	 * @param columnIndexes
+	 *            an array of indexes of the columns in the inserted row which
+	 *            should be made available for retrieval via the
+	 *            <code>getGeneratedKeys</code> method.
+	 * @return true if the first result is a ResultSet, false if the first
+	 *         result is an update count or if there is no result
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public boolean execute(String sql, int[] columnIndexes) throws SQLException;
+
+	/**
+	 * Executes the supplied SQL statement. This may return multiple ResultSets.
+	 * This method allows retrieval of auto generated keys specified by the
+	 * supplied array of column indexes, if the SQL statement is an INSERT
+	 * statement.
+	 * <p>
+	 * Use the <code>getResultSet</code> or <code>getUpdateCount</code>
+	 * methods to get the first result and <code>getMoreResults</code> to get
+	 * any subsequent results.
+	 * 
+	 * @param sql
+	 *            the SQL statement to execute
+	 * @param columnNames
+	 *            an array of column names in the inserted row which should be
+	 *            made available for retrieval via the
+	 *            <code>getGeneratedKeys</code> method.
+	 * @return true if the first result is a ResultSet, false if the first
+	 *         result is an update count or if there is no result
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public boolean execute(String sql, String[] columnNames)
+			throws SQLException;
+
+	/**
+	 * Submits a batch of SQL commands to the database. Returns an array of
+	 * update counts, if all the commands execute successfully.
+	 * <p>
+	 * If one of the commands in the batch fails, this method can throw a
+	 * BatchUpdateException and the JDBC driver may or may not process the
+	 * remaining commands. The JDBC driver must behave consistently with the
+	 * underlying database, either always continuing or never continuing. If the
+	 * driver continues processing, the array of results returned contains the
+	 * same number of elements as there are commands in the batch, with a
+	 * minimum of one of the elements having the EXECUTE_FAILED value.
+	 * 
+	 * @return an array of update counts, with one entry for each command in the
+	 *         batch. The elements are ordered according to the order in which
+	 *         the commands were added to the batch.
+	 *         <p>
+	 *         <ol>
+	 *         <li> If the value of an element is >=0, the corresponding command
+	 *         completed successfully and the value is the update count for that
+	 *         command, which is the number of rows in the database affected by
+	 *         the command.</li>
+	 *         <li> If the value is SUCCESS_NO_INFO, the command completed
+	 *         successfully but the number of rows affected is unknown.
+	 *         <li>
+	 *         <li> If the value is EXECUTE_FAILED, the command failed.
+	 *         </ol>
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public int[] executeBatch() throws SQLException;
+
+	/**
+	 * Executes a supplied SQL statement. Returns a single ResultSet.
+	 * 
+	 * @param sql
+	 *            an SQL statement to execute. Typically a SELECT statement
+	 * @return a ResultSet containing the data produced by the SQL statement.
+	 *         Never null.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or if the statement
+	 *             produces anything other than a single ResultSet
+	 */
+	public ResultSet executeQuery(String sql) throws SQLException;
+
+	/**
+	 * Executes the supplied SQL statement. The statement may be an INSERT,
+	 * UPDATE or DELETE statement or a statement which returns nothing.
+	 * 
+	 * @param sql
+	 *            an SQL statement to execute - an SQL INSERT, UPDATE, DELETE or
+	 *            a statement which returns nothing
+	 * @return the count of updated rows, or 0 for a statement that returns
+	 *         nothing.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or if the statement
+	 *             produces a ResultSet
+	 */
+	public int executeUpdate(String sql) throws SQLException;
+
+	/**
+	 * Executes the supplied SQL statement. This method allows control of
+	 * whether auto-generated Keys should be made available for retrieval.
+	 * 
+	 * @param sql
+	 *            an SQL statement to execute - an SQL INSERT, UPDATE, DELETE or
+	 *            a statement which does not return anything.
+	 * @param autoGeneratedKeys
+	 *            a flag that indicates whether to allow retrieval of auto
+	 *            generated keys. Parameter must be one of
+	 *            Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
+	 * @return the number of updated rows, or 0 if the statement returns
+	 *         nothing.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or if the statement
+	 *             produces a ResultSet
+	 */
+	public int executeUpdate(String sql, int autoGeneratedKeys)
+			throws SQLException;
+
+	/**
+	 * Executes the supplied SQL statement. This method allows retrieval of auto
+	 * generated keys specified by the supplied array of column indexes.
+	 * 
+	 * @param sql
+	 *            an SQL statement to execute - an SQL INSERT, UPDATE, DELETE or
+	 *            a statement which returns nothing
+	 * @param columnIndexes
+	 *            an array of indexes of the columns in the inserted row which
+	 *            should be made available for retrieval via the
+	 *            <code>getGeneratedKeys</code> method.
+	 * @return the count of updated rows, or 0 for a statement that returns
+	 *         nothing.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or if the statement
+	 *             produces a ResultSet
+	 */
+	public int executeUpdate(String sql, int[] columnIndexes)
+			throws SQLException;
+
+	/**
+	 * Executes the supplied SQL statement. This method allows retrieval of auto
+	 * generated keys specified by the supplied array of column names.
+	 * 
+	 * @param sql
+	 *            an SQL statement to execute - an SQL INSERT, UPDATE, DELETE or
+	 *            a statement which returns nothing
+	 * @param columnNames
+	 *            an array of column names in the inserted row which should be
+	 *            made available for retrieval via the
+	 *            <code>getGeneratedKeys</code> method.
+	 * @return the count of updated rows, or 0 for a statement that returns
+	 *         nothing.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or if the statement
+	 *             produces a ResultSet
+	 */
+	public int executeUpdate(String sql, String[] columnNames)
+			throws SQLException;
+
+	/**
+	 * Gets the Connection that produced this Statement.
+	 * 
+	 * @return the Connection
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public Connection getConnection() throws SQLException;
+
+	/**
+	 * Gets the default direction for fetching rows for ResultSets generated
+	 * from this Statement.
+	 * 
+	 * @return an integer describing the default fetch direction, one of:
+	 *         ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE,
+	 *         ResultSet.FETCH_UNKNOWN
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public int getFetchDirection() throws SQLException;
+
+	/**
+	 * Gets the default number of rows for a fetch for the ResultSet objects
+	 * returned from this Statement.
+	 * 
+	 * @return the default fetch size for ResultSets produced by this Statement
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public int getFetchSize() throws SQLException;
+
+	/**
+	 * Returns auto generated keys created by executing this Statement.
+	 * 
+	 * @return a ResultSet containing the auto generated keys - empty if no keys
+	 *         were generated by the Statement
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public ResultSet getGeneratedKeys() throws SQLException;
+
+	/**
+	 * Gets the maximum number of bytes which can be returned for values from
+	 * Character and Binary values in a ResultSet derived from this Statement.
+	 * This limit applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR,
+	 * and LONGVARCHAR types. Any data exceeding the maximum size is abandoned
+	 * without announcement.
+	 * 
+	 * @return the current size limit, where 0 means that there is no limit
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public int getMaxFieldSize() throws SQLException;
+
+	/**
+	 * Gets the maximum number of rows that a ResultSet can contain when
+	 * produced from this Statement. If the limit is exceeded, the excess rows
+	 * are discarded silently.
+	 * 
+	 * @return the current row limit, where 0 means that there is no limit.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public int getMaxRows() throws SQLException;
+
+	/**
+	 * Moves to this Statement's next result. Returns true if it is a ResultSet.
+	 * Any current ResultSet objects previously obtained with
+	 * <code>getResultSet()</code> are closed implicitly.
+	 * 
+	 * @return true if the next result is a ResultSet, false if the next result
+	 *         is not a ResultSet or if there are no more results. Note that if
+	 *         there is no more data, this method will return false and
+	 *         <code>getUpdateCount</code> will return -1.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public boolean getMoreResults() throws SQLException;
+
+	/**
+	 * Moves to this Statement's next result. Returns true if the next result is
+	 * a ResultSet. Any current ResultSet objects previously obtained with
+	 * <code>getResultSet()</code> are handled as indicated by a supplied Flag
+	 * parameter.
+	 * 
+	 * @param current
+	 *            a flag indicating what to do with existing ResultSets. This
+	 *            parameter must be one of Statement.CLOSE_ALL_RESULTS,
+	 *            Statement.CLOSE_CURRENT_RESULT or
+	 *            Statement.KEEP_CURRENT_RESULT.
+	 * @return true if the next result exists and is a ResultSet, false if the
+	 *         next result is not a ResultSet or if there are no more results.
+	 *         Note that if there is no more data, this method will return false
+	 *         and <code>getUpdateCount</code> will return -1.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public boolean getMoreResults(int current) throws SQLException;
+
+	/**
+	 * Gets the timeout value for Statement execution. The JDBC driver will wait
+	 * up to this value for the execution to complete - after the limit is
+	 * exceeded an SQL Exception is thrown.
+	 * 
+	 * @return the current Query Timeout value, where 0 indicates that there is
+	 *         no current timeout.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public int getQueryTimeout() throws SQLException;
+
+	/**
+	 * Gets the current result. Should only be called once per result.
+	 * 
+	 * @return the ResultSet for the current result. null if the result is an
+	 *         update count or if there are no more results.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public ResultSet getResultSet() throws SQLException;
+
+	/**
+	 * Gets the concurrency setting for ResultSet objects generated by this
+	 * Statement.
+	 * 
+	 * @return ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public int getResultSetConcurrency() throws SQLException;
+
+	/**
+	 * Gets the cursor hold setting for ResultSet objects generated by this
+	 * Statement.
+	 * 
+	 * @return ResultSet.HOLD_CURSORS_OVER_COMMIT or
+	 *         ResultSet.CLOSE_CURSORS_AT_COMMIT
+	 * @throws SQLException
+	 *             if there is an error while accessing the database
+	 */
+	public int getResultSetHoldability() throws SQLException;
+
+	/**
+	 * Gets the ResultSet type setting for ResultSets derived from this
+	 * Statement.
+	 * 
+	 * @return ResultSet.TYPE_FORWARD_ONLY for a ResultSet where the cursor can
+	 *         only move forward, ResultSet.TYPE_SCROLL_INSENSITIVE for a
+	 *         ResultSet which is Scrollable but is not sensitive to changes
+	 *         made by others, ResultSet.TYPE_SCROLL_SENSITIVE for a ResultSet
+	 *         which is Scrollable but is sensitive to changes made by others
+	 * @throws SQLException
+	 *             if there is an error accessing the database
+	 */
+	public int getResultSetType() throws SQLException;
+
+	/**
+	 * Gets an update count for the current result if it is not a ResultSet.
+	 * 
+	 * @return the current result as an update count. -1 if the current result
+	 *         is a ResultSet or if there are no more results
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public int getUpdateCount() throws SQLException;
+
+	/**
+	 * Retrieves the first SQLWarning reported by calls on this Statement.
+	 * <p>
+	 * If there are multiple warnings, subsequent warnings are chained to the
+	 * first one.
+	 * <p>
+	 * The chain or warnings is cleared each time the Statement is executed.
+	 * <p>
+	 * Warnings associated with reads from the ResultSet returned from executing
+	 * a Statement will be attached to the ResultSet, not the Statement object.
+	 * 
+	 * @return an SQLWarning, null if there are no warnings
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public SQLWarning getWarnings() throws SQLException;
+
+	/**
+	 * Sets the SQL cursor name. This name is used by subsequent Statement
+	 * execute methods.
+	 * <p>
+	 * Cursor names must be unique within one Connection.
+	 * <p>
+	 * With the Cursor name set, it can then be utilised in SQL positioned
+	 * update or delete statements to determine the current row in a ResultSet
+	 * generated from this Statement. The positioned update or delete must be
+	 * done with a different Statement than this one.
+	 * 
+	 * @param name
+	 *            the Cursor name as a String,
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public void setCursorName(String name) throws SQLException;
+
+	/**
+	 * Sets Escape Processing mode.
+	 * <p>
+	 * If Escape Processing is on, the JDBC driver will do escape substitution
+	 * on an SQL statement before sending it for execution. This does not apply
+	 * to PreparedStatements since they are processed when created, before this
+	 * method can be called.
+	 * 
+	 * @param enable
+	 *            true to set escape processing mode on, false to turn it off.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database
+	 */
+	public void setEscapeProcessing(boolean enable) throws SQLException;
+
+	/**
+	 * Sets the fetch direction - a hint to the JDBC driver about the direction
+	 * of processing of rows in ResultSets created by this Statement. The
+	 * default fetch direction is FETCH_FORWARD.
+	 * 
+	 * @param direction
+	 *            which fetch direction to use. This parameter should be one of
+	 *            ResultSet.FETCH_UNKNOWN, ResultSet.FETCH_FORWARD or
+	 *            ResultSet.FETCH_REVERSE
+	 * @throws SQLException
+	 *             if there is an error while accessing the database or if the
+	 *             fetch direction is unrecognised
+	 */
+	public void setFetchDirection(int direction) throws SQLException;
+
+	/**
+	 * Sets the fetch size. This is a hint to the JDBC driver about how many
+	 * rows should be fetched from the database when more are required by
+	 * application processing.
+	 * 
+	 * @param rows
+	 *            the number of rows that should be fetched. 0 tells the driver
+	 *            to ignore the hint. Should be less than
+	 *            <code>getMaxRows</code> for this statement. Should not be
+	 *            negative.
+	 * @throws SQLException
+	 *             if an error occurs accessing the database, or if the rows
+	 *             parameter is out of range.
+	 */
+	public void setFetchSize(int rows) throws SQLException;
+
+	/**
+	 * Sets the maximum number of bytes for ResultSet columns that contain
+	 * character or binary values. This applies to BINARY, VARBINARY,
+	 * LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. Any data exceeding
+	 * the maximum size is abandoned without announcement.
+	 * 
+	 * @param max
+	 *            the maximum field size in bytes. O means "no limit".
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or the max value is
+	 *             <0.
+	 */
+	public void setMaxFieldSize(int max) throws SQLException;
+
+	/**
+	 * Sets the maximum number of rows that any ResultSet can contain. If the
+	 * number of rows exceeds this value, the additional rows are silently
+	 * discarded.
+	 * 
+	 * @param max
+	 *            the maximum number of rows. 0 means "no limit".
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or if max <0.
+	 */
+	public void setMaxRows(int max) throws SQLException;
+
+	/**
+	 * Sets the timeout, in seconds, for queries - how long the driver will
+	 * allow for completion of a Statement execution. If the timeout is
+	 * exceeded, the query will throw an SQLException.
+	 * 
+	 * @param seconds
+	 *            timeout in seconds. 0 means no timeout ("wait forever")
+	 * @throws SQLException
+	 *             if an error occurs accessing the database or if seconds <0.
+	 */
+	public void setQueryTimeout(int seconds) throws SQLException;
+
+} // end interface Statement
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Struct.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Struct.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Struct.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Struct.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,66 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+import java.util.Map;
+
+/**
+ * An interface which provides facilities for mapping an SQL structured type to
+ * Java. The Struct object has a value for each attribute of the SQL structured
+ * type
+ * 
+ */
+public interface Struct {
+
+	/**
+	 * Gets the SQL Type name of the SQL structured type that this Struct
+	 * represents
+	 * 
+	 * @return the fully qualified name of SQL structured type
+	 * @throws SQLException
+	 *             if a database error occurs
+	 */
+	public String getSQLTypeName() throws SQLException;
+
+	/**
+	 * Gets the values of the attributes of this SQL structured type. This
+	 * method uses the type map associated with the Connection for customized
+	 * type mappings. Where there is no entry in the Type Map which matches the
+	 * this structured type, the JDBC driver uses the standard mapping.
+	 * 
+	 * @return an Object array containing the attributes, in order
+	 * @throws SQLException
+	 *             if a database error occurs
+	 */
+	public Object[] getAttributes() throws SQLException;
+
+	/**
+	 * Gets the values of the attributes of this SQL structured type. This
+	 * method uses the supplied type map for customized type mappings. Where
+	 * there is no entry in the Type Map which matches the this structured type,
+	 * the JDBC driver uses the default mapping. The Connection type map is
+	 * never utilised by this method.
+	 * 
+	 * @param theMap
+	 *            a Map describing how SQL Type names are mapped to classes.
+	 * @return an Object array containing the attributes, in order
+	 * @throws SQLException
+	 *             if a database error occurs
+	 */
+	public Object[] getAttributes(Map theMap) throws SQLException;
+
+} // end interface Struct
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,199 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package java.sql;
+
+import java.io.Serializable;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Java representation of an SQL TIME value.  Provides functions to aid generation and
+ * interpretation of JDBC escape format for time values.
+ * 
+ */
+public class Time extends Date implements Serializable, Cloneable, Comparable {
+	
+	private static final long serialVersionUID = 8397324403548013681L;
+
+	/**
+	 * @deprecated Please use the constructor Time( long )
+	 * Constructs a Time object using the supplied values for Hour, Minute and Second.
+	 * The Year, Month and Day elements of the Time object are set to 1970, January, 1
+	 * reflecting the Epoch (Time in milliseconds = 0).
+	 * <p>
+	 * Any attempt to access the Year, Month or Day elements of a Time object will result in
+	 * an IllegalArgumentException.
+	 * <p>
+	 * Result is undefined if any argument is out of bounds.
+	 * @param theHour a value from 0 - 23
+	 * @param theMinute a value from 0 - 59
+	 * @param theSecond a value from 0 - 59
+	 */
+	public Time( int theHour, int theMinute, int theSecond ) {
+		super( 70, 0, 1, theHour, theMinute, theSecond );
+	} // end method Time(int, int, int)
+	
+	/**
+	 * Constructs a Time object using a supplied time specified in milliseconds
+	 * @param theTime a Time specified in milliseconds since the Epoch (January 1st 1970, 00:00:00.000)
+	 */
+	public Time( long theTime ) {
+		super( theTime );
+		// System.out.println("Clear version of java.sql.Time");
+	} // end method Time( long )
+	
+	/**
+	 * @deprecated
+	 * This method is deprecated and must not be used.  An SQL Time object does not have a
+	 * Date component.	 
+	 * @return 0
+	 * @throws IllegalArgumentException if this method is called
+	 */
+	public int getDate() {
+		if( true ) {
+			throw new IllegalArgumentException();
+		} // end if
+		return 0;
+	} // end method getDate()
+    
+	/**
+	 * @deprecated
+	 * This method is deprecated and must not be used.  An SQL Time object does not have a
+	 * Day component.
+	 * @return 0
+	 * @throws IllegalArgumentException if this method is called
+	 */
+	public int getDay() {
+		if( true ) {
+			throw new IllegalArgumentException();
+		} // end if
+		return 0;
+	} // end method getDay()
+    
+	/**
+	 * @deprecated
+	 * This method is deprecated and must not be used.  An SQL Time object does not have a
+	 * Month component.	 
+	 * @return 0
+	 * @throws IllegalArgumentException if this method is called
+	 */
+	public int getMonth() {
+		if( true ) {
+			throw new IllegalArgumentException();
+		} // end if
+		return 0;
+	} // end method getMonth()
+    
+	/**
+	 * @deprecated	 
+	 * This method is deprecated and must not be used.  An SQL Time object does not have a
+	 * Year component.	 
+	 * @return 0
+	 * @throws IllegalArgumentException if this method is called
+	 */
+	public int getYear() {
+		if( true ) {
+			throw new IllegalArgumentException();
+		} // end if
+		return 0;
+	} // end method getYear()
+	
+    /**
+     * @deprecated
+     * This method is deprecated and must not be used.  An SQL Time object does not have a
+	 * Date component.	 
+	 * @throws IllegalArgumentException if this method is called
+     */
+	public void setDate(int i) {
+		if( true ) {
+			throw new IllegalArgumentException();
+		} // end if
+	} // end method setDate( int )
+	
+    /**
+     * @deprecated     
+     * This method is deprecated and must not be used.  An SQL Time object does not have a
+	 * Month component.	 
+	 * @throws IllegalArgumentException if this method is called
+     */
+	public void setMonth(int i) {
+		if( true ) {
+			throw new IllegalArgumentException();
+		} // end if
+	} // end method setMonth( int )
+	
+	/**
+	 * @deprecated     
+	 * This method is deprecated and must not be used.  An SQL Time object does not have a
+	 * Year component.	 
+	 * @throws IllegalArgumentException if this method is called
+	 */
+    public void setYear(int i) {
+		if( true ) {
+			throw new IllegalArgumentException();
+		} // end if
+    } // end method setYear( int )
+    
+	/**
+	 * Sets the time for this Time object to the supplied milliseconds value.
+	 * @param time A time value expressed as milliseconds since the Epoch.  Negative values are milliseconds 
+	 * before the Epoch.  The Epoch is January 1 1970, 00:00:00.000
+	 */
+    public void setTime(long time) {
+    	super.setTime( time );
+    } // end method setTime( long )
+    
+    /**
+     * Formats the Time as a String in JDBC escape format: hh:mm:ss
+     * @return A String representing the Time value in JDBC escape format: HH:mm:ss
+     */
+    public String toString() {
+		SimpleDateFormat dateFormat = new SimpleDateFormat( "HH:mm:ss" );
+		
+		return dateFormat.format( this );
+    } // end method toString()
+    
+    /**
+     * Creates a Time object from a String holding a time represented in JDBC escape
+     * format:  hh:mm:ss.
+     * <p>
+     * An exception occurs if the input string is not in the form of a time in JDBC escape
+     * format.
+     * @param theTime A String representing the time value in JDBC escape format:  hh:mm:ss
+     * @return The Time object set to a time corresponding to the given time
+     * @throws IllegalArgumentException is the supplied time string is not in JDBC escape
+     * format.
+     */
+    public static Time valueOf( String theTime ) {
+		java.util.Date aDate;
+		
+		if( theTime == null ) throw new IllegalArgumentException();
+		
+		SimpleDateFormat dateFormat = new SimpleDateFormat( "HH:mm:ss" );
+		try {
+			aDate = dateFormat.parse( theTime );
+		} catch( ParseException pe ) {
+			throw new IllegalArgumentException();
+		} // end try
+		
+		return new Time( aDate.getTime() );
+    } // end method valueOf( String )
+
+} // end class Time
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,354 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package java.sql;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.io.Serializable;
+import java.lang.IllegalArgumentException;
+import java.text.DecimalFormat;
+import java.text.ParsePosition;
+
+/**
+ * A Java representation of the SQL TIMESTAMP type.  It provides the capability to represent
+ * the SQL TIMESTAMP nanosecond value, in addition to the regular date/time value which has
+ * millisecond resolution.
+ * <p>
+ * The Timestamp class consists of a regular Date/Time value, where only the integral seconds
+ * value is stored, plus a nanoseconds value where the fractional seconds are stored.
+ * <p>
+ * The addition of the nanosecond value field to the Timestamp object makes it significantly
+ * different from the java.util.Date object which it extends.  Users should be cautious in 
+ * their use of Timestamp objects and should not assume that they are interchangeable with
+ * java.util.Date objects when used outside the confines of the java.sql package.  
+ * 
+ */
+public class Timestamp extends Date implements Serializable, Cloneable, Comparable {
+	
+	private static final long serialVersionUID = 2745179027874758501L;
+	
+	// The nanoseconds time value of the Timestamp
+	private int nanoseconds;
+
+	/**
+	 * @deprecated Please use the constructor Timestamp( long )
+	 * Returns a Timestamp corresponding to the time specified by the supplied values for Year, Month,
+	 * Date, Hour, Minutes, Seconds and Nanoseconds 
+	 * @param theYear specified as the year minus 1900
+	 * @param theMonth specified as an integer in the range 0 - 11
+	 * @param theDate specified as an integer in the range 1 - 31
+	 * @param theHour specified as an integer in the range 0 - 23
+	 * @param theMinute specified as an integer in the range 0 - 59
+	 * @param theSecond specified as an integer in the range 0 - 59
+	 * @param theNano which defines the nanosecond value of the timestamp specified as an integer
+	 * in the range 0 - 999,999,999
+	 * @throws IllegalArgumentException if any of the parameters is out of range
+	 */
+	public Timestamp( int theYear, int theMonth, int theDate, int theHour, 
+					  int theMinute, int theSecond, int theNano ) 
+					  throws IllegalArgumentException {
+ 		super( theYear, theMonth, theDate, theHour, theMinute, theSecond );
+ 		if( theNano < 0 || theNano > 999999999 ) throw new IllegalArgumentException();		
+		nanoseconds = theNano;
+	} // end method Timestamp( int, int, int, int, int, int )
+	
+	/**
+	 * Returns a Timestamp object corresponding to the time represented by a supplied time value.
+	 * 
+	 * @param theTime a time value in the format of milliseconds since the Epoch 
+	 * (January 1 1970 00:00:00.000 GMT)
+	 */
+	public Timestamp(long theTime) {
+		super( theTime );
+		// Now set the time for this Timestamp object - which deals with the nanosecond value
+		// as well as the base time
+		this.setTime( theTime );
+		// System.out.println("Clear version of java.sql.Timestamp");
+	} // end method Timestamp( long )
+	
+	/**
+	 * Returns true if this timestamp object is later than the supplied timestamp,
+	 * otherwise returns false.
+	 * @param theTimestamp the timestamp to compare with this timestamp object
+	 * @return true if this timestamp object is later than the supplied timestamp, false
+	 * otherwise
+	 */
+	public boolean after( Timestamp theTimestamp ) {
+		long thisTime = this.getTime();
+		long compareTime = theTimestamp.getTime();
+		
+		// If the time value is later, the timestamp is later
+		if ( thisTime > compareTime ) { return true; }
+		// If the time value is earlier, the timestamp is not later
+		else if ( thisTime < compareTime ) { return false; }
+		// Otherwise the time values are equal in which case the nanoseconds value
+		// determines whether this timestamp is later...
+		else if ( this.getNanos() > theTimestamp.getNanos() ) { return true; }
+		else { return false; } // end if
+		
+	} // end method after( Timestamp )
+    
+	/**
+	 * Returns true if this timestamp object is earlier than the supplied timestamp,
+	 * otherwise returns false.
+	 * @param theTimestamp the timestamp to compare with this timestamp object
+	 * @return true if this timestamp object is earlier than the supplied timestamp, false
+	 * otherwise
+	 */
+	public boolean before( Timestamp theTimestamp ) {
+		long thisTime = this.getTime();
+		long compareTime = theTimestamp.getTime();
+		
+		// If the time value is later, the timestamp is later
+		if ( thisTime < compareTime ) { return true; }
+		// If the time value is earlier, the timestamp is not later
+		else if ( thisTime > compareTime ) { return false; }
+		// Otherwise the time values are equal in which case the nanoseconds value
+		// determines whether this timestamp is later...
+		else if ( this.getNanos() < theTimestamp.getNanos() ) { return true; }
+		else { return false; } // end if
+		
+	} // end method before( Timestamp )
+    
+	/**
+	 * Compares this Timestamp object with a supplied Timestamp object
+	 * @param theObject the timestamp to compare with this timestamp object, passed in as an Object
+	 * @return 0 if the two Timestamp objects are equal in time, a value <0 if this Timestamp object is
+	 * before the supplied Timestamp and a value >0 if this Timestamp object is after the supplied
+	 * Timestamp
+	 * @throws ClassCastException if the supplied object is not a Timestamp object
+	 */
+	public int	compareTo( Object theObject ) throws ClassCastException {
+		return this.compareTo( (Timestamp) theObject );
+	} // end method compareTo( Object )
+    
+	/**
+	 * Compares this Timestamp object with a supplied Timestamp object
+	 * @param theTimestamp the timestamp to compare with this timestamp object, passed in as a Timestamp
+	 * @return 0 if the two Timestamp objects are equal in time, a value <0 if this Timestamp object is
+	 * before the supplied Timestamp and a value >0 if this Timestamp object is after the supplied
+	 * Timestamp
+	 */
+	public int compareTo( Timestamp theTimestamp ) {
+		if ( this.before( theTimestamp ) ) { return -1; }
+		else if ( this.after( theTimestamp ) ) { return +1; }
+		else return 0;
+	} // end method compareTo( Timestamp )
+	
+	/**
+	 * Tests to see if this timestamp is equal to a supplied object.
+	 * @param theObject 
+	 * @return true if this Timestamp object is equal to the supplied Timestamp object
+	 * false if the object is not a Timestamp object or if the object is a Timestamp but
+	 * represents a different instant in time
+	 */
+    public boolean equals( Object theObject ) {
+    	Timestamp theTimestamp;
+    	try {
+    		theTimestamp = (Timestamp) theObject;
+    	} catch (ClassCastException e) {
+    		return false;
+    	} // end 
+    	return this.equals( (Timestamp) theTimestamp );
+    } // end method equals( Object )
+    
+	/**
+	 * Tests to see if this timestamp is equal to a supplied timestamp.
+	 * @param theTimestamp the timestamp to compare with this timestamp object, passed in as an Object
+	 * @return true if this Timestamp object is equal to the supplied Timestamp object
+	 */
+    public boolean equals( Timestamp theTimestamp ) {
+    	if( (this.getTime() == theTimestamp.getTime()) && (this.getNanos() == theTimestamp.getNanos()) ) {
+    		return true;
+    	} else {
+    		return false;
+    	}
+    } // end method equals( Timestamp )
+    
+    /**
+     * Gets this Timestamp's nanosecond value
+     * @return The timestamp's nanosecond value, an integer between 0 and 999,999,999
+     */
+    public int getNanos() {
+    	return nanoseconds;
+    } // end method getNanos()
+    
+    /**
+     * Returns the time represented by this Timestamp object, as a long value containing the number of
+     * milliseconds since the Epoch (January 1 1970, 00:00:00.000 GMT)
+     */
+    public long getTime() {
+    	long theTime = super.getTime();
+    	theTime = theTime + (long)(nanoseconds / 1000000 );
+    	return theTime;
+    } // end method getTime()
+    
+    /**
+     * Sets the nanosecond value for this timestamp
+     */
+    public void setNanos(int n) throws IllegalArgumentException {
+    	if ( (n < 0) || (n > 999999999 ) ) throw new IllegalArgumentException("Nanos value out of range.");
+    	nanoseconds = n;
+    } // end method setNanos( int )
+    
+    /**
+     * Sets the time represented by this Timestamp object to the supplied time, defined as the number
+     * of milliseconds since the Epoch (January 1 1970, 00:00:00.000 GMT)
+     */
+    public void setTime(long theTime) {
+		// Deal with the nanoseconds value.  The supplied time is in milliseconds - so we must
+		// extract the milliseconds value and multiply by 1000000 to get nanoseconds.
+		// Things are more complex if theTime value is negative, since then the time
+		// value is the time before the Epoch but the nanoseconds value of the Timestamp must
+		// be positive - so we must take the "raw" milliseconds value and subtract it from
+		// 1000 to get to the true nanoseconds value
+		// Simultaneously, recalculate the time value to the exact nearest second and reset 
+		// the Date time value
+		int milliseconds = (int)(theTime % 1000);
+		theTime = theTime - milliseconds;
+		if ( milliseconds < 0 ) {
+			theTime = theTime - 1000;
+			milliseconds = 1000 + milliseconds;	
+		} // end if
+		super.setTime( theTime );
+		setNanos( milliseconds * 1000000 );
+    } // end method setTime( long )
+    
+    /**
+     * Returns the timestamp formatted as a String in the JDBC Timestamp Escape format, which is of the
+     * form "yyyy-mm-dd hh:mm:ss.nnnnnnnnn"
+     * @return A string representing the instant defined by the Timestamp, in JDBC Timestamp 
+     * escape format
+     */
+    public String toString() {
+    	// A SimpleDateFormat will lay out everything except the nanosecond value
+		SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
+		
+		// Use a DecimalFormat to lay out the nanosecond value as a simple string of
+		// 9 integers, with leading Zeros
+		DecimalFormat decimalFormat = new DecimalFormat("0");
+		decimalFormat.setMinimumIntegerDigits( 9 );
+		decimalFormat.setMaximumIntegerDigits( 9 );
+		String theNanos = decimalFormat.format( (long) nanoseconds ); 
+		theNanos = stripTrailingZeros( theNanos );
+		// Concatenate the nanosecond value with a dot - and return
+		return (dateFormat.format( this ) + '.' + theNanos);
+    } // end method toString()
+    
+    /*
+     * Private method to strip trailing '0' characters from a string.
+     * @param inputString the starting string
+     * @return a string with the trailing zeros stripped - will leave
+     * a single 0 at the beginning of the string 
+     */
+    private String stripTrailingZeros( String inputString ) {
+    	String finalString;
+    	
+    	int i;
+    	for( i = inputString.length(); i > 0 ; i-- ) {
+    		if( inputString.charAt(i-1) != '0' ) break;
+    		// If the string has a 0 as its first character, return
+    		// a string with a single '0'
+    		if ( i == 1 ) return "0";
+    	} // end for
+    	
+    	finalString = inputString.substring(0, i);
+    	return finalString;
+    } // end stripTrailingZeros( String )
+    
+    private static String	valueOfExceptionMessage = 
+    	"Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff";
+    /**
+     * Creates a Timestamp object with a time value equal to the time specified by a supplied String
+     * holding the time in JDBC timestamp escape format, which is of the form
+     * "yyyy-mm-dd hh:mm:ss.nnnnnnnnn"
+     * @param s the String containing a time in JDBC timestamp escape format
+     * @return A timestamp object with time value as defined by the supplied String
+     */
+    public static Timestamp valueOf( String s ) throws IllegalArgumentException {
+    	if( s == null ) throw new IllegalArgumentException("null string");
+    	
+    	SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    	ParsePosition pp = new ParsePosition( 0 );
+    	
+    	// First parse out the yyyy-MM-dd HH:mm:ss component of the String into a Date object
+    	// using the SimpleDateFormat.  This should stop after the seconds value, according to
+    	// the definition of SimpleDateFormat.parse, with the ParsePosition indicating the
+    	// index of the "." which should precede the nanoseconds value
+    	Date theDate;
+    	try {
+    		theDate = df.parse( s, pp );
+    	} catch (Exception e) {
+    		throw new IllegalArgumentException(valueOfExceptionMessage);
+    	} // end try
+    	
+    	if( theDate == null ) throw new IllegalArgumentException(valueOfExceptionMessage);
+    	
+    	/* If we get here, the Date part of the string was OK - now for the nanoseconds
+    	 * value.  Strictly, this requires the remaining part of the String to look like
+    	 * ".nnnnnnnnn".  However, we accept anything with a '.' followed by 1 to 9
+    	 * digits - we also accept nothing (no fractions of a second).
+    	 * Anything else is interpreted as incorrect format which will
+    	 * generate an IllegalArgumentException
+    	 */
+    	int position = pp.getIndex();
+    	int remaining = s.length() - position;
+    	int theNanos;
+    	
+    	if( remaining == 0 ) {
+    	    // First, allow for the case where no fraction of a second is given:
+    	    theNanos = 0;
+    	} else {
+    	    // Case where fraction of a second is specified:
+	    	// Require 1 character plus the "." in the remaining part of the string...
+	    	if( (s.length() - position) < ".n".length() ) throw new IllegalArgumentException(valueOfExceptionMessage);
+	    	
+	    	// If we're strict, we should not allow any EXTRA characters after the 9 digits
+	    	if( (s.length() - position) > ".nnnnnnnnn".length() ) throw new IllegalArgumentException(valueOfExceptionMessage);
+	    	
+	    	// Require the next character to be a "."
+	    	if( s.charAt(position) != '.' ) throw new NumberFormatException("Bad input string format - '" + s.charAt(position) + "' instead of '.'");
+	    	// Get the length of the number string - need to account for the '.'
+	    	int nanoLength = s.length() - position - 1 ;
+	    	    	
+	    	// Get the 9 characters following the "." as an integer
+	    	String theNanoString = s.substring( position+1, position+1+nanoLength );
+	    	// We must adjust for the cases where the nanos String was not 9 characters long
+	    	// by padding out with zeros
+	    	theNanoString = theNanoString + "000000000";
+	    	theNanoString = theNanoString.substring(0, 9);
+	    	
+	    	try {
+	    		theNanos = Integer.parseInt( theNanoString );
+	    	} catch (Exception e) {
+	    		// If we get here, the string was not a number
+	    		throw new IllegalArgumentException(valueOfExceptionMessage);
+	    	} // end try
+    	} // end if
+    	
+    	if ( theNanos < 0 || theNanos > 999999999 ) throw new IllegalArgumentException(valueOfExceptionMessage);
+    	
+    	Timestamp theTimestamp = new Timestamp( theDate.getTime() );
+    	theTimestamp.setNanos( theNanos );
+    	
+    	return theTimestamp;
+    } // end method valueOf( String )
+    
+	
+}
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Types.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Types.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Types.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Types.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,190 @@
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package java.sql;
+
+/**
+ * A class which defines constants used to identify generic SQL types, also called JDBC
+ * types. The type constant values are equivalent to those in XOPEN.
+ * 
+ */
+public class Types {
+
+	// Uncomment the following to validate that this version of java.sql.Types is
+	// loaded:
+	// static { System.out.println("Clear version of java.sql.Types loaded!"); }; 
+	
+	/*
+	 * Private constructor to prevent instantiation.
+	 */
+	private Types() {
+		
+	} // end constructor Types()
+	
+	/**
+	 * The type code that identifies the SQL type ARRAY.
+	 */
+	public static final int 	ARRAY 		= 2003 ;
+	
+	/**
+	 * The type code that identifies the SQL type BIGINT.
+	 */
+	public static final int 	BIGINT		= -5 ;
+	
+	/**
+	 * The type code that identifies the SQL type BINARY.
+	 */
+	public static final int 	BINARY		= -2 ;
+	
+	/**
+	 * The type code that identifies the SQL type BIT.
+	 */
+	public static final int 	BIT			= -7 ;
+
+	/**
+	 * The type code that identifies the SQL type BLOB.
+	 */
+	public static final int 	BLOB		= 2004 ;
+    
+	/**
+	 * The type code that identifies the SQL type BOOLEAN.
+	 */
+	public static final int 	BOOLEAN		= 16 ;
+    
+	/**
+	 * The type code that identifies the SQL type CHAR.
+	 */
+	public static final int 	CHAR		= 1 ;
+    
+	/**
+	 * The type code that identifies the SQL type CLOB.
+	 */
+	public static final int 	CLOB		= 2005 ;
+	
+	/**
+	 * The type code that identifies the SQL type DATALINK.
+	 */
+    public static final int 	DATALINK	= 70 ;
+    
+	/**
+	 * The type code that identifies the SQL type DATE.
+	 */
+    public static final int 	DATE		= 91 ;
+    
+	/**
+	 * The type code that identifies the SQL type DECIMAL.
+	 */
+    public static final int 	DECIMAL		= 3 ;
+    
+	/**
+	 * The type code that identifies the SQL type DISTINCT.
+	 */
+    public static final int 	DISTINCT	= 2001 ;
+    
+	/**
+	 * The type code that identifies the SQL type DOUBLE.
+	 */
+    public static final int 	DOUBLE		= 8 ;
+    
+	/**
+	 * The type code that identifies the SQL type FLOAT.
+	 */
+    public static final int 	FLOAT		= 6 ;
+    
+	/**
+	 * The type code that identifies the SQL type INTEGER.
+	 */
+    public static final int 	INTEGER		= 4 ;
+    
+	/**
+	 * The type code that identifies the SQL type JAVA_OBJECT.
+	 */
+    public static final int 	JAVA_OBJECT	= 2000 ;
+    
+	/**
+	 * The type code that identifies the SQL type LONGVARBINARY.
+	 */
+    public static final int 	LONGVARBINARY = -4 ;
+    
+	/**
+	 * The type code that identifies the SQL type LONGVARCHAR.
+	 */
+	public static final int 	LONGVARCHAR	= -1 ;
+	
+	/**
+	 * The type code that identifies the SQL type NULL.
+	 */
+    public static final int 	NULL		= 0 ;
+    
+	/**
+	  * The type code that identifies the SQL type NUMERIC.
+	  */
+	public static final int 	NUMERIC		= 2 ;
+	
+	/**
+ 	 * The type code that identifies that the SQL type is database specific and is mapped to
+	 * a Java object, accessed via the methods <code>getObject</code> and <code>setObject</code>.
+	 */
+	public static final int 	OTHER		= 1111 ;
+    
+	/**
+	 * The type code that identifies the SQL type REAL.
+	 */
+	public static final int 	REAL		= 7 ;
+    
+	/**
+	 * The type code that identifies the SQL type REF.
+	 */
+   	public static final int 	REF			= 2006 ;
+    
+	/**
+	 * The type code that identifies the SQL type SMALLINT.
+	 */
+	public static final int 	SMALLINT	= 5 ;
+    
+	/**
+	 * The type code that identifies the SQL type STRUCT.
+	 */
+    public static final int 	STRUCT		= 2002 ;
+    
+	/**
+	 * The type code that identifies the SQL type TIME.
+	 */
+	public static final int 	TIME		= 92 ;
+    
+	/**
+	 * The type code that identifies the SQL type TIMESTAMP.
+	 */
+	public static final int 	TIMESTAMP	= 93 ;
+    
+	/**
+	 * The type code that identifies the SQL type TINYINT.
+	 */
+	public static final int 	TINYINT		= -6 ;
+
+	/**
+	 * The type code that identifies the SQL type VARBINARY.
+	 */
+	public static final int 	VARBINARY	= -3 ;
+    
+	/**
+	 * The type code that identifies the SQL type VARCHAR.
+	 */
+	public static final int 	VARCHAR		= 12 ;
+	
+} // end class Types
+
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/ConnectionEvent.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/ConnectionEvent.java?rev=386087&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/ConnectionEvent.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/ConnectionEvent.java Wed Mar 15 06:55:38 2006
@@ -0,0 +1,69 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package javax.sql;
+
+import java.util.EventObject;
+import java.sql.SQLException;
+import java.io.Serializable;
+
+/**
+ * An Event object which is sent when specific events happen on a PooledConnection object.
+ * The events involved are when the application closing the PooledConnection and when an error
+ * occurs in the PooledConnection.
+ * 
+ */
+public class ConnectionEvent extends EventObject implements Serializable {
+	
+	private static final long serialVersionUID = -4843217645290030002L;
+	
+	private SQLException theSQLException;
+
+	/**
+	 * Creates a connection event initialized with a supplied PooledConnection.
+	 * @param theConnection the PooledConnection 
+	 */
+	public ConnectionEvent(PooledConnection theConnection ) {
+		super( theConnection );
+		// System.out.println("Clear Connection Event constructor");
+		theSQLException = null;
+	} // end method ConnectionEvent( PooledConnection )
+	
+	/**
+	 * Creates a ConnectionEvent initialized with a supplied PooledConnection and with
+	 * a supplied SQLException indicating that an error has occurred within the PooledConnection.
+	 * @param theConnection the PooledConnection
+	 * @param theException the SQLException holding information about the error that has occurred,
+	 * which is about to be returned to the application.
+	 */
+	public ConnectionEvent(PooledConnection theConnection, SQLException theException ) {
+		super( theConnection );
+		theSQLException = theException;
+	} // end method ConnectionEvent( PooledConnection, SQLException )
+	
+	/**
+	 * Gets the SQLException which holds information about the error which occurred in the
+	 * PooledConnection.
+	 * @return an SQLException containing information about the error. May be null if no error
+	 * has occurred.
+	 */
+	public SQLException getSQLException() {
+		return theSQLException;
+	} // end method getSQLException()
+	
+} // end class ConnectionEvent
+
+