db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r671940 [4/5] - in /db/derby/code/trunk: ./ java/stubs/ java/stubs/jsr169/ java/stubs/jsr169/java/ java/stubs/jsr169/java/sql/ java/stubs/jsr169/javax/ java/stubs/jsr169/javax/sql/ tools/ant/properties/
Date Thu, 26 Jun 2008 16:41:11 GMT
Added: db/derby/code/trunk/java/stubs/jsr169/java/sql/ResultSetMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/java/sql/ResultSetMetaData.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/java/sql/ResultSetMetaData.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/java/sql/ResultSetMetaData.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,277 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+/**
+ * Provides information about the columns in a ResultSet.
+ */
+public interface ResultSetMetaData {
+
+    /**
+     * Indicates that a column cannot contain NULL values
+     */
+    public static final int columnNoNulls = 0;
+
+    /**
+     * Indicates that a column can contain NULL values
+     */
+    public static final int columnNullable = 1;
+
+    /**
+     * Indicates that it is unknown whether a column can contain NULLs or not
+     */
+    public static final int columnNullableUnknown = 2;
+
+    /**
+     * Returns the title of indexed columns catalog
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the catalog title
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public String getCatalogName(int column) throws SQLException;
+
+    /**
+     * Returns the fully-qualified type of the class that is produced when
+     * invoking ResultSet.getObject to recover this columns value.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the fully-qualified class name
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public String getColumnClassName(int column) throws SQLException;
+
+    /**
+     * Returns a count of the columns in this set of results.
+     * 
+     * @return the column count
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public int getColumnCount() throws SQLException;
+
+    /**
+     * Returns the indexed column's standard maximum width, expressed in number
+     * of characters.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the column's max width
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public int getColumnDisplaySize(int column) throws SQLException;
+
+    /**
+     * Returns a recommended title for the indexed column, to be used when the
+     * title needs to be displayed.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the column's title
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public String getColumnLabel(int column) throws SQLException;
+
+    /**
+     * Returns the title of the indexed column
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the column title
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public String getColumnName(int column) throws SQLException;
+
+    /**
+     * Returns the type of the indexed column
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the column type
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public int getColumnType(int column) throws SQLException;
+
+    /**
+     * Returns the type name of the indexed column
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the type name
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public String getColumnTypeName(int column) throws SQLException;
+
+    /**
+     * Returns the decimal precision of the indexed column
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the precision
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public int getPrecision(int column) throws SQLException;
+
+    /**
+     * Returns the number of decimal places in the indexed column.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return number of decimal places
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public int getScale(int column) throws SQLException;
+
+    /**
+     * Returns the name of the indexed columns schema
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the name of the columns schema
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public String getSchemaName(int column) throws SQLException;
+
+    /**
+     * Returns the title of the indexed columns table.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return the table title
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public String getTableName(int column) throws SQLException;
+
+    /**
+     * Returns and indication of whether the indexed column has automatic
+     * numbering and is therefore read-only
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if it is automatically numbered, false otherwise
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public boolean isAutoIncrement(int column) throws SQLException;
+
+    /**
+     * Returns an indicator of whether the case of the indexed column is
+     * important
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if case matters, false otherwise
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public boolean isCaseSensitive(int column) throws SQLException;
+
+    /**
+     * Returns if the indexed column contains a monetary amount.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if it is a monetary value, false otherwise
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public boolean isCurrency(int column) throws SQLException;
+
+    /**
+     * Returns an indication of whether writing to the indexed column is
+     * guaranteed to be successful
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if the write is guaranteed, false otherwise
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public boolean isDefinitelyWritable(int column) throws SQLException;
+
+    /**
+     * Returns whether the indexed column is nullable.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if it is nullable, false otherwise
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public int isNullable(int column) throws SQLException;
+
+    /**
+     * Returns an indication of whether writing to the indexed column is
+     * guaranteed to be unsuccessful
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if the column is read-only, false otherwise
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public boolean isReadOnly(int column) throws SQLException;
+
+    /**
+     * Returns an indication of whether the indexed column is searchable.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if the indexed column is searchable, false otherwise.
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public boolean isSearchable(int column) throws SQLException;
+
+    /**
+     * Returns an indicator of whether the values contained in the indexed
+     * column are signed.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if they are signed, false otherwise
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public boolean isSigned(int column) throws SQLException;
+
+    /**
+     * Returns an indication of whether writing to the indexed column is
+     * possible.
+     * 
+     * @param column
+     *            the column index, starting at 1
+     * @return true if it is possible to write, false otherwise
+     * @throws SQLException
+     *             if there is a database error
+     */
+    public boolean isWritable(int column) throws SQLException;
+}

Added: db/derby/code/trunk/java/stubs/jsr169/java/sql/SQLException.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/java/sql/SQLException.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/java/sql/SQLException.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/java/sql/SQLException.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,153 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+import java.io.Serializable;
+
+/**
+ * An Exception class that is used in conjunction with JDBC operations. It
+ * provides information about problems encountered with Database access and
+ * other problems related to JDBC
+ * <p>
+ * The SQLException class provides the following information:
+ * <ul>
+ * <li>A standard Java exception message, as a String
+ * <li>An SQLState string. This is an error description string which follows
+ * either the SQL 99 conventions or the XOPEN SQLstate conventions. The
+ * potential values of the SQLState string are described in each of the
+ * specifications. Which of the conventions is being used by the SQLState string
+ * can be discovered by using the getSQLStateType method of the DatabaseMetaData
+ * interface.
+ * <li>An Error Code, an an integer. The error code is specific to each
+ * database vendor and is typically the error code returned by the database
+ * itself.
+ * <li>A chain to a next Exception, if relevant, which can give access to
+ * additional error information.
+ * </ul>
+ */
+public class SQLException extends Exception implements Serializable {
+
+    private static final long serialVersionUID = 2135244094396331484L;
+
+    private String SQLState = null;
+
+    private int vendorCode = 0;
+
+    private SQLException next = null;
+
+    /**
+     * Creates an SQLException object. The Reason string is set to null, the
+     * SQLState string is set to null and the Error Code is set to 0.
+     */
+    public SQLException() {
+        super();
+    }
+
+    /**
+     * Creates an SQLException 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
+     *            the string to use as the Reason string
+     */
+    public SQLException(String theReason) {
+        this(theReason, null, 0);
+    }
+
+    /**
+     * Creates an SQLException object. The Reason string is set to the given
+     * reason string, the SQLState string is set to the given SQLState string
+     * and the 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 SQLException(String theReason, String theSQLState) {
+        this(theReason, theSQLState, 0);
+    }
+
+    /**
+     * Creates an SQLException object. The Reason string is set to the given
+     * reason string, the SQLState string is set to the given SQLState string
+     * and the Error Code is set to the given error code value.
+     * 
+     * @param theReason
+     *            the string to use as the Reason string
+     * @param theSQLState
+     *            the string to use as the SQLState string
+     * @param theErrorCode
+     *            the integer value for the error code
+     */
+    public SQLException(String theReason, String theSQLState, int theErrorCode) {
+        super(theReason);
+        SQLState = theSQLState;
+        vendorCode = theErrorCode;
+    }
+
+    /**
+     * Returns the integer error code for this SQLException
+     * 
+     * @return The integer error code for this SQLException. The meaning of the
+     *         code is specific to the vendor of the database.
+     */
+    public int getErrorCode() {
+        return vendorCode;
+    }
+
+    /**
+     * Retrieves the SQLException chained to this SQLException, if any.
+     * 
+     * @return The SQLException chained to this SQLException. null if there is
+     *         no SQLException chained to this SQLException.
+     */
+    public SQLException getNextException() {
+        return next;
+    }
+
+    /**
+     * Retrieves the SQLState description string for this SQLException object
+     * 
+     * @return The SQLState string for this SQLException object. This is an
+     *         error description string which follows either the SQL 99
+     *         conventions or the XOPEN SQLstate conventions. The potential
+     *         values of the SQLState string are described in each of the
+     *         specifications. Which of the conventions is being used by the
+     *         SQLState string can be discovered by using the getSQLStateType
+     *         method of the DatabaseMetaData interface.
+     */
+    public String getSQLState() {
+        return SQLState;
+    }
+
+    /**
+     * Adds the SQLException to the end of this SQLException chain.
+     * 
+     * @param ex
+     *            the new SQLException to be added to the end of the chain
+     */
+    public void setNextException(SQLException ex) {
+        if (next != null) {
+            next.setNextException(ex);
+        } else {
+            next = ex;
+        }
+    }
+}

Added: db/derby/code/trunk/java/stubs/jsr169/java/sql/SQLWarning.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/java/sql/SQLWarning.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/java/sql/SQLWarning.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/java/sql/SQLWarning.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,101 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+import java.io.Serializable;
+
+/**
+ * An exception class that holds information about Database access warnings.
+ */
+public class SQLWarning extends SQLException implements Serializable {
+
+    private static final long serialVersionUID = 3917336774604784856L;
+
+    /**
+     * Creates an 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();
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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() {
+        SQLException next = super.getNextException();
+        if (next == null) {
+            return null;
+        }
+        if (next instanceof SQLWarning) {
+            return (SQLWarning) next;
+        }
+        throw new Error("sql.8"); //$NON-NLS-1$
+    }
+
+    /**
+     * Chains a supplied SQLWarning to this SQLWarning.
+     * 
+     * @param w
+     *            the SQLWarning to chain to this SQLWarning.
+     */
+    public void setNextWarning(SQLWarning w) {
+        super.setNextException(w);
+    }
+}

Added: db/derby/code/trunk/java/stubs/jsr169/java/sql/Savepoint.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/java/sql/Savepoint.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/java/sql/Savepoint.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/java/sql/Savepoint.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,43 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+/**
+ * A Savepoint is an instant during the current transaction that can be utilized
+ * by a Rollback 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;
+}

Added: db/derby/code/trunk/java/stubs/jsr169/java/sql/Statement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/java/sql/Statement.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/java/sql/Statement.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/java/sql/Statement.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,620 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+/**
+ * Interface used for executing static SQL statements 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 utilized 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 unrecognized
+     */
+    public void setFetchDirection(int direction) throws SQLException;
+
+    /**
+     * Sets the fetch size. This is a hint to the JDBC driver about how many
+     * rows should be fetched from the database when more are required by
+     * application processing.
+     * 
+     * @param rows
+     *            the number of rows that should be fetched. 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;
+}

Added: db/derby/code/trunk/java/stubs/jsr169/java/sql/Time.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/java/sql/Time.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/java/sql/Time.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/java/sql/Time.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,84 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+import java.text.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 {
+
+    private static final long serialVersionUID = 8397324403548013681L;
+
+    /**
+     * 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);
+    }
+
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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"); //$NON-NLS-1$
+        return dateFormat.format(this);
+    }
+
+    /**
+     * 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 timeString
+     *            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
+     *             if the supplied time string is not in JDBC escape format.
+     */
+    public static Time valueOf(String timeString) {
+        return new Time( 0L );
+    }
+}

Added: db/derby/code/trunk/java/stubs/jsr169/java/sql/Timestamp.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/java/sql/Timestamp.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/java/sql/Timestamp.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/java/sql/Timestamp.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,417 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+import java.text.DecimalFormat;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 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 {
+
+    private static final long serialVersionUID = 2745179027874758501L;
+
+    // The nanoseconds time value of the Timestamp
+    private int nanos;
+
+
+    /**
+     * 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);
+    }
+
+    /**
+     * 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;
+        }
+    }
+
+    /**
+     * 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;
+        }
+    }
+
+    /**
+     * 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(Date theObject) throws ClassCastException {
+        return this.compareTo((Timestamp) theObject);
+    }
+
+    /**
+     * 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) {
+        int result = super.compareTo(theTimestamp);
+        if (result == 0) {
+            int thisNano = this.getNanos();
+            int thatNano = theTimestamp.getNanos();
+            if (thisNano > thatNano) {
+                return 1;
+            } else if (thisNano == thatNano) {
+                return 0;
+            } else {
+                return -1;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Tests to see if this timestamp is equal to a supplied object.
+     * 
+     * @param theObject
+     * @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) {
+        if (theObject instanceof Timestamp) {
+            return equals((Timestamp) theObject);
+        }
+        return false;
+    }
+
+    /**
+     * Tests to see if this timestamp is equal to a supplied timestamp.
+     * 
+     * @param theTimestamp
+     *            the timestamp to compare with this 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 (theTimestamp == null) {
+            return false;
+        }
+        return (this.getTime() == theTimestamp.getTime())
+                && (this.getNanos() == theTimestamp.getNanos());
+    }
+
+    /**
+     * Gets this Timestamp's nanosecond value
+     * 
+     * @return The timestamp's nanosecond value, an integer between 0 and
+     *         999,999,999
+     */
+    public int getNanos() {
+        return nanos;
+    }
+
+    /**
+     * Returns the time represented by this 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 + (nanos / 1000000);
+        return theTime;
+    }
+
+    /**
+     * Sets the nanosecond value for this timestamp
+     */
+    public void setNanos(int n) throws IllegalArgumentException {
+        if ((n < 0) || (n > 999999999)) {
+            // sql.0=Value out of range
+            throw new IllegalArgumentException("sql.0"); //$NON-NLS-1$
+        }
+        nanos = n;
+    }
+
+    /**
+     * 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;
+        }
+        super.setTime(theTime);
+        setNanos(milliseconds * 1000000);
+    }
+
+    /**
+     * 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() {
+        return "dummy string";
+    }
+
+    /*
+     * Private method to format the time
+     */
+    private String format(int date, int digits) {
+        StringBuilder dateStringBuffer = new StringBuilder(String.valueOf(date));
+        while (dateStringBuffer.length() < digits) {
+            dateStringBuffer = dateStringBuffer.insert(0, '0');
+        }
+        return dateStringBuffer.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"; //$NON-NLS-1$
+            }
+        }
+
+        finalString = inputString.substring(0, i);
+        return finalString;
+    }
+
+    /**
+     * 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) {
+            // sql.3=Argument cannot be null
+            throw new IllegalArgumentException("sql.3"); //$NON-NLS-1$
+        }
+
+        // omit trailing whitespaces
+        s = s.trim();
+
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
+        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("sql.2"); //$NON-NLS-1$
+        }
+
+        if (theDate == null) {
+            throw new IllegalArgumentException("sql.2"); //$NON-NLS-1$
+        }
+
+        /*
+         * 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()) { //$NON-NLS-1$
+                throw new IllegalArgumentException("sql.2"); //$NON-NLS-1$
+            }
+
+            /*
+             * If we're strict, we should not allow any EXTRA characters after
+             * the 9 digits
+             */
+            if ((s.length() - position) > ".nnnnnnnnn".length()) { //$NON-NLS-1$
+                throw new IllegalArgumentException("sql.2"); //$NON-NLS-1$
+            }
+
+            // Require the next character to be a "."
+            if (s.charAt(position) != '.') {
+                // sql.4=Bad input string format: expected '.' not {0}
+                throw new NumberFormatException("sql.4"); //$NON-NLS-1$
+            }
+            // 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"; //$NON-NLS-1$
+            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("sql.2"); //$NON-NLS-1$
+            }
+        }
+
+        if (theNanos < 0 || theNanos > 999999999) {
+            throw new IllegalArgumentException("sql.2"); //$NON-NLS-1$
+        }
+
+        Timestamp theTimestamp = new Timestamp(theDate.getTime());
+        theTimestamp.setNanos(theNanos);
+
+        return theTimestamp;
+    }
+}

Added: db/derby/code/trunk/java/stubs/jsr169/java/sql/Types.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/java/sql/Types.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/java/sql/Types.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/java/sql/Types.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,184 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+/**
+ * A class which defines constants used to identify generic SQL types, also
+ * called JDBC types. The type constant values are equivalent to those in XOPEN.
+ */
+public class Types {
+
+    /*
+     * Private constructor to prevent instantiation.
+     */
+    private Types() {
+        super();
+    }
+
+    /**
+     * 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;
+}

Added: db/derby/code/trunk/java/stubs/jsr169/javax/sql/DataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/stubs/jsr169/javax/sql/DataSource.java?rev=671940&view=auto
==============================================================================
--- db/derby/code/trunk/java/stubs/jsr169/javax/sql/DataSource.java (added)
+++ db/derby/code/trunk/java/stubs/jsr169/javax/sql/DataSource.java Thu Jun 26 09:41:10 2008
@@ -0,0 +1,138 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.sql;
+
+import java.sql.SQLException;
+import java.sql.Connection;
+import java.io.PrintWriter;
+
+/**
+ * An interface for the creation of Connection objects which represent a
+ * connection to a database. This interface is an alternative to the
+ * <code>java.sql.DriverManager</code>.
+ * <p>
+ * A class which implements the DataSource interface is typically registered
+ * with a JNDI naming service directory and is retrieved from there by name.
+ * <p>
+ * The DataSource interface is typically implemented by the writer of a JDBC
+ * driver. There are three variants of the DataSource interface, which produce
+ * Connections with differing characteristics:
+ * <ol>
+ * <li>Standard DataSource, which produces standard Connection objects with no
+ * special features.</li>
+ * <li>Connection Pool DataSource, which produces PooledConnection objects
+ * which are able to participate in connection pooling, typically involving a
+ * connection pooling manager as an intermediary between applications and the
+ * database.</li>
+ * <li>Distributed transaction DataSource ("XADataSource"), which produces
+ * XAConnection objects which can be used to handle distributed transactions and
+ * which typically involve a transaction manager component in the system.
+ * XAConnection objects also typically provide connection pooling capabilities
+ * as well as distributed transaction capabilities. </li>
+ * </ol>
+ * <p>
+ * Note that a JDBC driver which is accessed via the DataSource interface is
+ * loaded via a JNDI lookup process. A driver loaded in this way does not
+ * register itself with the <code>DriverManager</code>.
+ */
+public interface DataSource {
+
+    /**
+     * Creates a connection to the database represented by this DataSource.
+     * 
+     * @return a Connection object which is a connection to the database.
+     * @throws SQLException
+     *             if there is a problem accessing the database.
+     */
+    public Connection getConnection() throws SQLException;
+
+    /**
+     * Creates a connection to the database represented by this DataSource,
+     * using a supplied Username and Password,.
+     * 
+     * @param theUsername
+     *            a String containing a User Name for the database
+     * @param thePassword
+     *            a String containing the Password for the user identified by
+     *            <code>theUsername</code>
+     * @return a Connection object which is a connection to the database.
+     * @throws SQLException
+     *             if there is a problem accessing the database.
+     */
+    public Connection getConnection(String theUsername, String thePassword)
+            throws SQLException;
+
+    /**
+     * Gets the Login Timeout value for this DataSource. The Login Timeout is
+     * the maximum time in seconds that the DataSource will wait when opening a
+     * connection to a database. A Timeout value of 0 implies either the system
+     * default timeout value (if there is one) or that there is no timeout. The
+     * default value for the Login Timeout is 0.
+     * 
+     * @return the Login Timeout value in seconds.
+     * @throws SQLException
+     *             if there is a problem accessing the database.
+     */
+    public int getLoginTimeout() throws SQLException;
+
+    /**
+     * Gets the Log Writer for this DataSource.
+     * <p>
+     * The Log Writer is a stream to which all log and trace messages are sent
+     * from this DataSource. The Log Writer can be null, in which case, log and
+     * trace capture is disabled. The default value for the Log Writer when an
+     * DataSource is created is null. Note that the Log Writer for an DataSource
+     * is not the same as the Log Writer used by a <code>DriverManager</code>.
+     * 
+     * @return a PrintWriter which is the Log Writer for this DataSource. Can be
+     *         null, in which case log writing is disabled for this DataSource.
+     * @throws SQLException
+     *             if there is a problem accessing the database.
+     */
+    public PrintWriter getLogWriter() throws SQLException;
+
+    /**
+     * Sets the Login Timeout value for this DataSource. The Login Timeout is
+     * the maximum time in seconds that the DataSource will wait when opening a
+     * connection to a database. A Timeout value of 0 implies either the system
+     * default timeout value (if there is one) or that there is no timeout. The
+     * default value for the Login Timeout is 0.
+     * 
+     * @param theTimeout
+     *            the new Login Timeout value in seconds.
+     * @throws SQLException
+     *             if there is a problem accessing the database.
+     */
+    public void setLoginTimeout(int theTimeout) throws SQLException;
+
+    /**
+     * Sets the Log Writer for this DataSource.
+     * <p>
+     * The Log Writer is a stream to which all log and trace messages are sent
+     * from this DataSource. The Log Writer can be null, in which case, log and
+     * trace capture is disabled. The default value for the Log Writer when an
+     * DataSource is created is null. Note that the Log Writer for an DataSource
+     * is not the same as the Log Writer used by a <code>DriverManager</code>.
+     * 
+     * @param theWriter
+     *            a PrintWriter to use as the Log Writer for this DataSource.
+     * @throws SQLException
+     *             if there is a problem accessing the database.
+     */
+    public void setLogWriter(PrintWriter theWriter) throws SQLException;
+}



Mime
View raw message