home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / sql / SQLInput.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  6.1 KB  |  213 lines

  1. /*
  2.  * @(#)SQLInput.java    1.3 98/03/18
  3.  *
  4.  * Copyright 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.sql;
  16.  
  17. /**
  18.  * JDBC 2.0
  19.  *
  20.  * A SQLInput stream contains a stream of values that represent an SQL
  21.  * UDT instance.
  22.  */
  23.  
  24. public interface SQLInput {
  25.   
  26.  
  27.   //================================================================
  28.   // Methods for reading attributes from the stream of SQL data.
  29.   // These methods correspond to the column-accessor methods of
  30.   // java.sql.ResultSet.
  31.   //================================================================
  32.  
  33.   /**
  34.   * Read the next attribute in the stream as a Java String.
  35.   *
  36.   * @return the attribute; if the value is SQL NULL, return null.
  37.   */
  38.   String readString () throws SQLException;
  39.  
  40.   /**
  41.   * Read the next attribute in the stream as a Java boolean.
  42.   *
  43.   * @return the attribute; if the value is SQL NULL, return null.
  44.   */
  45.   boolean readBoolean () throws SQLException;
  46.  
  47.   /**
  48.   * Read the next attribute in the stream as a Java byte.
  49.   *
  50.   * @return the attribute; if the value is SQL NULL, return null.
  51.   */
  52.   byte readByte () throws SQLException;
  53.  
  54.   /**
  55.   * Read the next attribute in the stream as a Java short.
  56.   *
  57.   * @return the attribute; if the value is SQL NULL, return null.
  58.   */
  59.   short readShort () throws SQLException;
  60.  
  61.   /**
  62.   * Read the next attribute in the stream as a Java int.
  63.   *
  64.   * @return the attribute; if the value is SQL NULL, return null.
  65.   */
  66.   int readInt () throws SQLException;
  67.  
  68.   /**
  69.   * Read the next attribute in the stream as a Java long.
  70.   *
  71.   * @return the attribute; if the value is SQL NULL, return null.
  72.   */
  73.   long readLong () throws SQLException;
  74.  
  75.   /**
  76.   * Read the next attribute in the stream as a Java float.
  77.   *
  78.   * @return the attribute; if the value is SQL NULL, return null.
  79.   */
  80.   float readFloat () throws SQLException;
  81.  
  82.   /**
  83.   * Read the next attribute in the stream as a Java double.
  84.   *
  85.   * @return the attribute; if the value is SQL NULL, return null.
  86.   */
  87.   double readDouble () throws SQLException;
  88.  
  89.   /**
  90.   * Read the next attribute in the stream as a java.math.BigDecimal object.
  91.   *
  92.   * @return the attribute; if the value is SQL NULL, return null.
  93.   */
  94.   java.math.BigDecimal readBigDecimal () throws SQLException;
  95.  
  96.   /**
  97.   * Read the next attribute in the stream as an array of bytes.
  98.   *
  99.   * @return the attribute; if the value is SQL NULL, return null.
  100.   */
  101.   byte[] readBytes () throws SQLException;
  102.  
  103.   /**
  104.   * Read the next attribute in the stream as a java.sql.Date object.
  105.   *
  106.   * @return the attribute; if the value is SQL NULL, return null.
  107.   */
  108.   java.sql.Date readDate () throws SQLException;
  109.  
  110.   /**
  111.   * Read the next attribute in the stream as a java.sql.Time object.
  112.   *
  113.   * @return the attribute; if the value is SQL NULL, return null.
  114.   */
  115.   java.sql.Time readTime () throws SQLException;
  116.  
  117.   /**
  118.   * Read the next attribute in the stream as a java.sql.Timestamp object.
  119.   *
  120.   * @return the attribute; if the value is SQL NULL, return null.
  121.   */
  122.   java.sql.Timestamp readTimestamp () throws SQLException;
  123.  
  124.   /**
  125.   * Return the next attribute in the stream as a stream of Unicode characters.
  126.   *
  127.   * @return the attribute; if the value is SQL NULL, return null.
  128.   */
  129.   java.io.Reader readCharacterStream () throws SQLException;
  130.  
  131.   /**
  132.   * Return the next attribute in the stream as a stream of ASCII characters.
  133.   *
  134.   * @return the attribute; if the value is SQL NULL, return null.
  135.   */
  136.   java.io.InputStream readAsciiStream () throws SQLException;
  137.  
  138.   /**
  139.   * Return the next attribute in the stream as a stream of uninterpreted
  140. bytes.
  141.   *
  142.   * @return the attribute; if the value is SQL NULL, return null.
  143.   */
  144.   java.io.InputStream readBinaryStream () throws SQLException;
  145.   
  146.   //================================================================
  147.   // Methods for reading items of SQL user-defined types from the stream.
  148.   //================================================================
  149.  
  150.   /**
  151.   * Return an object instance representing an SQL type.  The actual type
  152.   * of the object returned is determined by the default type mapping,
  153.   * and any customizations present in this stream's type map.
  154.   *
  155.   * A type map is registered with the stream by the JDBC driver before the
  156.   * stream is passed to the application.
  157.   *
  158.   * Raise exception if the next item in the stream is not a structured or 
  159.   * distinct type datum.
  160.   *
  161.   * When the datum at the head of the stream is an SQL NULL, 
  162.   * the method returns null.  Otherwise, it determines the SQL
  163.   * type of the datum at the head of the stream, constructs an
  164.   * object of the appropriate class, and calls method SQLData.readSQL 
  165.   * on that object, which reads additional data from the stream, using 
  166.   * the protocol described for SQLData.readSQL.
  167.   *
  168.   */
  169.   Object readObject () throws SQLException;
  170.  
  171.   /**
  172.   * Read a REF(<structured-type>) from the stream.
  173.   *
  174.   * @return an object representing data of an SQL REF Type
  175.   */
  176.   Ref readRef () throws SQLException;
  177.  
  178.   /**
  179.   * Read a LOCATOR(BLOB) from the stream.
  180.   *
  181.   * @return an object representing data of a locator to a BLOB
  182.   */
  183.   BlobLocator ReadBlobLocator () throws SQLException;
  184.  
  185.   /**
  186.   * Read a LOCATOR(CLOB) from the stream.
  187.   *
  188.   * @return an object representing data of a locator to a CLOB
  189.   */
  190.   ClobLocator readClobLocator () throws SQLException;
  191.  
  192.   /**
  193.   * Read a LOCATOR(<structured-type>) from the stream.
  194.   *
  195.   * @return an object representing data of a locator to an instance
  196.   * of a Structured Type
  197.   */
  198.   StructLocator readStructLocator () throws SQLException;
  199.  
  200.   /**
  201.   * Read a LOCATOR(<array>) from the stream.
  202.   *
  203.   * @return an object representing data of a locator to an SQL array
  204.   */
  205.   ArrayLocator readArrayLocator () throws SQLException;
  206.  
  207.   /**
  208.   * @return true iff the most recently gotten SQL value was null.
  209.   * 
  210.   */
  211.   boolean wasNull();
  212. }
  213.