1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
710 void setDouble(int parameterIndex, double x) throws SQLException;
711
712 /**
713 * Sets the designated parameter to the given Java <code>double</code> value.
714 * The driver converts this
715 * to an SQL <code>DOUBLE</code> value when it sends it to the database.
716 *
717 * @param parameterName the name of the parameter
718 * @param x the parameter value
719 * @exception SQLException if a database access error occurs or
720 * this method is called on a closed <code>CallableStatement</code>
721 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
722 * this method
723 * @see #getDouble
724 * @since 1.4
725 */
726 void setDouble(String parameterName, double x) throws SQLException;
727
728 /**
729 * Sets the designated parameter in this <code>RowSet</code> object's command
730 * to the given <code>java.math.BigDeciaml</code> value.
731 * The driver converts this to
732 * an SQL <code>NUMERIC</code> value before sending it to the database.
733 *
734 * @param parameterIndex the first parameter is 1, the second is 2, ...
735 * @param x the parameter value
736 * @exception SQLException if a database access error occurs
737 */
738 void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException;
739
740 /**
741 * Sets the designated parameter to the given
742 * <code>java.math.BigDecimal</code> value.
743 * The driver converts this to an SQL <code>NUMERIC</code> value when
744 * it sends it to the database.
745 *
746 * @param parameterName the name of the parameter
747 * @param x the parameter value
748 * @exception SQLException if a database access error occurs or
749 * this method is called on a closed <code>CallableStatement</code>
750 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
1199 * an instance of the class <code>Integer</code> for an <code>int</code>).
1200 *
1201 * If the second argument is an <code>InputStream</code> then the stream must contain
1202 * the number of bytes specified by scaleOrLength. If the second argument is a
1203 * <code>Reader</code> then the reader must contain the number of characters specified * by scaleOrLength. If these conditions are not true the driver will generate a
1204 * <code>SQLException</code> when the prepared statement is executed.
1205 *
1206 * <p>The given Java object will be converted to the targetSqlType
1207 * before being sent to the database.
1208 * <P>
1209 * If the object is of a class implementing <code>SQLData</code>,
1210 * the rowset should call the method <code>SQLData.writeSQL</code>
1211 * to write the object to an <code>SQLOutput</code> data stream.
1212 * If, on the other hand, the object is of a class implementing
1213 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
1214 * <code>Struct</code>, <code>java.net.URL</code>,
1215 * or <code>Array</code>, the driver should pass it to the database as a
1216 * value of the corresponding SQL type.
1217 *
1218 *
1219 * <p>Note that this method may be used to pass datatabase-specific
1220 * abstract data types.
1221 *
1222 * @param parameterIndex the first parameter is 1, the second is 2, ...
1223 * @param x the object containing the input parameter value
1224 * @param targetSqlType the SQL type (as defined in <code>java.sql.Types</code>)
1225 * to be sent to the database. The scale argument may further qualify this
1226 * type.
1227 * @param scaleOrLength for <code>java.sql.Types.DECIMAL</code>
1228 * or <code>java.sql.Types.NUMERIC types</code>,
1229 * this is the number of digits after the decimal point. For
1230 * Java Object types <code>InputStream</code> and <code>Reader</code>,
1231 * this is the length
1232 * of the data in the stream or reader. For all other types,
1233 * this value will be ignored.
1234 * @exception SQLException if a database access error occurs
1235 * @see java.sql.Types
1236 */
1237 void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength)
1238 throws SQLException;
1239
1240 /**
1241 * Sets the value of the designated parameter with the given object. The second
1242 * argument must be an object type; for integral values, the
1243 * <code>java.lang</code> equivalent objects should be used.
1244 *
1245 * <p>The given Java object will be converted to the given targetSqlType
1246 * before being sent to the database.
1247 *
1248 * If the object has a custom mapping (is of a class implementing the
1249 * interface <code>SQLData</code>),
1250 * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it
1251 * to the SQL data stream.
1252 * If, on the other hand, the object is of a class implementing
1253 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
1254 * <code>Struct</code>, <code>java.net.URL</code>,
1255 * or <code>Array</code>, the driver should pass it to the database as a
1256 * value of the corresponding SQL type.
1257 * <P>
1258 * Note that this method may be used to pass datatabase-
1259 * specific abstract data types.
1260 *
1261 * @param parameterName the name of the parameter
1262 * @param x the object containing the input parameter value
1263 * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
1264 * sent to the database. The scale argument may further qualify this type.
1265 * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
1266 * this is the number of digits after the decimal point. For all other
1267 * types, this value will be ignored.
1268 * @exception SQLException if a database access error occurs or
1269 * this method is called on a closed <code>CallableStatement</code>
1270 * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
1271 * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
1272 * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
1273 * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
1274 * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
1275 * or <code>STRUCT</code> data type and the JDBC driver does not support
1276 * this data type
1277 * @see Types
1278 * @see #getObject
1318 * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
1319 * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
1320 * or <code>STRUCT</code> data type and the JDBC driver does not support
1321 * this data type
1322 * @see #getObject
1323 * @since 1.4
1324 */
1325 void setObject(String parameterName, Object x, int targetSqlType)
1326 throws SQLException;
1327
1328 /**
1329 * Sets the value of the designated parameter with the given object.
1330 * The second parameter must be of type <code>Object</code>; therefore, the
1331 * <code>java.lang</code> equivalent objects should be used for built-in types.
1332 *
1333 * <p>The JDBC specification specifies a standard mapping from
1334 * Java <code>Object</code> types to SQL types. The given argument
1335 * will be converted to the corresponding SQL type before being
1336 * sent to the database.
1337 *
1338 * <p>Note that this method may be used to pass datatabase-
1339 * specific abstract data types, by using a driver-specific Java
1340 * type.
1341 *
1342 * If the object is of a class implementing the interface <code>SQLData</code>,
1343 * the JDBC driver should call the method <code>SQLData.writeSQL</code>
1344 * to write it to the SQL data stream.
1345 * If, on the other hand, the object is of a class implementing
1346 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
1347 * <code>Struct</code>, <code>java.net.URL</code>,
1348 * or <code>Array</code>, the driver should pass it to the database as a
1349 * value of the corresponding SQL type.
1350 * <P>
1351 * This method throws an exception if there is an ambiguity, for example, if the
1352 * object is of a class implementing more than one of the interfaces named above.
1353 *
1354 * @param parameterName the name of the parameter
1355 * @param x the object containing the input parameter value
1356 * @exception SQLException if a database access error occurs,
1357 * this method is called on a closed <code>CallableStatement</code> or if the given
1358 * <code>Object</code> parameter is ambiguous
1359 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
1360 * this method
1361 * @see #getObject
1362 * @since 1.4
1363 */
1364 void setObject(String parameterName, Object x) throws SQLException;
1365
1366 /**
1367 * Sets the designated parameter in this <code>RowSet</code> object's command
1368 * with a Java <code>Object</code>. For integral values, the
1369 * <code>java.lang</code> equivalent objects should be used.
1370 *
1371 * <p>The JDBC specification provides a standard mapping from
1372 * Java Object types to SQL types. The driver will convert the
1373 * given Java object to its standard SQL mapping before sending it
1374 * to the database.
1375 *
1376 * <p>Note that this method may be used to pass datatabase-specific
1377 * abstract data types by using a driver-specific Java type.
1378 *
1379 * If the object is of a class implementing <code>SQLData</code>,
1380 * the rowset should call the method <code>SQLData.writeSQL</code>
1381 * to write the object to an <code>SQLOutput</code> data stream.
1382 * If, on the other hand, the object is of a class implementing
1383 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
1384 * <code>Struct</code>, <code>java.net.URL</code>,
1385 * or <code>Array</code>, the driver should pass it to the database as a
1386 * value of the corresponding SQL type.
1387 *
1388 * <P>
1389 * An exception is thrown if there is an ambiguity, for example, if the
1390 * object is of a class implementing more than one of these interfaces.
1391 *
1392 * @param parameterIndex The first parameter is 1, the second is 2, ...
1393 * @param x The object containing the input parameter value
1394 * @exception SQLException if a database access error occurs
1395 */
1396 void setObject(int parameterIndex, Object x) throws SQLException;
1403 *
1404 * @param i the first parameter is 1, the second is 2, ...
1405 * @param x an object representing data of an SQL <code>REF</code> type
1406 * @exception SQLException if a database access error occurs
1407 */
1408 void setRef (int i, Ref x) throws SQLException;
1409
1410 /**
1411 * Sets the designated parameter in this <code>RowSet</code> object's command
1412 * with the given <code>Blob</code> value. The driver will convert this
1413 * to the <code>BLOB</code> value that the <code>Blob</code> object
1414 * represents before sending it to the database.
1415 *
1416 * @param i the first parameter is 1, the second is 2, ...
1417 * @param x an object representing a BLOB
1418 * @exception SQLException if a database access error occurs
1419 */
1420 void setBlob (int i, Blob x) throws SQLException;
1421
1422 /**
1423 * Sets the designated parameter to a <code>InputStream</code> object. The inputstream must contain the number
1424 * of characters specified by length otherwise a <code>SQLException</code> will be
1425 * generated when the <code>PreparedStatement</code> is executed.
1426 * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
1427 * method because it informs the driver that the parameter value should be
1428 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
1429 * the driver may have to do extra work to determine whether the parameter
1430 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
1431 * @param parameterIndex index of the first parameter is 1,
1432 * the second is 2, ...
1433 * @param inputStream An object that contains the data to set the parameter
1434 * value to.
1435 * @param length the number of bytes in the parameter data.
1436 * @throws SQLException if a database access error occurs,
1437 * this method is called on a closed <code>PreparedStatement</code>,
1438 * if parameterIndex does not correspond
1439 * to a parameter marker in the SQL statement, if the length specified
1440 * is less than zero or if the number of bytes in the inputstream does not match
1441 * the specified length.
1442 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
1443 *
1444 * @since 1.6
1445 */
1446 void setBlob(int parameterIndex, InputStream inputStream, long length)
1447 throws SQLException;
1448
1449 /**
1450 * Sets the designated parameter to a <code>InputStream</code> object.
1451 * This method differs from the <code>setBinaryStream (int, InputStream)</code>
1452 * method because it informs the driver that the parameter value should be
1453 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
1454 * the driver may have to do extra work to determine whether the parameter
1455 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
1456 *
1457 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
1458 * it might be more efficient to use a version of
1459 * <code>setBlob</code> which takes a length parameter.
1460 *
1461 * @param parameterIndex index of the first parameter is 1,
1462 * the second is 2, ...
1463 * @param inputStream An object that contains the data to set the parameter
1464 * value to.
1465 * @throws SQLException if a database access error occurs,
1466 * this method is called on a closed <code>PreparedStatement</code> or
1467 * if parameterIndex does not correspond
1468 * to a parameter marker in the SQL statement,
1469 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
1470 *
1471 * @since 1.6
1472 */
1473 void setBlob(int parameterIndex, InputStream inputStream)
1474 throws SQLException;
1475
1476 /**
1477 * Sets the designated parameter to a <code>InputStream</code> object. The <code>inputstream</code> must contain the number
1478 * of characters specified by length, otherwise a <code>SQLException</code> will be
1479 * generated when the <code>CallableStatement</code> is executed.
1480 * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
1481 * method because it informs the driver that the parameter value should be
1482 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
1483 * the driver may have to do extra work to determine whether the parameter
1484 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
1485 *
1486 * @param parameterName the name of the parameter to be set
1487 * the second is 2, ...
1488 *
1489 * @param inputStream An object that contains the data to set the parameter
1490 * value to.
1491 * @param length the number of bytes in the parameter data.
1492 * @throws SQLException if parameterIndex does not correspond
1493 * to a parameter marker in the SQL statement, or if the length specified
1494 * is less than zero; if the number of bytes in the inputstream does not match
1495 * the specified length; if a database access error occurs or
1496 * this method is called on a closed <code>CallableStatement</code>
1497 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
1498 * this method
1499 *
1500 * @since 1.6
1501 */
1502 void setBlob(String parameterName, InputStream inputStream, long length)
1503 throws SQLException;
1504
1505 /**
1506 * Sets the designated parameter to the given <code>java.sql.Blob</code> object.
1507 * The driver converts this to an SQL <code>BLOB</code> value when it
1508 * sends it to the database.
1509 *
1510 * @param parameterName the name of the parameter
1511 * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
1512 * @exception SQLException if a database access error occurs or
1513 * this method is called on a closed <code>CallableStatement</code>
1514 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
1537 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
1538 *
1539 * @since 1.6
1540 */
1541 void setBlob(String parameterName, InputStream inputStream)
1542 throws SQLException;
1543
1544 /**
1545 * Sets the designated parameter in this <code>RowSet</code> object's command
1546 * with the given <code>Clob</code> value. The driver will convert this
1547 * to the <code>CLOB</code> value that the <code>Clob</code> object
1548 * represents before sending it to the database.
1549 *
1550 * @param i the first parameter is 1, the second is 2, ...
1551 * @param x an object representing a CLOB
1552 * @exception SQLException if a database access error occurs
1553 */
1554 void setClob (int i, Clob x) throws SQLException;
1555
1556 /**
1557 * Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number
1558 * of characters specified by length otherwise a <code>SQLException</code> will be
1559 * generated when the <code>PreparedStatement</code> is executed.
1560 *This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
1561 * because it informs the driver that the parameter value should be sent to
1562 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the
1563 * driver may have to do extra work to determine whether the parameter
1564 * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
1565 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
1566 * @param reader An object that contains the data to set the parameter value to.
1567 * @param length the number of characters in the parameter data.
1568 * @throws SQLException if a database access error occurs, this method is called on
1569 * a closed <code>PreparedStatement</code>, if parameterIndex does not correspond to a parameter
1570 * marker in the SQL statement, or if the length specified is less than zero.
1571 *
1572 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
1573 * @since 1.6
1574 */
1575 void setClob(int parameterIndex, Reader reader, long length)
1576 throws SQLException;
1577
2038 * this method is called on a closed <code>CallableStatement</code>
2039 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2040 * @since 1.6
2041 */
2042 void setNCharacterStream(String parameterName, Reader value) throws SQLException;
2043
2044 /**
2045 * Sets the designated parameter to a <code>java.sql.NClob</code> object. The object
2046 * implements the <code>java.sql.NClob</code> interface. This <code>NClob</code>
2047 * object maps to a SQL <code>NCLOB</code>.
2048 * @param parameterName the name of the column to be set
2049 * @param value the parameter value
2050 * @throws SQLException if the driver does not support national
2051 * character sets; if the driver can detect that a data conversion
2052 * error could occur; or if a database access error occurs
2053 * @since 1.6
2054 */
2055 void setNClob(String parameterName, NClob value) throws SQLException;
2056
2057 /**
2058 * Sets the designated parameter to a <code>Reader</code> object. The <code>reader</code> must contain the number
2059 * of characters specified by length otherwise a <code>SQLException</code> will be
2060 * generated when the <code>CallableStatement</code> is executed.
2061 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
2062 * because it informs the driver that the parameter value should be sent to
2063 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the
2064 * driver may have to do extra work to determine whether the parameter
2065 * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
2066 *
2067 * @param parameterName the name of the parameter to be set
2068 * @param reader An object that contains the data to set the parameter value to.
2069 * @param length the number of characters in the parameter data.
2070 * @throws SQLException if parameterIndex does not correspond to a parameter
2071 * marker in the SQL statement; if the length specified is less than zero;
2072 * if the driver does not support national
2073 * character sets; if the driver can detect that a data conversion
2074 * error could occur; if a database access error occurs or
2075 * this method is called on a closed <code>CallableStatement</code>
2076 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
2077 * this method
2078 * @since 1.6
2088 * driver may have to do extra work to determine whether the parameter
2089 * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
2090 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2091 * it might be more efficient to use a version of
2092 * <code>setNClob</code> which takes a length parameter.
2093 *
2094 * @param parameterName the name of the parameter
2095 * @param reader An object that contains the data to set the parameter value to.
2096 * @throws SQLException if the driver does not support national character sets;
2097 * if the driver can detect that a data conversion
2098 * error could occur; if a database access error occurs or
2099 * this method is called on a closed <code>CallableStatement</code>
2100 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2101 *
2102 * @since 1.6
2103 */
2104 void setNClob(String parameterName, Reader reader)
2105 throws SQLException;
2106
2107 /**
2108 * Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number
2109 * of characters specified by length otherwise a <code>SQLException</code> will be
2110 * generated when the <code>PreparedStatement</code> is executed.
2111 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
2112 * because it informs the driver that the parameter value should be sent to
2113 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the
2114 * driver may have to do extra work to determine whether the parameter
2115 * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
2116 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
2117 * @param reader An object that contains the data to set the parameter value to.
2118 * @param length the number of characters in the parameter data.
2119 * @throws SQLException if parameterIndex does not correspond to a parameter
2120 * marker in the SQL statement; if the length specified is less than zero;
2121 * if the driver does not support national character sets;
2122 * if the driver can detect that a data conversion
2123 * error could occur; if a database access error occurs or
2124 * this method is called on a closed <code>PreparedStatement</code>
2125 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2126 *
2127 * @since 1.6
2128 */
|
1 /*
2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
710 void setDouble(int parameterIndex, double x) throws SQLException;
711
712 /**
713 * Sets the designated parameter to the given Java <code>double</code> value.
714 * The driver converts this
715 * to an SQL <code>DOUBLE</code> value when it sends it to the database.
716 *
717 * @param parameterName the name of the parameter
718 * @param x the parameter value
719 * @exception SQLException if a database access error occurs or
720 * this method is called on a closed <code>CallableStatement</code>
721 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
722 * this method
723 * @see #getDouble
724 * @since 1.4
725 */
726 void setDouble(String parameterName, double x) throws SQLException;
727
728 /**
729 * Sets the designated parameter in this <code>RowSet</code> object's command
730 * to the given {@code java.math.BigDecimal} value.
731 * The driver converts this to
732 * an SQL <code>NUMERIC</code> value before sending it to the database.
733 *
734 * @param parameterIndex the first parameter is 1, the second is 2, ...
735 * @param x the parameter value
736 * @exception SQLException if a database access error occurs
737 */
738 void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException;
739
740 /**
741 * Sets the designated parameter to the given
742 * <code>java.math.BigDecimal</code> value.
743 * The driver converts this to an SQL <code>NUMERIC</code> value when
744 * it sends it to the database.
745 *
746 * @param parameterName the name of the parameter
747 * @param x the parameter value
748 * @exception SQLException if a database access error occurs or
749 * this method is called on a closed <code>CallableStatement</code>
750 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
1199 * an instance of the class <code>Integer</code> for an <code>int</code>).
1200 *
1201 * If the second argument is an <code>InputStream</code> then the stream must contain
1202 * the number of bytes specified by scaleOrLength. If the second argument is a
1203 * <code>Reader</code> then the reader must contain the number of characters specified * by scaleOrLength. If these conditions are not true the driver will generate a
1204 * <code>SQLException</code> when the prepared statement is executed.
1205 *
1206 * <p>The given Java object will be converted to the targetSqlType
1207 * before being sent to the database.
1208 * <P>
1209 * If the object is of a class implementing <code>SQLData</code>,
1210 * the rowset should call the method <code>SQLData.writeSQL</code>
1211 * to write the object to an <code>SQLOutput</code> data stream.
1212 * If, on the other hand, the object is of a class implementing
1213 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
1214 * <code>Struct</code>, <code>java.net.URL</code>,
1215 * or <code>Array</code>, the driver should pass it to the database as a
1216 * value of the corresponding SQL type.
1217 *
1218 *
1219 * <p>Note that this method may be used to pass database-specific
1220 * abstract data types.
1221 *
1222 * @param parameterIndex the first parameter is 1, the second is 2, ...
1223 * @param x the object containing the input parameter value
1224 * @param targetSqlType the SQL type (as defined in <code>java.sql.Types</code>)
1225 * to be sent to the database. The scale argument may further qualify this
1226 * type.
1227 * @param scaleOrLength for <code>java.sql.Types.DECIMAL</code>
1228 * or <code>java.sql.Types.NUMERIC types</code>,
1229 * this is the number of digits after the decimal point. For
1230 * Java Object types <code>InputStream</code> and <code>Reader</code>,
1231 * this is the length
1232 * of the data in the stream or reader. For all other types,
1233 * this value will be ignored.
1234 * @exception SQLException if a database access error occurs
1235 * @see java.sql.Types
1236 */
1237 void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength)
1238 throws SQLException;
1239
1240 /**
1241 * Sets the value of the designated parameter with the given object. The second
1242 * argument must be an object type; for integral values, the
1243 * <code>java.lang</code> equivalent objects should be used.
1244 *
1245 * <p>The given Java object will be converted to the given targetSqlType
1246 * before being sent to the database.
1247 *
1248 * If the object has a custom mapping (is of a class implementing the
1249 * interface <code>SQLData</code>),
1250 * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it
1251 * to the SQL data stream.
1252 * If, on the other hand, the object is of a class implementing
1253 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
1254 * <code>Struct</code>, <code>java.net.URL</code>,
1255 * or <code>Array</code>, the driver should pass it to the database as a
1256 * value of the corresponding SQL type.
1257 * <P>
1258 * Note that this method may be used to pass database-
1259 * specific abstract data types.
1260 *
1261 * @param parameterName the name of the parameter
1262 * @param x the object containing the input parameter value
1263 * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
1264 * sent to the database. The scale argument may further qualify this type.
1265 * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
1266 * this is the number of digits after the decimal point. For all other
1267 * types, this value will be ignored.
1268 * @exception SQLException if a database access error occurs or
1269 * this method is called on a closed <code>CallableStatement</code>
1270 * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
1271 * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
1272 * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
1273 * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
1274 * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
1275 * or <code>STRUCT</code> data type and the JDBC driver does not support
1276 * this data type
1277 * @see Types
1278 * @see #getObject
1318 * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
1319 * <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
1320 * or <code>STRUCT</code> data type and the JDBC driver does not support
1321 * this data type
1322 * @see #getObject
1323 * @since 1.4
1324 */
1325 void setObject(String parameterName, Object x, int targetSqlType)
1326 throws SQLException;
1327
1328 /**
1329 * Sets the value of the designated parameter with the given object.
1330 * The second parameter must be of type <code>Object</code>; therefore, the
1331 * <code>java.lang</code> equivalent objects should be used for built-in types.
1332 *
1333 * <p>The JDBC specification specifies a standard mapping from
1334 * Java <code>Object</code> types to SQL types. The given argument
1335 * will be converted to the corresponding SQL type before being
1336 * sent to the database.
1337 *
1338 * <p>Note that this method may be used to pass database-
1339 * specific abstract data types, by using a driver-specific Java
1340 * type.
1341 *
1342 * If the object is of a class implementing the interface <code>SQLData</code>,
1343 * the JDBC driver should call the method <code>SQLData.writeSQL</code>
1344 * to write it to the SQL data stream.
1345 * If, on the other hand, the object is of a class implementing
1346 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
1347 * <code>Struct</code>, <code>java.net.URL</code>,
1348 * or <code>Array</code>, the driver should pass it to the database as a
1349 * value of the corresponding SQL type.
1350 * <P>
1351 * This method throws an exception if there is an ambiguity, for example, if the
1352 * object is of a class implementing more than one of the interfaces named above.
1353 *
1354 * @param parameterName the name of the parameter
1355 * @param x the object containing the input parameter value
1356 * @exception SQLException if a database access error occurs,
1357 * this method is called on a closed <code>CallableStatement</code> or if the given
1358 * <code>Object</code> parameter is ambiguous
1359 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
1360 * this method
1361 * @see #getObject
1362 * @since 1.4
1363 */
1364 void setObject(String parameterName, Object x) throws SQLException;
1365
1366 /**
1367 * Sets the designated parameter in this <code>RowSet</code> object's command
1368 * with a Java <code>Object</code>. For integral values, the
1369 * <code>java.lang</code> equivalent objects should be used.
1370 *
1371 * <p>The JDBC specification provides a standard mapping from
1372 * Java Object types to SQL types. The driver will convert the
1373 * given Java object to its standard SQL mapping before sending it
1374 * to the database.
1375 *
1376 * <p>Note that this method may be used to pass database-specific
1377 * abstract data types by using a driver-specific Java type.
1378 *
1379 * If the object is of a class implementing <code>SQLData</code>,
1380 * the rowset should call the method <code>SQLData.writeSQL</code>
1381 * to write the object to an <code>SQLOutput</code> data stream.
1382 * If, on the other hand, the object is of a class implementing
1383 * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>,
1384 * <code>Struct</code>, <code>java.net.URL</code>,
1385 * or <code>Array</code>, the driver should pass it to the database as a
1386 * value of the corresponding SQL type.
1387 *
1388 * <P>
1389 * An exception is thrown if there is an ambiguity, for example, if the
1390 * object is of a class implementing more than one of these interfaces.
1391 *
1392 * @param parameterIndex The first parameter is 1, the second is 2, ...
1393 * @param x The object containing the input parameter value
1394 * @exception SQLException if a database access error occurs
1395 */
1396 void setObject(int parameterIndex, Object x) throws SQLException;
1403 *
1404 * @param i the first parameter is 1, the second is 2, ...
1405 * @param x an object representing data of an SQL <code>REF</code> type
1406 * @exception SQLException if a database access error occurs
1407 */
1408 void setRef (int i, Ref x) throws SQLException;
1409
1410 /**
1411 * Sets the designated parameter in this <code>RowSet</code> object's command
1412 * with the given <code>Blob</code> value. The driver will convert this
1413 * to the <code>BLOB</code> value that the <code>Blob</code> object
1414 * represents before sending it to the database.
1415 *
1416 * @param i the first parameter is 1, the second is 2, ...
1417 * @param x an object representing a BLOB
1418 * @exception SQLException if a database access error occurs
1419 */
1420 void setBlob (int i, Blob x) throws SQLException;
1421
1422 /**
1423 * Sets the designated parameter to a <code>InputStream</code> object.
1424 * The <code>InputStream</code> must contain the number
1425 * of characters specified by length otherwise a <code>SQLException</code> will be
1426 * generated when the <code>PreparedStatement</code> is executed.
1427 * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
1428 * method because it informs the driver that the parameter value should be
1429 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
1430 * the driver may have to do extra work to determine whether the parameter
1431 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
1432 * @param parameterIndex index of the first parameter is 1,
1433 * the second is 2, ...
1434 * @param inputStream An object that contains the data to set the parameter
1435 * value to.
1436 * @param length the number of bytes in the parameter data.
1437 * @throws SQLException if a database access error occurs,
1438 * this method is called on a closed <code>PreparedStatement</code>,
1439 * if parameterIndex does not correspond
1440 * to a parameter marker in the SQL statement, if the length specified
1441 * is less than zero or if the number of bytes in the <code>InputStream</code> does not match
1442 * the specified length.
1443 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
1444 *
1445 * @since 1.6
1446 */
1447 void setBlob(int parameterIndex, InputStream inputStream, long length)
1448 throws SQLException;
1449
1450 /**
1451 * Sets the designated parameter to a <code>InputStream</code> object.
1452 * This method differs from the <code>setBinaryStream (int, InputStream)</code>
1453 * method because it informs the driver that the parameter value should be
1454 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
1455 * the driver may have to do extra work to determine whether the parameter
1456 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
1457 *
1458 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
1459 * it might be more efficient to use a version of
1460 * <code>setBlob</code> which takes a length parameter.
1461 *
1462 * @param parameterIndex index of the first parameter is 1,
1463 * the second is 2, ...
1464 * @param inputStream An object that contains the data to set the parameter
1465 * value to.
1466 * @throws SQLException if a database access error occurs,
1467 * this method is called on a closed <code>PreparedStatement</code> or
1468 * if parameterIndex does not correspond
1469 * to a parameter marker in the SQL statement,
1470 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
1471 *
1472 * @since 1.6
1473 */
1474 void setBlob(int parameterIndex, InputStream inputStream)
1475 throws SQLException;
1476
1477 /**
1478 * Sets the designated parameter to a <code>InputStream</code> object.
1479 * The "{@code InputStream} must contain the number
1480 * of characters specified by length, otherwise a <code>SQLException</code> will be
1481 * generated when the <code>CallableStatement</code> is executed.
1482 * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
1483 * method because it informs the driver that the parameter value should be
1484 * sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used,
1485 * the driver may have to do extra work to determine whether the parameter
1486 * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
1487 *
1488 * @param parameterName the name of the parameter to be set
1489 * the second is 2, ...
1490 *
1491 * @param inputStream An object that contains the data to set the parameter
1492 * value to.
1493 * @param length the number of bytes in the parameter data.
1494 * @throws SQLException if parameterIndex does not correspond
1495 * to a parameter marker in the SQL statement, or if the length specified
1496 * is less than zero; if the number of bytes in the <code>InputStream</code> does not match
1497 * the specified length; if a database access error occurs or
1498 * this method is called on a closed <code>CallableStatement</code>
1499 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
1500 * this method
1501 *
1502 * @since 1.6
1503 */
1504 void setBlob(String parameterName, InputStream inputStream, long length)
1505 throws SQLException;
1506
1507 /**
1508 * Sets the designated parameter to the given <code>java.sql.Blob</code> object.
1509 * The driver converts this to an SQL <code>BLOB</code> value when it
1510 * sends it to the database.
1511 *
1512 * @param parameterName the name of the parameter
1513 * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
1514 * @exception SQLException if a database access error occurs or
1515 * this method is called on a closed <code>CallableStatement</code>
1516 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
1539 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
1540 *
1541 * @since 1.6
1542 */
1543 void setBlob(String parameterName, InputStream inputStream)
1544 throws SQLException;
1545
1546 /**
1547 * Sets the designated parameter in this <code>RowSet</code> object's command
1548 * with the given <code>Clob</code> value. The driver will convert this
1549 * to the <code>CLOB</code> value that the <code>Clob</code> object
1550 * represents before sending it to the database.
1551 *
1552 * @param i the first parameter is 1, the second is 2, ...
1553 * @param x an object representing a CLOB
1554 * @exception SQLException if a database access error occurs
1555 */
1556 void setClob (int i, Clob x) throws SQLException;
1557
1558 /**
1559 * Sets the designated parameter to a <code>Reader</code> object.
1560 * The reader must contain the number
1561 * of characters specified by length otherwise a <code>SQLException</code> will be
1562 * generated when the <code>PreparedStatement</code> is executed.
1563 *This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
1564 * because it informs the driver that the parameter value should be sent to
1565 * the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the
1566 * driver may have to do extra work to determine whether the parameter
1567 * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
1568 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
1569 * @param reader An object that contains the data to set the parameter value to.
1570 * @param length the number of characters in the parameter data.
1571 * @throws SQLException if a database access error occurs, this method is called on
1572 * a closed <code>PreparedStatement</code>, if parameterIndex does not correspond to a parameter
1573 * marker in the SQL statement, or if the length specified is less than zero.
1574 *
1575 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
1576 * @since 1.6
1577 */
1578 void setClob(int parameterIndex, Reader reader, long length)
1579 throws SQLException;
1580
2041 * this method is called on a closed <code>CallableStatement</code>
2042 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2043 * @since 1.6
2044 */
2045 void setNCharacterStream(String parameterName, Reader value) throws SQLException;
2046
2047 /**
2048 * Sets the designated parameter to a <code>java.sql.NClob</code> object. The object
2049 * implements the <code>java.sql.NClob</code> interface. This <code>NClob</code>
2050 * object maps to a SQL <code>NCLOB</code>.
2051 * @param parameterName the name of the column to be set
2052 * @param value the parameter value
2053 * @throws SQLException if the driver does not support national
2054 * character sets; if the driver can detect that a data conversion
2055 * error could occur; or if a database access error occurs
2056 * @since 1.6
2057 */
2058 void setNClob(String parameterName, NClob value) throws SQLException;
2059
2060 /**
2061 * Sets the designated parameter to a <code>Reader</code> object.
2062 * The <code>reader</code> must contain the number
2063 * of characters specified by length otherwise a <code>SQLException</code> will be
2064 * generated when the <code>CallableStatement</code> is executed.
2065 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
2066 * because it informs the driver that the parameter value should be sent to
2067 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the
2068 * driver may have to do extra work to determine whether the parameter
2069 * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
2070 *
2071 * @param parameterName the name of the parameter to be set
2072 * @param reader An object that contains the data to set the parameter value to.
2073 * @param length the number of characters in the parameter data.
2074 * @throws SQLException if parameterIndex does not correspond to a parameter
2075 * marker in the SQL statement; if the length specified is less than zero;
2076 * if the driver does not support national
2077 * character sets; if the driver can detect that a data conversion
2078 * error could occur; if a database access error occurs or
2079 * this method is called on a closed <code>CallableStatement</code>
2080 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
2081 * this method
2082 * @since 1.6
2092 * driver may have to do extra work to determine whether the parameter
2093 * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
2094 * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2095 * it might be more efficient to use a version of
2096 * <code>setNClob</code> which takes a length parameter.
2097 *
2098 * @param parameterName the name of the parameter
2099 * @param reader An object that contains the data to set the parameter value to.
2100 * @throws SQLException if the driver does not support national character sets;
2101 * if the driver can detect that a data conversion
2102 * error could occur; if a database access error occurs or
2103 * this method is called on a closed <code>CallableStatement</code>
2104 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2105 *
2106 * @since 1.6
2107 */
2108 void setNClob(String parameterName, Reader reader)
2109 throws SQLException;
2110
2111 /**
2112 * Sets the designated parameter to a <code>Reader</code> object.
2113 * The reader must contain the number
2114 * of characters specified by length otherwise a <code>SQLException</code> will be
2115 * generated when the <code>PreparedStatement</code> is executed.
2116 * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
2117 * because it informs the driver that the parameter value should be sent to
2118 * the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the
2119 * driver may have to do extra work to determine whether the parameter
2120 * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
2121 * @param parameterIndex index of the first parameter is 1, the second is 2, ...
2122 * @param reader An object that contains the data to set the parameter value to.
2123 * @param length the number of characters in the parameter data.
2124 * @throws SQLException if parameterIndex does not correspond to a parameter
2125 * marker in the SQL statement; if the length specified is less than zero;
2126 * if the driver does not support national character sets;
2127 * if the driver can detect that a data conversion
2128 * error could occur; if a database access error occurs or
2129 * this method is called on a closed <code>PreparedStatement</code>
2130 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2131 *
2132 * @since 1.6
2133 */
|