2362N/A * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * An input stream that contains a stream of values representing an 0N/A * instance of an SQL structured type or an SQL distinct type. 0N/A * This interface, used only for custom mapping, is used by the driver 0N/A * behind the scenes, and a programmer never directly invokes 0N/A * <code>SQLInput</code> methods. The <i>reader</i> methods 0N/A * (<code>readLong</code>, <code>readBytes</code>, and so on) 0N/A * provide a way for an implementation of the <code>SQLData</code> 0N/A * interface to read the values in an <code>SQLInput</code> object. 0N/A * And as described in <code>SQLData</code>, calls to reader methods must 0N/A * be made in the order that their corresponding attributes appear in the 0N/A * SQL definition of the type. 0N/A * The method <code>wasNull</code> is used to determine whether 0N/A * the last value read was SQL <code>NULL</code>. 0N/A * <P>When the method <code>getObject</code> is called with an 0N/A * object of a class implementing the interface <code>SQLData</code>, 0N/A * the JDBC driver calls the method <code>SQLData.getSQLType</code> 0N/A * to determine the SQL type of the user-defined type (UDT) 0N/A * being custom mapped. The driver 0N/A * creates an instance of <code>SQLInput</code>, populating it with the 0N/A * attributes of the UDT. The driver then passes the input 0N/A * stream to the method <code>SQLData.readSQL</code>, which in turn 0N/A * calls the <code>SQLInput</code> reader methods 0N/A * in its implementation for reading the 0N/A * attributes from the input stream. 0N/A //================================================================ 0N/A // Methods for reading attributes from the stream of SQL data. 0N/A // These methods correspond to the column-accessor methods of 0N/A // java.sql.ResultSet. 0N/A //================================================================ 0N/A * Reads the next attribute in the stream and returns it as a <code>String</code> 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>boolean</code> 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>false</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>byte</code> 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>0</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>short</code> 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>0</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as an <code>int</code> 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>0</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>long</code> 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>0</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>float</code> 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>0</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>double</code> 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>0</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>java.math.BigDecimal</code> 0N/A * object in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as an array of bytes 0N/A * in the Java programming language. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>java.sql.Date</code> object. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>java.sql.Time</code> object. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>java.sql.Timestamp</code> object. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a stream of Unicode characters. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a stream of ASCII characters. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a stream of uninterpreted 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A //================================================================ 0N/A // Methods for reading items of SQL user-defined types from the stream. 0N/A //================================================================ 0N/A * Reads the datum at the head of the stream and returns it as an 0N/A * <code>Object</code> in the Java programming language. The 0N/A * actual type of the object returned is determined by the default type 0N/A * mapping, and any customizations present in this stream's type map. 0N/A * <P>A type map is registered with the stream by the JDBC driver before the 0N/A * stream is passed to the application. 0N/A * <P>When the datum at the head of the stream is an SQL <code>NULL</code>, 0N/A * the method returns <code>null</code>. If the datum is an SQL structured or distinct 0N/A * type, it determines the SQL type of the datum at the head of the stream. 0N/A * If the stream's type map has an entry for that SQL type, the driver 0N/A * constructs an object of the appropriate class and calls the method 0N/A * <code>SQLData.readSQL</code> on that object, which reads additional data from the 0N/A * stream, using the protocol described for that method. 0N/A * @return the datum at the head of the stream as an <code>Object</code> in the 0N/A * Java programming language;<code>null</code> if the datum is SQL <code>NULL</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads an SQL <code>REF</code> value from the stream and returns it as a 0N/A * <code>Ref</code> object in the Java programming language. 0N/A * @return a <code>Ref</code> object representing the SQL <code>REF</code> value 0N/A * at the head of the stream; <code>null</code> if the value read is 0N/A * SQL <code>NULL</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads an SQL <code>BLOB</code> value from the stream and returns it as a 0N/A * <code>Blob</code> object in the Java programming language. 0N/A * @return a <code>Blob</code> object representing data of the SQL <code>BLOB</code> value 0N/A * at the head of the stream; <code>null</code> if the value read is 0N/A * SQL <code>NULL</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads an SQL <code>CLOB</code> value from the stream and returns it as a 0N/A * <code>Clob</code> object in the Java programming language. 0N/A * @return a <code>Clob</code> object representing data of the SQL <code>CLOB</code> value 0N/A * at the head of the stream; <code>null</code> if the value read is 0N/A * SQL <code>NULL</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads an SQL <code>ARRAY</code> value from the stream and returns it as an 0N/A * <code>Array</code> object in the Java programming language. 0N/A * @return an <code>Array</code> object representing data of the SQL 0N/A * <code>ARRAY</code> value at the head of the stream; <code>null</code> 0N/A * if the value read is SQL <code>NULL</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Retrieves whether the last value read was SQL <code>NULL</code>. 0N/A * @return <code>true</code> if the most recently read SQL value was SQL 0N/A * <code>NULL</code>; <code>false</code> otherwise 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A //---------------------------- JDBC 3.0 ------------------------- 0N/A * Reads an SQL <code>DATALINK</code> value from the stream and returns it as a 0N/A * <code>java.net.URL</code> object in the Java programming language. 0N/A * @return a <code>java.net.URL</code> object. 0N/A * @exception SQLException if a database access error occurs, 0N/A * or if a URL is malformed 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A //---------------------------- JDBC 4.0 ------------------------- 0N/A * Reads an SQL <code>NCLOB</code> value from the stream and returns it as a 0N/A * <code>NClob</code> object in the Java programming language. 0N/A * @return a <code>NClob</code> object representing data of the SQL <code>NCLOB</code> value 0N/A * at the head of the stream; <code>null</code> if the value read is 0N/A * SQL <code>NULL</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads the next attribute in the stream and returns it as a <code>String</code> 0N/A * in the Java programming language. It is intended for use when 0N/A * accessing <code>NCHAR</code>,<code>NVARCHAR</code> 0N/A * and <code>LONGNVARCHAR</code> columns. 0N/A * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads an SQL <code>XML</code> value from the stream and returns it as a 0N/A * <code>SQLXML</code> object in the Java programming language. 0N/A * @return a <code>SQLXML</code> object representing data of the SQL <code>XML</code> value 0N/A * at the head of the stream; <code>null</code> if the value read is 0N/A * SQL <code>NULL</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Reads an SQL <code>ROWID</code> value from the stream and returns it as a 0N/A * <code>RowId</code> object in the Java programming language. 0N/A * @return a <code>RowId</code> object representing data of the SQL <code>ROWID</code> value 0N/A * at the head of the stream; <code>null</code> if the value read is 0N/A * SQL <code>NULL</code> 0N/A * @exception SQLException if a database access error occurs 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support