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

  1. /*
  2.  * @(#)SQLOutput.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.  * When an object of a class implementing interface
  19.  * <code>SqlData</code> is passed as an argument to an SQL statement, the
  20.  * JDBC driver calls its <code>getSqlType</code> to determine kind of SQL
  21.  * datum being passed to the database.  It then calls its method
  22.  * <code>writeSql</code> with an argument of class <code>SqlOutput</code>
  23.  * which implements a <i>SQL data stream</i> that is being written to the
  24.  * database.  Method <code>writeSql</code> writes data from the object to
  25.  * that SQL data stream as the representation of an SQL complex type.
  26.  */
  27.  
  28.  public interface SQLOutput {
  29.  
  30.   //================================================================
  31.   // Methods for writing attributes to the stream of SQL data.
  32.   // These methods correspond to the column-accessor methods of
  33.   // java.sql.ResultSet.
  34.   //================================================================
  35.  
  36.   /**
  37.   * Write the next attribute to the stream as a Java String.
  38.   *
  39.   * @param x the value to pass to the database.
  40.   */
  41.   void writeString (String x) throws SQLException;
  42.  
  43.   /**
  44.   * Write the next attribute to the stream as a Java boolean.
  45.   *
  46.   * @param x the value to pass to the database.
  47.   */
  48.   void writeBoolean (boolean x) throws SQLException;
  49.  
  50.   /**
  51.   * Write the next attribute to the stream as a Java byte.
  52.   *
  53.   * @param x the value to pass to the database.
  54.   */
  55.   void writeByte (byte x) throws SQLException;
  56.  
  57.   /**
  58.   * Write the next attribute to the stream as a Java short.
  59.   *
  60.   * @param x the value to pass to the database.
  61.   */
  62.   void writeShort (short x) throws SQLException;
  63.  
  64.   /**
  65.   * Write the next attribute to the stream as a Java int.
  66.   *
  67.   * @param x the value to pass to the database.
  68.   */
  69.   void writeInt (int x) throws SQLException;
  70.  
  71.   /**
  72.   * Write the next attribute to the stream as a Java long.
  73.   *
  74.   * @param x the value to pass to the database.
  75.   */
  76.   void writeLong (long x) throws SQLException;
  77.  
  78.   /**
  79.   * Write the next attribute to the stream as a Java float.
  80.   *
  81.   * @param x the value to pass to the database.
  82.   */
  83.   void writeFloat (float x) throws SQLException;
  84.  
  85.   /**
  86.   * Write the next attribute to the stream as a Java double.
  87.   *
  88.   * @param x the value to pass to the database.
  89.   */
  90.   void writeDouble (double x) throws SQLException;
  91.  
  92.   /**
  93.   * Write the next attribute to the stream as a java.math.BigDecimal object.
  94.   *
  95.   * @param x the value to pass to the database.
  96.   */
  97.   void writeBigDecimal (java.math.BigDecimal x) throws SQLException;
  98.  
  99.   /**
  100.   * Write the next attribute to the stream as an array of bytes.
  101.   *
  102.   * @param x the value to pass to the database.
  103.   */
  104.   void writeBytes (byte[] x) throws SQLException;
  105.  
  106.   /**
  107.   * Write the next attribute to the stream as a java.sql.Date object.
  108.   *
  109.   * @param x the value to pass to the database.
  110.   */
  111.   void writeDate (java.sql.Date x) throws SQLException;
  112.  
  113.   /**
  114.   * Write the next attribute to the stream as a java.sql.Time object.
  115.   *
  116.   * @param x the value to pass to the database.
  117.   */
  118.   void writeTime (java.sql.Time x) throws SQLException;
  119.  
  120.   /**
  121.   * Write the next attribute to the stream as a java.sql.Timestamp object.
  122.   *
  123.   * @param x the value to pass to the database.
  124.   */
  125.   void writeTimestamp (java.sql.Timestamp x) throws SQLException;
  126.  
  127.   /**
  128.   * Return the next attribute to the stream as a stream of Unicode characters.
  129.   *
  130.   * @param x the value to pass to the database.
  131.   */
  132.   void writeCharacterStream (java.io.Reader x) throws SQLException;
  133.  
  134.   /**
  135.   * Return the next attribute to the stream as a stream of ASCII characters.
  136.   *
  137.   * @param x the value to pass to the database.
  138.   */
  139.   void writeAsciiStream (java.io.InputStream x) throws SQLException;
  140.  
  141.   /**
  142.   * Return the next attribute to the stream as a stream of uninterpreted
  143. bytes.
  144.   *
  145.   * @param x the value to pass to the database.
  146.   */
  147.   void writeBinaryStream (java.io.InputStream x) throws SQLException;
  148.   
  149.   //================================================================
  150.   // Methods for writing items of SQL user-defined types to the stream.
  151.   // These methods pass objects to the database as values of SQL
  152.   // Structured Types, Distinct Types, Constructed Types, and Locator
  153.   // Types.  They decompose the Java object(s) and write leaf data
  154.   // items using the methods above.
  155.   //================================================================
  156.  
  157.   /**
  158.   * Write to the stream the data contained in the given object,
  159.   * as a value of an SQL structured or distinct type.  When @x is null, 
  160.   * the method writes an SQL NULL to the stream.  Otherwise,
  161.   * it calls the SQLData.writeSQL method of the @x, which writes
  162.   * to the stream using the protocol described for SQLData.writeSQL.
  163.   * 
  164.   * @param x the object representing data of an SQL structured or
  165.   * distinct type
  166.   */
  167.   void writeObject (SQLData x) throws SQLException;
  168.  
  169.   /**
  170.   * Write a REF(<structured-type>) to the stream.
  171.   *
  172.   * @param x an object representing data of an SQL REF Type
  173.   */
  174.   void writeRef (Ref x) throws SQLException;
  175.  
  176.   /**
  177.   * Write a LOCATOR(BLOB) to the stream.
  178.   *
  179.   * @param x an object representing data of a locator to a BLOB
  180.   */
  181.   void writeBlobLocator (BlobLocator x) throws SQLException;
  182.  
  183.   /**
  184.   * Write a LOCATOR(CLOB) to the stream.
  185.   *
  186.   * @param x an object representing data of a locator to a CLOB
  187.   */
  188.   void writeClobLocator (ClobLocator x) throws SQLException;
  189.  
  190.   /**
  191.   * Write a LOCATOR(<structured-type>) to the stream.
  192.   *
  193.   * @param x an object representing data of a locator to an instance
  194.   * of a Structured Type
  195.   */
  196.   void writeStructLocator (StructLocator x) throws SQLException;
  197.  
  198.   /**
  199.   * Write a LOCATOR(<array>) to the stream.
  200.   *
  201.   * @param x an object representing data of a locator to an SQL array
  202.   */
  203.   void writeArrayLocator (ArrayLocator x) throws SQLException;
  204.  
  205. }
  206.  
  207.