JSR 310, Types and SQLInput, SQlOutput
Lance Andersen - Oracle
lance.andersen at oracle.com
Wed Jan 16 10:32:55 PST 2013
yes void is a typo
On Jan 16, 2013, at 1:26 PM, Ulf Zibis wrote:
> I guess you meant:
> default T readObject(Class<T> type)
> not void.
>
> -Ulf
>
> Am 16.01.2013 18:16, schrieb Lance Andersen - Oracle:
>>
>> Once JSR 310 is integrated into Java SE 8, part of M6, one of the last items for now is updating Types, JDBCType and SQLInput, SQLOutput
>>
>> For Types/JDBCType, we will:
>>
>> Add TIME_WITH_TIMEZONE
>> Add TIMESTAMP_WITH_TIMEZONE
>>
>> We should be able to use DATE, TIME and TIMESTAMP with LocalDate, LocalTime, LocalDateTime
>>
>> Add the following methods to SQLInput & SQLOutput:
>>
>>
>> SQLInput:
>>
>>
>> /**
>> * 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.
>> *
>> * <P>A type map is registered with the stream by the JDBC driver before the
>> * stream is passed to the application.
>> *
>> * <P>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.
>> *<p>
>> * 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 void readObject(Class<T> type) throws SQLException {
>> throw new SQLFeatureNotSupportedException("readObject not implemented");
>> }
>>
>>
>>
>>
>>
>>
>> SQLOutput
>>
>>
>> /**
>> * 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.
>> *<p>
>> * When the {@code object} is {@code null}, this
>> * method writes an SQL {@code NULL} to the stream.
>> * <p>
>> * 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.
>> *<P>
>> * The default implementation will throw {@code SQLFeatureNotSupportedException}
>> *
>> * @param x the object representing value to be sent to the database
>> * @param targetSqlType the SQL type to convert the object to
>> * @exception SQLException if a database access error occurs
>> * @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");
>> }
>>
>>
>> I have had a brief discussion some of you get your input prior to sending this out to the wider audience to make sure we are in sync
>>
>> Best
>> Lance
>>
>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
>> Oracle Java Engineering
>> 1 Network Drive
>> Burlington, MA 01803
>> Lance.Andersen at oracle.com
>>
>>
>
-------------- next part --------------
Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com
More information about the jdbc-spec-discuss
mailing list