home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / sql / SQLData.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  3.2 KB  |  85 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)SQLData.java    1.9 98/09/23
  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.  * The interface used for the custom mapping of SQL user-defined types.
  20.  * This interface must be implemented by a Java class that is
  21.  * registered in a type mapping.  It is expected that this interface
  22.  * will normally be implemented by a tool.  The methods in this interface
  23.  * are called by the driver and are never called by a programmer
  24.  * directly.
  25.  */
  26.  
  27. public interface SQLData {
  28.  
  29.  /** 
  30.   * Returns the fully-qualified 
  31.   * name of the SQL user-defined type that this object represents.
  32.   * This method is called by the JDBC driver to get the name of the
  33.   * UDT instance that is being mapped to this instance of SQLData.
  34.   *
  35.   * @returns the type name that was passed to the method <code>readSql</code>
  36.   *            when this object was constructed and populated
  37.   */
  38.   String getSQLTypeName() throws SQLException;
  39.  
  40.  /**
  41.   * Populates this object with data read from the database.
  42.   * The implementation of the method must follow this protocol:
  43.   * 
  44.   * It must read each of the attributes or elements of the SQL
  45.   * type  from the given input stream.  This is done 
  46.   * by calling a method of the input stream to read each
  47.   * item, in the order that they appear in the SQL definition
  48.   * of the type.  The method <code>readSQL</code> then
  49.   * assigns the data to appropriate fields or 
  50.   * elements (of this or other objects).
  51.   * Specifically, it must call the appropriate <code>SQLInput.readXXX</code> 
  52.   * method(s) to do the following:
  53.   * for a Distinct Type, read its single data element;
  54.   * for a Structured Type, read a value for each attribute of the SQL type.
  55.   *
  56.   * The JDBC driver initializes the input stream with a type map
  57.   * before calling this method, which is used by the appropriate
  58.   * <code>SQLInput.readXXX</code> method on the stream.
  59.   *
  60.   * @param stream the input SQL data stream
  61.   * @param descriptor the SQL type of the value on the data stream
  62.   * @see SQLInput
  63.   */
  64.   void readSQL (SQLInput stream, String typeName) throws SQLException;
  65.  
  66.   /**
  67.   * Writes this object to the given SQL data stream.
  68.   * The implementation of the method must follow this protocol:
  69.   *
  70.   * It must write each of the attributes of the SQL type
  71.   * to the given output stream.  This is done by calling a 
  72.   * method of the output stream to write each item, in the order that 
  73.   * they appear in the SQL definition of the type.
  74.   * Specifically, it must call the appropriate <code>SQLOutput.writeXXX</code> 
  75.   * method(s) to do the following:
  76.   * for a Distinct Type, write its single data element;
  77.   * for a Structured Type, write a value for each attribute of the SQL type.
  78.   *
  79.   * @param stream the output SQL data stream
  80.   * @see SQLOutput
  81.   */
  82.   void writeSQL (SQLOutput stream) throws SQLException;
  83. }
  84.  
  85.