package org.okip.service.dbc.api;



/*
   Copyright (c) 2002 Massachusetts Institute of Technology

   This work, including any software, documents, or other related items
   (the "Work"), is being provided by the copyright holder(s) subject to
   the terms of the MIT OKI(TM) API Definition License. By obtaining,
   using and/or copying this Work, you agree that you have read,
   understand, and will comply with the following terms and conditions of
   the MIT OKI(TM) API Definition License:

   You may use, copy, and distribute unmodified versions of this Work for
   any purpose, without fee or royalty, provided that you include the
   following on ALL copies of the Work that you make or distribute:

    *  The full text of the MIT OKI(TM) API Definition License in a
       location viewable to users of the redistributed Work.

    *  Any pre-existing intellectual property disclaimers, notices, or
       terms and conditions. If none exist, a short notice similar to the
       following should be used within the body of any redistributed
       Work: "Copyright (c) 2002 Massachusetts Institute of Technology. All
       Rights Reserved."

   You may modify or create Derivatives of this Work only for your
   internal purposes. You shall not distribute or transfer any such
   Derivative of this Work to any location or any other third party. For
   purposes of this license, "Derivative" shall mean any derivative of
   the Work as defined in the United States Copyright Act of 1976, such
   as a translation or modification.

   THIS WORK PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE WORK
   OR THE USE OR OTHER DEALINGS IN THE WORK.

   The name and trademarks of copyright holder(s) and/or MIT may NOT be
   used in advertising or publicity pertaining to the Work without
   specific, written prior permission. Title to copyright in the Work and
   any associated documentation will at all times remain with the
   copyright holders.

*/

/*
 * $Source: /cvs/oki/tech/src/org/okip/service/dbc/api/PreparedStatement.java,v $
 */

/**
 * An object that represents a precompiled SQL statement.
 *
 * <p>
 * Licensed under the {@link org.okip.service.ApiLicense MIT OKI&#153; API Definition License}.
 *
 * @version $Name:  $ / $Revision: 1.11 $ / $Date: 2002/09/12 18:57:33 $
 */
public interface PreparedStatement
extends Statement {

  /* methods which are in PreparedStatement in 1.4 but not in this interface:
     setAsciiStream
     setBinaryStream
     setCharacterStream
   */

  /**
   * Adds a set of parameters to this
   * PreparedStatement object's batch
   * of commands.
   *
   * @throws DbcException
   *
   */
  void addBatch()
  throws DbcException;

  /**
   * Clears the current parameter
   * values immediately.
   *
   * @throws DbcException
   *
   */
  void clearParameters()
  throws DbcException;

  /**
   * Executes the SQL statement in this
   * PreparedStatement object, which may
   * be any kind of SQL statement.
   *
   * @return boolean
   *
   * @throws DbcException
   *
   */
  boolean execute()
  throws DbcException;

  /**
   * Executes the SQL query in this
   * PreparedStatement object and returns
   * the ResultSet object generated by
   * the query.
   *
   * @return ResultSet
   *
   * @throws DbcException
   *
   */
  ResultSet executeQuery()
  throws DbcException;

  /**
   * Executes the SQL statement in this
   * PreparedStatement object, which must
   * be an SQL INSERT, UPDATE or DELETE
   * statement; or an SQL statement that
   * returns nothing, such as a DDL statement.
   *
   * @return int
   *
   * @throws DbcException
   *
   */
  int executeUpdate()
  throws DbcException;

  /**
   * Retrieves a java.sql.ResultSetMetaData object
   * that contains information about the
   * columns of the ResultSet object that
   * will be returned when this
   * PreparedStatement object is executed.
   *
   * @return ResultSetMetaData
   *
   * @throws DbcException
   *
   */
  ResultSetMetaData getMetaData()
  throws DbcException;

  /**
   * Retrieves the number, types and properties
   * of this PreparedStatement object's parameters.
   *
   * @return ParameterMetaData
   *
   * @throws DbcException
   *
   */
  ParameterMetaData getParameterMetaData()
  throws DbcException;

  /**
   * Sets the designated parameter
   * to the given Array object.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setArray(int parameterIndex, Array x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given java.math.BigDecimal value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setBigDecimal(int parameterIndex, java.math.BigDecimal x)
  throws DbcException;

  /**
   * Sets the designated parameter
   * to the given Blob object.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setBlob(int parameterIndex, Blob x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java boolean value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setBoolean(int parameterIndex, boolean x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java byte value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setByte(int parameterIndex, byte x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java array of bytes.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setBytes(int parameterIndex, byte[] x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Clob object.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setClob(int parameterIndex, Clob x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given java.sql.Date value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setDate(int parameterIndex, java.sql.Date x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given java.sql.Date value,
   * using the given Calendar object.
   *
   *
   * @param parameterIndex
   * @param x
   * @param cal
   *
   * @throws DbcException
   *
   */
  void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java double value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setDouble(int parameterIndex, double x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java float value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setFloat(int parameterIndex, float x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java int value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setInt(int parameterIndex, int x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java long value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setLong(int parameterIndex, long x)
  throws DbcException;

  /**
   * Sets the designated parameter
   * to SQL NULL.
   *
   *
   * @param parameterIndex
   * @param sqlType
   *
   * @throws DbcException
   *
   */
  void setNull(int parameterIndex, int sqlType)
  throws DbcException;

  /**
   * Sets the designated parameter
   * to SQL NULL.
   *
   *
   * @param paramIndex
   * @param sqlType
   * @param typeName
   *
   * @throws DbcException
   *
   */
  void setNull(int paramIndex, int sqlType, String typeName)
  throws DbcException;

  /**
   * Sets the value of the designated
   * parameter using the given object.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setObject(int parameterIndex, Object x)
  throws DbcException;

  /**
   * Sets the value of the designated
   * parameter with the given object.
   *
   *
   * @param parameterIndex
   * @param x
   * @param targetSqlType
   *
   * @throws DbcException
   *
   */
  void setObject(int parameterIndex, Object x, int targetSqlType)
  throws DbcException;

  /**
   * Sets the value of the designated
   * parameter with the given object.
   *
   *
   * @param parameterIndex
   * @param x
   * @param targetSqlType
   * @param scale
   *
   * @throws DbcException
   *
   */
  void setObject(int parameterIndex, Object x, int targetSqlType, int scale)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given REF(<structured-type>) value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setRef(int parameterIndex, java.sql.Ref x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java short value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setShort(int parameterIndex, short x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given Java String value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setString(int parameterIndex, String x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given java.sql.Time value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setTime(int parameterIndex, java.sql.Time x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given java.sql.Time value,
   * using the given Calendar object.
   *
   *
   * @param parameterIndex
   * @param x
   * @param cal
   *
   * @throws DbcException
   *
   */
  void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given java.sql.Timestamp value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setTimestamp(int parameterIndex, java.sql.Timestamp x)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given java.sql.Timestamp value,
   * using the given java.util.Calendar object.
   *
   *
   * @param parameterIndex
   * @param x
   * @param cal
   *
   * @throws DbcException
   *
   */
  void setTimestamp(int parameterIndex, java.sql.Timestamp x,
                    java.util.Calendar cal)
  throws DbcException;

  /**
   * Sets the designated parameter to
   * the given java.net.URL value.
   *
   *
   * @param parameterIndex
   * @param x
   *
   * @throws DbcException
   *
   */
  void setURL(int parameterIndex, java.net.URL x)
  throws DbcException;

}
