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

  1. /*
  2.  * @(#)SQLData.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.  * The SQLData interface is implemented by a Java class that is
  21.  * registered in a type mapping.
  22.  */
  23.  
  24. public interface SQLData {
  25.  
  26.   /** 
  27.   * Called by the JDBC driver to determine the name of the
  28.   * SQL user-defined type that is being passed to the database.
  29.   * The JDBC driver must accept an SQLType object that was created 
  30.   * by someone else.
  31.   *
  32.   * @returns the SQLType object that was passed to method readSql()
  33.   *          when this object was constructed and populated.
  34.   */
  35.   SQLType getSQLType ();
  36.  
  37.   /**
  38.   * Populate this object with data read from the database.
  39.   * The implementation of the method must follow this protocol:
  40.   * 
  41.   * Read each of the attributes or elements of the SQL
  42.   * type, by calling a method of the input stream to read each
  43.   * item, in the order that they appear in the SQL definition
  44.   * of the type.  Assign those data to appropriate fields or 
  45.   * elements (of this or other objects).
  46.   * Specifically, make these method calls:
  47.   * for a Distinct Type: read a single data element.
  48.   * for a Structured Type: read each each attribute of the SQL type.
  49.   *
  50.   * The JDBC driver initializes the input stream with a type map
  51.   * before calling this method which is used by the appropriate
  52.   * readXXX() methods on the stream.
  53.   *
  54.   * @param stream the input SQL data stream
  55.   * @param descriptor the SQL type of the value on the data stream
  56.   */
  57.   void readSQL (SQLInput stream, SQLType descriptor) throws SQLException;
  58.  
  59.   /**
  60.   * Write this object to the given SQL data stream.
  61.   * The implementation of the method must follow this protocol:
  62.   *
  63.   * Write each of the attributes of the SQL type, by calling a 
  64.   * method of the output stream to write each item, in the order that 
  65.   * they appear in the SQL definition of the type.
  66.   * Specifically, make these method calls:
  67.   * for a Distinct Type: write its single data element.
  68.   * for a Structured Type: write a value for each attribute of the SQL type.
  69.   *
  70.   * @param stream the output SQL data stream
  71.   */
  72.   void writeSQL (SQLOutput stream) throws SQLException;
  73. }
  74.  
  75.