jdk/src/share/classes/java/sql/ResultSet.java
changeset 15278 e081d3f73b75
parent 14342 8435a30053c1
child 18156 edb590d448c5
equal deleted inserted replaced
15277:245068ba31b3 15278:e081d3f73b75
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2013, 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
  1832                              java.io.Reader x,
  1832                              java.io.Reader x,
  1833                              int length) throws SQLException;
  1833                              int length) throws SQLException;
  1834 
  1834 
  1835     /**
  1835     /**
  1836      * Updates the designated column with an <code>Object</code> value.
  1836      * Updates the designated column with an <code>Object</code> value.
       
  1837      *
  1837      * The updater methods are used to update column values in the
  1838      * The updater methods are used to update column values in the
  1838      * current row or the insert row.  The updater methods do not
  1839      * current row or the insert row.  The updater methods do not
  1839      * update the underlying database; instead the <code>updateRow</code> or
  1840      * update the underlying database; instead the <code>updateRow</code> or
  1840      * <code>insertRow</code> methods are called to update the database.
  1841      * <code>insertRow</code> methods are called to update the database.
  1841      *<p>
  1842      *<p>
  1864     void updateObject(int columnIndex, Object x, int scaleOrLength)
  1865     void updateObject(int columnIndex, Object x, int scaleOrLength)
  1865       throws SQLException;
  1866       throws SQLException;
  1866 
  1867 
  1867     /**
  1868     /**
  1868      * Updates the designated column with an <code>Object</code> value.
  1869      * Updates the designated column with an <code>Object</code> value.
       
  1870      *
  1869      * The updater methods are used to update column values in the
  1871      * The updater methods are used to update column values in the
  1870      * current row or the insert row.  The updater methods do not
  1872      * current row or the insert row.  The updater methods do not
  1871      * update the underlying database; instead the <code>updateRow</code> or
  1873      * update the underlying database; instead the <code>updateRow</code> or
  1872      * <code>insertRow</code> methods are called to update the database.
  1874      * <code>insertRow</code> methods are called to update the database.
  1873      *
  1875      *
  2222                              java.io.Reader reader,
  2224                              java.io.Reader reader,
  2223                              int length) throws SQLException;
  2225                              int length) throws SQLException;
  2224 
  2226 
  2225     /**
  2227     /**
  2226      * Updates the designated column with an <code>Object</code> value.
  2228      * Updates the designated column with an <code>Object</code> value.
       
  2229      *
  2227      * The updater methods are used to update column values in the
  2230      * The updater methods are used to update column values in the
  2228      * current row or the insert row.  The updater methods do not
  2231      * current row or the insert row.  The updater methods do not
  2229      * update the underlying database; instead the <code>updateRow</code> or
  2232      * update the underlying database; instead the <code>updateRow</code> or
  2230      * <code>insertRow</code> methods are called to update the database.
  2233      * <code>insertRow</code> methods are called to update the database.
  2231      *<p>
  2234      *<p>
  2254     void updateObject(String columnLabel, Object x, int scaleOrLength)
  2257     void updateObject(String columnLabel, Object x, int scaleOrLength)
  2255       throws SQLException;
  2258       throws SQLException;
  2256 
  2259 
  2257     /**
  2260     /**
  2258      * Updates the designated column with an <code>Object</code> value.
  2261      * Updates the designated column with an <code>Object</code> value.
       
  2262      *
  2259      * The updater methods are used to update column values in the
  2263      * The updater methods are used to update column values in the
  2260      * current row or the insert row.  The updater methods do not
  2264      * current row or the insert row.  The updater methods do not
  2261      * update the underlying database; instead the <code>updateRow</code> or
  2265      * update the underlying database; instead the <code>updateRow</code> or
  2262      * <code>insertRow</code> methods are called to update the database.
  2266      * <code>insertRow</code> methods are called to update the database.
  2263      *
  2267      *
  4140      * this method
  4144      * this method
  4141      * @since 1.7
  4145      * @since 1.7
  4142      */
  4146      */
  4143      public <T> T getObject(String columnLabel, Class<T> type) throws SQLException;
  4147      public <T> T getObject(String columnLabel, Class<T> type) throws SQLException;
  4144 
  4148 
       
  4149     //------------------------- JDBC 4.2 -----------------------------------
       
  4150 
       
  4151     /**
       
  4152      * Updates the designated column with an {@code Object} value.
       
  4153      *
       
  4154      * The updater methods are used to update column values in the
       
  4155      * current row or the insert row.  The updater methods do not
       
  4156      * update the underlying database; instead the {@code updateRow} or
       
  4157      * {@code insertRow} methods are called to update the database.
       
  4158      *<p>
       
  4159      * If the second argument is an {@code InputStream} then the stream must contain
       
  4160      * the number of bytes specified by scaleOrLength.  If the second argument is a
       
  4161      * {@code Reader} then the reader must contain the number of characters specified
       
  4162      * by scaleOrLength. If these conditions are not true the driver will generate a
       
  4163      * {@code SQLException} when the statement is executed.
       
  4164      *<p>
       
  4165      * The default implementation will throw {@code SQLFeatureNotSupportedException}
       
  4166      *
       
  4167      * @param columnIndex the first column is 1, the second is 2, ...
       
  4168      * @param x the new column value
       
  4169      * @param targetSqlType the SQL type to be sent to the database
       
  4170      * @param scaleOrLength for an object of {@code java.math.BigDecimal} ,
       
  4171      *          this is the number of digits after the decimal point. For
       
  4172      *          Java Object types {@code InputStream} and {@code Reader},
       
  4173      *          this is the length
       
  4174      *          of the data in the stream or reader.  For all other types,
       
  4175      *          this value will be ignored.
       
  4176      * @exception SQLException if the columnIndex is not valid;
       
  4177      * if a database access error occurs;
       
  4178      * the result set concurrency is {@code CONCUR_READ_ONLY}
       
  4179      * or this method is called on a closed result set
       
  4180      * @exception SQLFeatureNotSupportedException if the JDBC driver does not
       
  4181      * support this method; if the JDBC driver does not support this data type
       
  4182      * @see JDBCType
       
  4183      * @see SQLType
       
  4184      * @since 1.8
       
  4185      */
       
  4186      default void updateObject(int columnIndex, Object x,
       
  4187              SQLType targetSqlType, int scaleOrLength)  throws SQLException {
       
  4188         throw new SQLFeatureNotSupportedException("updateObject not implemented");
       
  4189     }
       
  4190 
       
  4191     /**
       
  4192      * Updates the designated column with an {@code Object} value.
       
  4193      *
       
  4194      * The updater methods are used to update column values in the
       
  4195      * current row or the insert row.  The updater methods do not
       
  4196      * update the underlying database; instead the {@code updateRow} or
       
  4197      * {@code insertRow} methods are called to update the database.
       
  4198      *<p>
       
  4199      * If the second argument is an {@code InputStream} then the stream must
       
  4200      * contain number of bytes specified by scaleOrLength.  If the second
       
  4201      * argument is a {@code Reader} then the reader must contain the number
       
  4202      * of characters specified by scaleOrLength. If these conditions are not
       
  4203      * true the driver will generate a
       
  4204      * {@code SQLException} when the statement is executed.
       
  4205      *<p>
       
  4206      * The default implementation will throw {@code SQLFeatureNotSupportedException}
       
  4207      *
       
  4208      * @param columnLabel the label for the column specified with the SQL AS
       
  4209      * clause.  If the SQL AS clause was not specified, then the label is
       
  4210      * the name of the column
       
  4211      * @param targetSqlType the SQL type to be sent to the database
       
  4212      * @param scaleOrLength for an object of {@code java.math.BigDecimal} ,
       
  4213      *          this is the number of digits after the decimal point. For
       
  4214      *          Java Object types {@code InputStream} and {@code Reader},
       
  4215      *          this is the length
       
  4216      *          of the data in the stream or reader.  For all other types,
       
  4217      *          this value will be ignored.
       
  4218      * @exception SQLException if the columnLabel is not valid;
       
  4219      * if a database access error occurs;
       
  4220      * the result set concurrency is {@code CONCUR_READ_ONLY}
       
  4221      * or this method is called on a closed result set
       
  4222      * @exception SQLFeatureNotSupportedException if the JDBC driver does not
       
  4223      * support this method; if the JDBC driver does not support this data type
       
  4224      * @see JDBCType
       
  4225      * @see SQLType
       
  4226      * @since 1.8
       
  4227      */
       
  4228     default void updateObject(String columnLabel, Object x,
       
  4229             SQLType targetSqlType, int scaleOrLength) throws SQLException {
       
  4230         throw new SQLFeatureNotSupportedException("updateObject not implemented");
       
  4231     }
       
  4232 
       
  4233     /**
       
  4234      * Updates the designated column with an {@code Object} value.
       
  4235      *
       
  4236      * The updater methods are used to update column values in the
       
  4237      * current row or the insert row.  The updater methods do not
       
  4238      * update the underlying database; instead the {@code updateRow} or
       
  4239      * {@code insertRow} methods are called to update the database.
       
  4240      *<p>
       
  4241      * The default implementation will throw {@code SQLFeatureNotSupportedException}
       
  4242      *
       
  4243      * @param columnIndex the first column is 1, the second is 2, ...
       
  4244      * @param x the new column value
       
  4245      * @param targetSqlType the SQL type to be sent to the database
       
  4246      * @exception SQLException if the columnIndex is not valid;
       
  4247      * if a database access error occurs;
       
  4248      * the result set concurrency is {@code CONCUR_READ_ONLY}
       
  4249      * or this method is called on a closed result set
       
  4250      * @exception SQLFeatureNotSupportedException if the JDBC driver does not
       
  4251      * support this method; if the JDBC driver does not support this data type
       
  4252      * @see JDBCType
       
  4253      * @see SQLType
       
  4254      * @since 1.8
       
  4255      */
       
  4256     default void updateObject(int columnIndex, Object x, SQLType targetSqlType)
       
  4257             throws SQLException {
       
  4258         throw new SQLFeatureNotSupportedException("updateObject not implemented");
       
  4259     }
       
  4260 
       
  4261     /**
       
  4262      * Updates the designated column with an {@code Object} value.
       
  4263      *
       
  4264      * The updater methods are used to update column values in the
       
  4265      * current row or the insert row.  The updater methods do not
       
  4266      * update the underlying database; instead the {@code updateRow} or
       
  4267      * {@code insertRow} methods are called to update the database.
       
  4268      *<p>
       
  4269      * The default implementation will throw {@code SQLFeatureNotSupportedException}
       
  4270      *
       
  4271      * @param columnLabel the label for the column specified with the SQL AS
       
  4272      * clause.  If the SQL AS clause was not specified, then the label is
       
  4273      * the name of the column
       
  4274      * @param x the new column value
       
  4275      * @param targetSqlType the SQL type to be sent to the database
       
  4276      * @exception SQLException if the columnLabel is not valid;
       
  4277      * if a database access error occurs;
       
  4278      * the result set concurrency is {@code CONCUR_READ_ONLY}
       
  4279      * or this method is called on a closed result set
       
  4280      * @exception SQLFeatureNotSupportedException if the JDBC driver does not
       
  4281      * support this method; if the JDBC driver does not support this data type
       
  4282      * @see JDBCType
       
  4283      * @see SQLType
       
  4284      * @since 1.8
       
  4285      */
       
  4286     default void updateObject(String columnLabel, Object x,
       
  4287             SQLType targetSqlType) throws SQLException {
       
  4288         throw new SQLFeatureNotSupportedException("updateObject not implemented");
       
  4289     }
  4145 }
  4290 }