jdk/src/java.sql/share/classes/java/sql/CallableStatement.java
changeset 25991 e48157b42439
parent 25976 4de01a56e3ee
parent 25859 3317bb8137f4
child 37880 60ec48925dc6
equal deleted inserted replaced
25876:d06a6d3c66c0 25991:e48157b42439
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
  1143      *
  1143      *
  1144      * <p>The JDBC specification specifies a standard mapping from
  1144      * <p>The JDBC specification specifies a standard mapping from
  1145      * Java <code>Object</code> types to SQL types.  The given argument
  1145      * Java <code>Object</code> types to SQL types.  The given argument
  1146      * will be converted to the corresponding SQL type before being
  1146      * will be converted to the corresponding SQL type before being
  1147      * sent to the database.
  1147      * sent to the database.
  1148      * <p>Note that this method may be used to pass datatabase-
  1148      * <p>Note that this method may be used to pass database-
  1149      * specific abstract data types, by using a driver-specific Java
  1149      * specific abstract data types, by using a driver-specific Java
  1150      * type.
  1150      * type.
  1151      *
  1151      *
  1152      * If the object is of a class implementing the interface <code>SQLData</code>,
  1152      * If the object is of a class implementing the interface <code>SQLData</code>,
  1153      * the JDBC driver should call the method <code>SQLData.writeSQL</code>
  1153      * the JDBC driver should call the method <code>SQLData.writeSQL</code>
  1880      */
  1880      */
  1881      void setClob(String parameterName, Reader reader, long length)
  1881      void setClob(String parameterName, Reader reader, long length)
  1882        throws SQLException;
  1882        throws SQLException;
  1883 
  1883 
  1884     /**
  1884     /**
  1885      * Sets the designated parameter to a <code>InputStream</code> object.  The <code>inputstream</code> must contain  the number
  1885      * Sets the designated parameter to a {@code InputStream} object.
       
  1886      * The <code>Inputstream</code> must contain the number
  1886      * of characters specified by length, otherwise a <code>SQLException</code> will be
  1887      * of characters specified by length, otherwise a <code>SQLException</code> will be
  1887      * generated when the <code>CallableStatement</code> is executed.
  1888      * generated when the <code>CallableStatement</code> is executed.
  1888      * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
  1889      * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
  1889      * method because it informs the driver that the parameter value should be
  1890      * method because it informs the driver that the parameter value should be
  1890      * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
  1891      * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
  1897      * @param inputStream An object that contains the data to set the parameter
  1898      * @param inputStream An object that contains the data to set the parameter
  1898      * value to.
  1899      * value to.
  1899      * @param length the number of bytes in the parameter data.
  1900      * @param length the number of bytes in the parameter data.
  1900      * @throws SQLException  if parameterName does not correspond to a named
  1901      * @throws SQLException  if parameterName does not correspond to a named
  1901      * parameter; if the length specified
  1902      * parameter; if the length specified
  1902      * is less than zero; if the number of bytes in the inputstream does not match
  1903      * is less than zero; if the number of bytes in the {@code InputStream}
  1903      * the specified length; if a database access error occurs or
  1904      * does not match the specified length; if a database access error occurs or
  1904      * this method is called on a closed <code>CallableStatement</code>
  1905      * this method is called on a closed <code>CallableStatement</code>
  1905      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
  1906      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
  1906      * this method
  1907      * this method
  1907      *
  1908      *
  1908      * @since 1.6
  1909      * @since 1.6
  2376      */
  2377      */
  2377      void setClob(String parameterName, Reader reader)
  2378      void setClob(String parameterName, Reader reader)
  2378        throws SQLException;
  2379        throws SQLException;
  2379 
  2380 
  2380     /**
  2381     /**
  2381      * Sets the designated parameter to a <code>InputStream</code> object.
  2382      * Sets the designated parameter to a {@code InputStream} object.
  2382      * This method differs from the <code>setBinaryStream (int, InputStream)</code>
  2383      * This method differs from the <code>setBinaryStream (int, InputStream)</code>
  2383      * method because it informs the driver that the parameter value should be
  2384      * method because it informs the driver that the parameter value should be
  2384      * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
  2385      * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
  2385      * the driver may have to do extra work to determine whether the parameter
  2386      * the driver may have to do extra work to determine whether the parameter
  2386      * data should be send to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
  2387      * data should be send to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
  2428 
  2429 
  2429     //------------------------- JDBC 4.1 -----------------------------------
  2430     //------------------------- JDBC 4.1 -----------------------------------
  2430 
  2431 
  2431 
  2432 
  2432     /**
  2433     /**
  2433      *<p>Returns an object representing the value of OUT parameter
  2434      * Returns an object representing the value of OUT parameter
  2434      * {@code parameterIndex} and will convert from the
  2435      * {@code parameterIndex} and will convert from the
  2435      * SQL type of the parameter to the requested Java data type, if the
  2436      * SQL type of the parameter to the requested Java data type, if the
  2436      * conversion is supported. If the conversion is not
  2437      * conversion is supported. If the conversion is not
  2437      * supported or null is specified for the type, a
  2438      * supported or null is specified for the type, a
  2438      * <code>SQLException</code> is thrown.
  2439      * <code>SQLException</code> is thrown.
  2457      */
  2458      */
  2458      public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException;
  2459      public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException;
  2459 
  2460 
  2460 
  2461 
  2461     /**
  2462     /**
  2462      *<p>Returns an object representing the value of OUT parameter
  2463      * Returns an object representing the value of OUT parameter
  2463      * {@code parameterName} and will convert from the
  2464      * {@code parameterName} and will convert from the
  2464      * SQL type of the parameter to the requested Java data type, if the
  2465      * SQL type of the parameter to the requested Java data type, if the
  2465      * conversion is supported. If the conversion is not
  2466      * conversion is supported. If the conversion is not
  2466      * supported  or null is specified for the type, a
  2467      * supported  or null is specified for the type, a
  2467      * <code>SQLException</code> is thrown.
  2468      * <code>SQLException</code> is thrown.
  2488      public <T> T getObject(String parameterName, Class<T> type) throws SQLException;
  2489      public <T> T getObject(String parameterName, Class<T> type) throws SQLException;
  2489 
  2490 
  2490      //------------------------- JDBC 4.2 -----------------------------------
  2491      //------------------------- JDBC 4.2 -----------------------------------
  2491 
  2492 
  2492      /**
  2493      /**
  2493      * <p>Sets the value of the designated parameter with the given object.
  2494      * Sets the value of the designated parameter with the given object.
  2494      *
  2495      *
  2495      * If the second argument is an {@code InputStream} then the stream
  2496      * If the second argument is an {@code InputStream} then the stream
  2496      * must contain the number of bytes specified by scaleOrLength.
  2497      * must contain the number of bytes specified by scaleOrLength.
  2497      * If the second argument is a {@code Reader} then the reader must
  2498      * If the second argument is a {@code Reader} then the reader must
  2498      * contain the number of characters specified
  2499      * contain the number of characters specified