--- old/src/share/classes/java/sql/JDBCType.java 2013-01-31 14:20:27.000000000 -0500 +++ new/src/share/classes/java/sql/JDBCType.java 2013-01-31 14:20:26.000000000 -0500 @@ -190,7 +190,17 @@ /** * Identifies the generic SQL type {@code REF_CURSOR}. */ - REF_CURSOR(Types.REF_CURSOR); + REF_CURSOR(Types.REF_CURSOR), + + /** + * Identifies the generic SQL type {@code TIME_WITH_TIMEZONE}. + */ + TIME_WITH_TIMEZONE(Types.TIME_WITH_TIMEZONE), + + /** + * Identifies the generic SQL type {@code TIMESTAMP_WITH_TIMEZONE}. + */ + TIMESTAMP_WITH_TIMEZONE(Types.TIMESTAMP_WITH_TIMEZONE); /** * The Integer value for the JDBCType. It maps to a value in --- old/src/share/classes/java/sql/SQLInput.java 2013-01-31 14:20:28.000000000 -0500 +++ new/src/share/classes/java/sql/SQLInput.java 2013-01-31 14:20:28.000000000 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -420,5 +420,39 @@ * @since 1.6 */ RowId readRowId() throws SQLException; - + + //--------------------------JDBC 4.2 ----------------------------- + + /** + * Reads the next attribute in the stream and returns it as an + * {@code Object} in the Java programming language. The + * actual type of the object returned is determined by the specified + * Java data type, and any customizations present in this + * stream's type map. + * + *
A type map is registered with the stream by the JDBC driver before the + * stream is passed to the application. + * + *
When the attribute at the head of the stream is an SQL {@code NULL} + * the method returns {@code null}. If the attribute is an SQL + * structured or distinct + * type, it determines the SQL type of the attribute at the head of the stream. + * If the stream's type map has an entry for that SQL type, the driver + * constructs an object of the appropriate class and calls the method + * {@code SQLData.readSQL} on that object, which reads additional data from the + * stream, using the protocol described for that method. + *
+ * The default implementation will throw {@code SQLFeatureNotSupportedException}
+ *
+ * @param type Class representing the Java data type to convert the attribute to.
+ * @return the attribute at the head of the stream as an {@code Object} in the
+ * Java programming language;{@code null} if the attribute is SQL {@code NULL}
+ * @exception SQLException if a database access error occurs
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.8
+ */
+ default
+ * When the {@code object} is {@code null}, this
+ * method writes an SQL {@code NULL} to the stream.
+ *
+ * If the object has a custom mapping (is of a class implementing the
+ * interface {@code SQLData}),
+ * the JDBC driver should call the method {@code SQLData.writeSQL} to
+ * write it to the SQL data stream.
+ * If, on the other hand, the object is of a class implementing
+ * {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob},
+ * {@code Struct}, {@code java.net.URL},
+ * or {@code Array}, the driver should pass it to the database as a
+ * value of the corresponding SQL type.
+ *
+ * The default implementation will throw {@code SQLFeatureNotSupportedException}
+ *
+ * @param x the object containing the input parameter value
+ * @param targetSqlType the SQL type to be sent to the database.
+ * @exception SQLException if a database access error occurs or
+ * if the Java Object specified by x is an InputStream
+ * or Reader object and the value of the scale parameter is less
+ * than zero
+ * @exception SQLFeatureNotSupportedException if
+ * the JDBC driver does not support this data type
+ * @see JDBCType
+ * @see SQLType
+ * @since 1.8
+ */
+ default void writeObject(Object x, SQLType targetSqlType) throws SQLException {
+ throw new SQLFeatureNotSupportedException("writeObject not implemented");
+ }
}
+
--- old/src/share/classes/java/sql/Types.java 2013-01-31 14:20:31.000000000 -0500
+++ new/src/share/classes/java/sql/Types.java 2013-01-31 14:20:31.000000000 -0500
@@ -319,6 +319,24 @@
*/
public static final int REF_CURSOR = 2012;
+ /**
+ * The constant in the Java programming language, sometimes referred to
+ * as a type code, that identifies the generic SQL type
+ * {@code TIME WITH TIMEZONE}.
+ *
+ * @since 1.8
+ */
+ public static final int TIME_WITH_TIMEZONE = 2013;
+
+ /**
+ * The constant in the Java programming language, sometimes referred to
+ * as a type code, that identifies the generic SQL type
+ * {@code TIMESTAMP WITH TIMEZONE}.
+ *
+ * @since 1.8
+ */
+ public static final int TIMESTAMP_WITH_TIMEZONE = 2014;
+
// Prevent instantiation
private Types() {}
}
SQLData.writeSQL
* method of the given object, which
* writes the object's attributes to the stream.
- * The implementation of the method SQLData.writeSQ
+ * The implementation of the method SQLData.writeSQL
* calls the appropriate SQLOutput
writer method(s)
* for writing each of the object's attributes in order.
* The attributes must be read from an SQLInput
@@ -433,5 +433,43 @@
*/
void writeSQLXML(SQLXML x) throws SQLException;
+ //--------------------------JDBC 4.2 -----------------------------
+
+ /**
+ * Writes to the stream the data contained in the given object. The
+ * object will be converted to the specified targetSqlType
+ * before being sent to the stream.
+ *