/projects/derby-10.9.1.0/db-derby-10.9.1.0-src/java/stubs/jdbc3/java/sql/CallableStatement.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus · Java · 1266 lines · 112 code · 80 blank · 1074 comment · 0 complexity · 25a982830688d7aacfa4a9508d4fdd1d MD5 · raw file

  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package java.sql;
  18. import java.math.BigDecimal;
  19. import java.util.Calendar;
  20. import java.util.Map;
  21. import java.net.URL;
  22. import java.io.InputStream;
  23. import java.io.Reader;
  24. /**
  25. * An interface used to call Stored Procedures.
  26. * <p>
  27. * The JDBC API provides an SQL escape syntax allowing Stored Procedures to be
  28. * called in a standard way for all databases. The JDBC escape syntax has two
  29. * forms. One form includes a result parameter. The second form does not include
  30. * a result parameter. Where the result parameter is used, it must be declared
  31. * as an OUT parameter. Other parameters can be declared as IN, OUT or INOUT.
  32. * Parameters are referenced either by name or by a numerical index, with the
  33. * first parameter being 1, the second 1 and so on. Here are examples of the two
  34. * forms of the escape syntax: <code>
  35. *
  36. * { ?= call &lt.procedurename&gt.[([parameter1,parameter2,...])]}
  37. *
  38. * {call &lt.procedurename&gt.[([parameter1,parameter2,...])]}
  39. * </code>
  40. * <p>
  41. * IN parameters are set before calling the procedure, using the setter methods
  42. * which are inherited from <code>PreparedStatement</code>. For OUT
  43. * parameters, their Type must be registered before executing the stored
  44. * procedure, and the value is retrieved using the getter methods defined in the
  45. * CallableStatement interface.
  46. * <p>
  47. * CallableStatements can return one or more ResultSets. Where multiple
  48. * ResultSets are returned they are accessed using the methods inherited from
  49. * the <code>Statement</code> interface.
  50. */
  51. public interface CallableStatement extends PreparedStatement {
  52. /**
  53. * Gets the value of a specified JDBC <code>ARRAY</code> parameter as a
  54. * java.sql.Array.
  55. *
  56. * @param parameterIndex
  57. * the parameter number index, where the first parameter has
  58. * index 1
  59. * @return a java.sql.Array containing the parameter value
  60. * @throws SQLException
  61. * if a database error happens
  62. */
  63. public Array getArray(int parameterIndex) throws SQLException;
  64. /**
  65. * Gets the value of a specified JDBC ARRAY parameter as a java.sql.Array.
  66. *
  67. * @param parameterName
  68. * the parameter of interest's name
  69. * @return a <code>java.sql.Array</code> containing the parameter value
  70. * @throws SQLException
  71. * if there is a problem accessing the database
  72. */
  73. public Array getArray(String parameterName) throws SQLException;
  74. /**
  75. * Returns a new {@link BigDecimal} representation of the JDBC
  76. * <code>NUMERIC</code> parameter specified by the input index.
  77. *
  78. * @param parameterIndex
  79. * the parameter number index (starts from 1)
  80. * @return a <code>java.math.BigDecimal</code> with the value of the
  81. * specified parameter. The value <code>null</code> is returned if
  82. * the parameter in question is an SQL <code>NULL</code>
  83. * @throws SQLException
  84. * if there is a problem accessing the database
  85. */
  86. public BigDecimal getBigDecimal(int parameterIndex) throws SQLException;
  87. /**
  88. * Returns a new {@link BigDecimal} representation of the JDBC
  89. * <code>NUMERIC</code> parameter specified by the input index. The number
  90. * of digits after the decimal point is specified by <code>scale</code>.
  91. *
  92. * @param parameterIndex
  93. * the parameter number index, where the first parameter has
  94. * index 1
  95. * @param scale
  96. * the number of digits after the decimal point to get
  97. * @return a <code>java.math.BigDecimal</code> with the value of the
  98. * specified parameter. The value <code>null</code> is returned if
  99. * the parameter in question is an SQL <code>NULL</code>
  100. * @throws SQLException
  101. * if there is a problem accessing the database
  102. * @deprecated Use getBigDecimal(int parameterIndex) or getBigDecimal(String
  103. * parameterName)
  104. */
  105. public BigDecimal getBigDecimal(int parameterIndex, int scale)
  106. throws SQLException;
  107. /**
  108. * Returns a new {@link BigDecimal} representation of the JDBC
  109. * <code>NUMERIC</code> parameter specified by the input name.
  110. *
  111. * @param parameterName
  112. * the name of the parameter
  113. * @return a java.math.BigDecimal with the value of the specified parameter.
  114. * null if the value is SQL NULL.
  115. * @throws SQLException
  116. * if a database error happens
  117. */
  118. public BigDecimal getBigDecimal(String parameterName) throws SQLException;
  119. /**
  120. * Gets the value of a specified JDBC BLOB parameter as a java.sql.Blob
  121. *
  122. * @param parameterIndex
  123. * the parameter number index, where the first parameter has
  124. * index 1
  125. * @return a java.sql.Blob with the value. null if the value is SQL NULL.
  126. * @throws SQLException
  127. * if a database error happens
  128. */
  129. public Blob getBlob(int parameterIndex) throws SQLException;
  130. /**
  131. * Gets the value of a specified JDBC BLOB parameter as a java.sql.Blob
  132. *
  133. * @param parameterName
  134. * the name of the parameter
  135. * @return a java.sql.Blob with the value. null if the value is SQL NULL.
  136. * @throws SQLException
  137. * if a database error happens
  138. */
  139. public Blob getBlob(String parameterName) throws SQLException;
  140. /**
  141. * Gets the value of a specified JDBC BIT parameter as a boolean
  142. *
  143. * @param parameterIndex
  144. * the parameter number index, where the first parameter has
  145. * index 1
  146. * @return a boolean representing the parameter value. false if the value is
  147. * SQL NULL
  148. * @throws SQLException
  149. * if a database error happens
  150. */
  151. public boolean getBoolean(int parameterIndex) throws SQLException;
  152. /**
  153. * Gets the value of a specified JDBC <code>BIT</code> parameter as a
  154. * boolean
  155. *
  156. * @param parameterName
  157. * the parameter of interest's name
  158. * @return a <code>boolean</code> representation of the value of the
  159. * parameter. <code>false</code> is returned if the SQL value is
  160. * <code>NULL</code>.
  161. * @throws SQLException
  162. * if there is a problem accessing the database
  163. */
  164. public boolean getBoolean(String parameterName) throws SQLException;
  165. /**
  166. * Gets the value of a specified JDBC TINYINT parameter as a byte
  167. *
  168. * @param parameterIndex
  169. * the parameter number index, where the first parameter has
  170. * index 1
  171. * @return a byte with the value of the parameter. 0 if the value is SQL
  172. * NULL.
  173. * @throws SQLException
  174. * if a database error happens
  175. */
  176. public byte getByte(int parameterIndex) throws SQLException;
  177. /**
  178. * Gets the value of a specified JDBC <code>TINYINT</code> parameter as a
  179. * Java <code>byte</code>.
  180. *
  181. * @param parameterName
  182. * the parameter of interest's name
  183. * @return a <code>byte</code> representation of the value of the
  184. * parameter. <code>0</code> is returned if the SQL value is
  185. * <code>NULL</code>.
  186. * @throws SQLException
  187. * if there is a problem accessing the database
  188. */
  189. public byte getByte(String parameterName) throws SQLException;
  190. /**
  191. * Returns a byte array representation of the indexed JDBC
  192. * <code>BINARY</code> or <code>VARBINARY</code> parameter.
  193. *
  194. * @param parameterIndex
  195. * the parameter number index, where the first parameter has
  196. * index 1
  197. * @return an array of bytes with the value of the parameter. null if the
  198. * value is SQL NULL.
  199. * @throws SQLException
  200. * if there is a problem accessing the database
  201. */
  202. public byte[] getBytes(int parameterIndex) throws SQLException;
  203. /**
  204. * Returns a byte array representation of the named JDBC <code>BINARY</code>
  205. * or <code>VARBINARY</code> parameter.
  206. *
  207. * @param parameterName
  208. * the name of the parameter
  209. * @return an array of bytes with the value of the parameter. null if the
  210. * value is SQL NULL.
  211. * @throws SQLException
  212. * if there is a problem accessing the database
  213. */
  214. public byte[] getBytes(String parameterName) throws SQLException;
  215. /**
  216. * Gets the value of a specified JDBC CLOB parameter as a java.sql.Clob
  217. *
  218. * @param parameterIndex
  219. * the parameter number index, where the first parameter has
  220. * index 1
  221. * @return a java.sql.Clob with the value of the parameter. null if the
  222. * value is SQL NULL.
  223. * @throws SQLException
  224. * if a database error happens
  225. */
  226. public Clob getClob(int parameterIndex) throws SQLException;
  227. /**
  228. * Gets the value of a specified JDBC CLOB parameter as a java.sql.Clob
  229. *
  230. * @param parameterName
  231. * the name of the parameter
  232. * @return a java.sql.Clob with the value of the parameter. null if the
  233. * value is SQL NULL.
  234. * @throws SQLException
  235. * if a database error happens
  236. */
  237. public Clob getClob(String parameterName) throws SQLException;
  238. /**
  239. * Gets the value of a specified JDBC DATE parameter as a java.sql.Date.
  240. *
  241. * @param parameterIndex
  242. * the parameter number index, where the first parameter has
  243. * index 1
  244. * @return the java.sql.Date with the parameter value. null if the value is
  245. * SQL NULL.
  246. * @throws SQLException
  247. * if a database error happens
  248. */
  249. public Date getDate(int parameterIndex) throws SQLException;
  250. /**
  251. * Gets the value of a specified JDBC DATE parameter as a java.sql.Date.,
  252. * using a specified Calendar to construct the date.
  253. * <p>
  254. * The JDBC driver uses the Calendar to create the Date using a particular
  255. * timezone and locale. Default behaviour of the driver is to use the Java
  256. * virtual machine default settings.
  257. *
  258. * @param parameterIndex
  259. * the parameter number index, where the first parameter has
  260. * index 1
  261. * @param cal
  262. * the Calendar to use to construct the Date
  263. * @return the java.sql.Date with the parameter value. null if the value is
  264. * SQL NULL.
  265. * @throws SQLException
  266. * if a database error happens
  267. */
  268. public Date getDate(int parameterIndex, Calendar cal) throws SQLException;
  269. /**
  270. * Gets the value of a specified JDBC DATE parameter as a java.sql.Date.
  271. *
  272. * @param parameterName
  273. * the name of the parameter
  274. * @return the java.sql.Date with the parameter value. null if the value is
  275. * SQL NULL.
  276. * @throws SQLException
  277. * if a database error happens
  278. */
  279. public Date getDate(String parameterName) throws SQLException;
  280. /**
  281. * Gets the value of a specified JDBC DATE parameter as a java.sql.Date.,
  282. * using a specified Calendar to construct the date.
  283. * <p>
  284. * The JDBC driver uses the Calendar to create the Date using a particular
  285. * timezone and locale. Default behaviour of the driver is to use the Java
  286. * virtual machine default settings.
  287. *
  288. * @param parameterName
  289. * the parameter name
  290. * @param cal
  291. * used for creating the returned <code>Date</code>
  292. * @return the java.sql.Date with the parameter value. null if the value is
  293. * SQL NULL.
  294. * @throws SQLException
  295. * if a database error happens
  296. */
  297. public Date getDate(String parameterName, Calendar cal) throws SQLException;
  298. /**
  299. * Gets the value of a specified JDBC DOUBLE parameter as a double
  300. *
  301. * @param parameterIndex
  302. * the parameter number index, where the first parameter has
  303. * index 1
  304. * @return the double with the parameter value. 0.0 if the value is SQL
  305. * NULL.
  306. * @throws SQLException
  307. * if a database error happens
  308. */
  309. public double getDouble(int parameterIndex) throws SQLException;
  310. /**
  311. * Gets the value of a specified JDBC DOUBLE parameter as a double
  312. *
  313. * @param parameterName
  314. * the parameter name
  315. * @return the parameter value as represented in a Java <code>double</code>.
  316. * An SQL value of <code>NULL</code> gets represented as
  317. * <code>0</code> (zero).
  318. * @throws SQLException
  319. * if there is a problem accessing the database
  320. */
  321. public double getDouble(String parameterName) throws SQLException;
  322. /**
  323. * Gets the value of a specified JDBC FLOAT parameter as a float
  324. *
  325. * @param parameterIndex
  326. * the parameter number index, where the first parameter has
  327. * index 1
  328. * @return the float with the parameter value. 0.0 if the value is SQL NULL.
  329. * @throws SQLException
  330. * if a database error happens
  331. */
  332. public float getFloat(int parameterIndex) throws SQLException;
  333. /**
  334. * Gets the value of a specified JDBC <code>FLOAT</code> parameter as a
  335. * Java <code>float</code>.
  336. *
  337. * @param parameterName
  338. * the parameter name
  339. * @return the parameter value as represented in a Java <code>float</code>.
  340. * An SQL value of <code>NULL</code> gets represented as
  341. * <code>0</code> (zero).
  342. * @throws SQLException
  343. * if there is a problem accessing the database
  344. */
  345. public float getFloat(String parameterName) throws SQLException;
  346. /**
  347. * Gets the value of a specified JDBC INTEGER parameter as an int
  348. *
  349. * @param parameterIndex
  350. * the parameter number index, where the first parameter has
  351. * index 1
  352. * @return the int with the parameter value. 0 if the value is SQL NULL.
  353. * @throws SQLException
  354. * if a database error happens
  355. */
  356. public int getInt(int parameterIndex) throws SQLException;
  357. /**
  358. * Gets the value of a specified JDBC INTEGER parameter as an int
  359. *
  360. * @param parameterName
  361. * the name of the parameter
  362. * @return the int with the parameter value. 0 if the value is SQL NULL.
  363. * @throws SQLException
  364. * if a database error happens
  365. */
  366. public int getInt(String parameterName) throws SQLException;
  367. /**
  368. * Gets the value of a specified JDBC BIGINT parameter as a long
  369. *
  370. * @param parameterIndex
  371. * the parameter number index, where the first parameter has
  372. * index 1
  373. * @return the long with the parameter value. 0 if the value is SQL NULL.
  374. * @throws SQLException
  375. * if a database error happens
  376. */
  377. public long getLong(int parameterIndex) throws SQLException;
  378. /**
  379. * Gets the value of a specified JDBC BIGINT parameter as a long
  380. *
  381. * @param parameterName
  382. * the name of the parameter
  383. * @return the long with the parameter value. 0 if the value is SQL NULL.
  384. * @throws SQLException
  385. * if a database error happens
  386. */
  387. public long getLong(String parameterName) throws SQLException;
  388. /**
  389. * Gets the value of a specified parameter as a Java <code>Object</code>.
  390. * <p>
  391. * The object type returned is the JDBC type registered for the parameter
  392. * with a <code>registerOutParameter</code> call. If a parameter was
  393. * registered as a <code>java.sql.Types.OTHER</code> then it may hold
  394. * abstract types that are particular to the connected database.
  395. *
  396. * @param parameterIndex
  397. * the parameter number index, where the first parameter has
  398. * index 1
  399. * @return an Object holding the value of the parameter.
  400. * @throws SQLException
  401. * if there is a problem accessing the database
  402. */
  403. public Object getObject(int parameterIndex) throws SQLException;
  404. /**
  405. * Gets the value of a specified parameter as an Object. A Map is supplied
  406. * to provide custom mapping of the parameter value.
  407. *
  408. * @param parameterIndex
  409. * the parameter number index, where the first parameter has
  410. * index 1
  411. * @param map
  412. * the Map holing the mapping from SQL types to Java classes
  413. * @return an Object holding the value of the parameter.
  414. * @throws SQLException
  415. * if a database error happens
  416. */
  417. public Object getObject(int parameterIndex, Map map)
  418. throws SQLException;
  419. /**
  420. * Gets the value of a specified parameter as an Object.
  421. * <p>
  422. * The object type returned is the JDBC type registered for the parameter
  423. * with a <code>registerOutParameter</code> call. If a parameter was
  424. * registered as a <code>java.sql.Types.OTHER</code> then it may hold
  425. * abstract types that are particular to the connected database.
  426. *
  427. * @param parameterName
  428. * the parameter name
  429. * @return the Java <code>Object</code> representation of the value of the
  430. * parameter.
  431. * @throws SQLException
  432. * if there is a problem accessing the database
  433. */
  434. public Object getObject(String parameterName) throws SQLException;
  435. /**
  436. * Gets the value of a specified parameter as an Object. A Map is supplied
  437. * to provide custom mapping of the parameter value.
  438. *
  439. * @param parameterName
  440. * the parameter name
  441. * @param map
  442. * the <code>Map</code> of SQL types to their Java counterparts
  443. * @return an <code>Object</code> holding the value of the parameter.
  444. * @throws SQLException
  445. * if there is a problem accessing the database
  446. */
  447. public Object getObject(String parameterName, Map map)
  448. throws SQLException;
  449. /**
  450. * Gets the value of a specified JDBC REF(<structured type>) parameter as a
  451. * java.sql.Ref
  452. *
  453. * @param parameterIndex
  454. * the parameter number index, where the first parameter has
  455. * index 1
  456. * @return a java.sql.Ref with the parameter value. null if the value is SQL
  457. * NULL.
  458. * @throws SQLException
  459. * if a database error happens
  460. */
  461. public Ref getRef(int parameterIndex) throws SQLException;
  462. /**
  463. * Gets the value of a specified JDBC REF(<structured type>) parameter as a
  464. * java.sql.Ref
  465. *
  466. * @param parameterName
  467. * the parameter name
  468. * @return the target parameter's value in the form of a
  469. * <code>java.sql.Ref</code>. A <code>null</code> reference is
  470. * returned for a parameter value of SQL <code>NULL</code>.
  471. * @throws SQLException
  472. * if there is a problem accessing the database
  473. */
  474. public Ref getRef(String parameterName) throws SQLException;
  475. /**
  476. * Gets the value of a specified JDBC SMALLINT parameter as a short
  477. *
  478. * @param parameterIndex
  479. * the parameter number index, where the first parameter has
  480. * index 1
  481. * @return a short with the parameter value. 0 if the value is SQL NULL.
  482. * @throws SQLException
  483. * if a database error happens
  484. */
  485. public short getShort(int parameterIndex) throws SQLException;
  486. /**
  487. * Gets the value of a specified JDBC <code>SMALLINT</code> parameter as a
  488. * short
  489. *
  490. * @param parameterName
  491. * the parameter name
  492. * @return the value of the target parameter as a Java <code>short</code>.
  493. * If the value is an SQL <code>NULL</code> then <code>0</code>
  494. * (zero) is returned.
  495. * @throws SQLException
  496. * if there is a problem accessing the database
  497. */
  498. public short getShort(String parameterName) throws SQLException;
  499. /**
  500. * Returns the indexed parameter's value as a string. The parameter value
  501. * must be one of the JDBC types <code>CHAR</code>, <code>VARCHAR</code>
  502. * or <code>LONGVARCHAR</code>.
  503. * <p>
  504. * The string corresponding to a <code>CHAR</code> of fixed length will be
  505. * of identical length to the value in the database inclusive of padding
  506. * characters.
  507. *
  508. * @param parameterIndex
  509. * the parameter number index, where the first parameter has
  510. * index 1
  511. * @return a String with the parameter value. null if the value is SQL NULL.
  512. * @throws SQLException
  513. * if there is a problem accessing the database
  514. */
  515. public String getString(int parameterIndex) throws SQLException;
  516. /**
  517. * Returns the named parameter's value as a string. The parameter value must
  518. * be one of the JDBC types <code>CHAR</code>, <code>VARCHAR</code> or
  519. * <code>LONGVARCHAR</code>.
  520. * <p>
  521. * The string corresponding to a <code>CHAR</code> of fixed length will be
  522. * of identical length to the value in the database inclusive of padding
  523. * characters.
  524. *
  525. * @param parameterName
  526. * the parameter name
  527. * @return a String with the parameter value. null if the value is SQL NULL.
  528. * @throws SQLException
  529. * if there is a problem accessing the database
  530. */
  531. public String getString(String parameterName) throws SQLException;
  532. /**
  533. * Gets the value of a specified JDBC TIME parameter as a java.sql.Time.
  534. *
  535. * @param parameterIndex
  536. * the parameter number index, where the first parameter has
  537. * index 1
  538. * @return a java.sql.Time with the parameter value. null if the value is
  539. * SQL NULL.
  540. * @throws SQLException
  541. * if a database error happens
  542. */
  543. public Time getTime(int parameterIndex) throws SQLException;
  544. /**
  545. * Gets the value of a specified JDBC TIME parameter as a java.sql.Time,
  546. * using the supplied Calendar to construct the time. The JDBC driver uses
  547. * the Calendar to handle specific timezones and locales when creating the
  548. * Time.
  549. *
  550. * @param parameterIndex
  551. * the parameter number index, where the first parameter has
  552. * index 1
  553. * @param cal
  554. * the Calendar to use in constructing the Time.
  555. * @return a java.sql.Time with the parameter value. null if the value is
  556. * SQL NULL.
  557. * @throws SQLException
  558. * if a database error happens
  559. */
  560. public Time getTime(int parameterIndex, Calendar cal) throws SQLException;
  561. /**
  562. * Gets the value of a specified JDBC <code>TIME</code> parameter as a
  563. * <codejava.sql.Time</code>
  564. *
  565. * @param parameterName
  566. * the parameter name
  567. * @return a new <code>java.sql.Time</code> with the parameter value. A
  568. * <code>null</code> reference is returned for an SQL value of
  569. * <code>NULL</code>
  570. * @throws SQLException
  571. * if a database error happens
  572. */
  573. public Time getTime(String parameterName) throws SQLException;
  574. /**
  575. * Gets the value of a specified JDBC TIME parameter as a java.sql.Time,
  576. * using the supplied Calendar to construct the time. The JDBC driver uses
  577. * the Calendar to handle specific timezones and locales when creating the
  578. * Time.
  579. *
  580. * @param parameterName
  581. * the parameter name
  582. * @param cal
  583. * used for creating the returned <code>Time</code>
  584. * @return a <code>java.sql.Time</code> with the parameter value. A
  585. * <code>null</code> reference is returned for an SQL value of
  586. * <code>NULL</code>
  587. * @throws SQLException
  588. * if a database error happens
  589. */
  590. public Time getTime(String parameterName, Calendar cal) throws SQLException;
  591. /**
  592. * Returns the indexed parameter's <code>TIMESTAMP</code> value as a
  593. * <code>java.sql.Timestamp</code>.
  594. *
  595. * @param parameterIndex
  596. * the parameter number index, where the first parameter has
  597. * index 1
  598. * @return a new <code>java.sql.Timestamp</code> with the parameter value.
  599. * A <code>null</code> reference is returned for an SQL value of
  600. * <code>NULL</code>
  601. * @throws SQLException
  602. * if a database error happens
  603. */
  604. public Timestamp getTimestamp(int parameterIndex) throws SQLException;
  605. /**
  606. * Returns the indexed parameter's <code>TIMESTAMP</code> value as a
  607. * <code>java.sql.Timestamp</code>. The JDBC driver uses the supplied
  608. * <code>Calendar</code> to handle specific timezones and locales when
  609. * creating the result.
  610. *
  611. * @param parameterIndex
  612. * the parameter number index, where the first parameter has
  613. * index 1
  614. * @param cal
  615. * used for creating the returned <code>Timestamp</code>
  616. * @return a new <code>java.sql.Timestamp</code> with the parameter value.
  617. * A <code>null</code> reference is returned for an SQL value of
  618. * <code>NULL</code>
  619. * @throws SQLException
  620. * if a database error happens
  621. */
  622. public Timestamp getTimestamp(int parameterIndex, Calendar cal)
  623. throws SQLException;
  624. /**
  625. * Returns the named parameter's <code>TIMESTAMP</code> value as a
  626. * <code>java.sql.Timestamp</code>.
  627. *
  628. * @param parameterName
  629. * the parameter name
  630. * @return a new <code>java.sql.Timestamp</code> with the parameter value.
  631. * A <code>null</code> reference is returned for an SQL value of
  632. * <code>NULL</code>
  633. * @throws SQLException
  634. * if a database error happens
  635. */
  636. public Timestamp getTimestamp(String parameterName) throws SQLException;
  637. /**
  638. * Returns the indexed parameter's <code>TIMESTAMP</code> value as a
  639. * <code>java.sql.Timestamp</code>. The JDBC driver uses the supplied
  640. * <code>Calendar</code> to handle specific timezones and locales when
  641. * creating the result.
  642. *
  643. * @param parameterName
  644. * the parameter name
  645. * @param cal
  646. * used for creating the returned <code>Timestamp</code>
  647. * @return a new <code>java.sql.Timestamp</code> with the parameter value.
  648. * A <code>null</code> reference is returned for an SQL value of
  649. * <code>NULL</code>
  650. * @throws SQLException
  651. * if a database error happens
  652. */
  653. public Timestamp getTimestamp(String parameterName, Calendar cal)
  654. throws SQLException;
  655. /**
  656. * Gets the value of a specified JDBC DATALINK parameter as a java.net.URL.
  657. *
  658. * @param parameterIndex
  659. * the parameter number index, where the first parameter has
  660. * index 1
  661. * @return a java.sql.Datalink with the parameter value. null if the value
  662. * is SQL NULL.
  663. * @throws SQLException
  664. * if a database error happens
  665. */
  666. public URL getURL(int parameterIndex) throws SQLException;
  667. /**
  668. * Returns the named parameter's JDBC <code>DATALINK</code> value in a new
  669. * Java <code>java.net.URL</code>.
  670. *
  671. * @param parameterName
  672. * the parameter name
  673. * @return a new <code>java.net.URL</code> encapsulating the parameter
  674. * value. A <code>null</code> reference is returned for an SQL
  675. * value of <code>NULL</code>
  676. * @throws SQLException
  677. * if a database error happens
  678. */
  679. public URL getURL(String parameterName) throws SQLException;
  680. /**
  681. * Defines the Type of a specified OUT parameter. All OUT parameters must
  682. * have their Type defined before a stored procedure is executed.
  683. * <p>
  684. * The Type defined by this method fixes the Java type that must be
  685. * retrieved using the getter methods of CallableStatement. If a database
  686. * specific type is expected for a parameter, the Type java.sql.Types.OTHER
  687. * should be used. Note that there is another variant of this method for
  688. * User Defined Types or a REF type.
  689. *
  690. * @param parameterIndex
  691. * the parameter number index, where the first parameter has
  692. * index 1
  693. * @param sqlType
  694. * the JDBC type as defined by java.sql.Types. The JDBC types
  695. * NUMERIC and DECIMAL should be defined using the version of
  696. * <code>registerOutParameter</code> that takes a
  697. * <code>scale</code> parameter.
  698. * @throws SQLException
  699. * if a database error happens
  700. */
  701. public void registerOutParameter(int parameterIndex, int sqlType)
  702. throws SQLException;
  703. /**
  704. * Defines the Type of a specified OUT parameter. All OUT parameters must
  705. * have their Type defined before a stored procedure is executed. This
  706. * version of the registerOutParameter method, which has a scale parameter,
  707. * should be used for the JDBC types NUMERIC and DECIMAL, where there is a
  708. * need to specify the number of digits expected after the decimal point.
  709. * <p>
  710. * The Type defined by this method fixes the Java type that must be
  711. * retrieved using the getter methods of CallableStatement.
  712. *
  713. * @param parameterIndex
  714. * the parameter number index, where the first parameter has
  715. * index 1
  716. * @param sqlType
  717. * the JDBC type as defined by java.sql.Types.
  718. * @param scale
  719. * the number of digits after the decimal point. Must be greater
  720. * than or equal to 0.
  721. * @throws SQLException
  722. * if a database error happens
  723. */
  724. public void registerOutParameter(int parameterIndex, int sqlType, int scale)
  725. throws SQLException;
  726. /**
  727. * Defines the Type of a specified OUT parameter. This variant of the method
  728. * is designed for use with parameters that are User Defined Types (UDT) or
  729. * a REF type, although it can be used for any type.
  730. *
  731. * @param paramIndex
  732. * the parameter number index, where the first parameter has
  733. * index 1
  734. * @param sqlType
  735. * a JDBC type expressed as a constant from {@link Types}
  736. * @param typeName
  737. * an SQL type name. For a REF type, this name should be the
  738. * fully qualified name of the referenced type.
  739. * @throws SQLException
  740. * if a database error happens
  741. */
  742. public void registerOutParameter(int paramIndex, int sqlType,
  743. String typeName) throws SQLException;
  744. /**
  745. * Defines the Type of a specified OUT parameter. All OUT parameters must
  746. * have their Type defined before a stored procedure is executed.
  747. * <p>
  748. * The Type defined by this method fixes the Java type that must be
  749. * retrieved using the getter methods of CallableStatement. If a database
  750. * specific type is expected for a parameter, the Type java.sql.Types.OTHER
  751. * should be used. Note that there is another variant of this method for
  752. * User Defined Types or a REF type.
  753. *
  754. * @param parameterName
  755. * the parameter name
  756. * @param sqlType
  757. * a JDBC type expressed as a constant from {@link Types}. Types
  758. * NUMERIC and DECIMAL should be defined using the variant of
  759. * this method that takes a <code>scale</code> parameter.
  760. * @throws SQLException
  761. * if a database error happens
  762. */
  763. public void registerOutParameter(String parameterName, int sqlType)
  764. throws SQLException;
  765. /**
  766. * Defines the Type of a specified OUT parameter. All OUT parameters must
  767. * have their Type defined before a stored procedure is executed. This
  768. * version of the registerOutParameter method, which has a scale parameter,
  769. * should be used for the JDBC types NUMERIC and DECIMAL, where there is a
  770. * need to specify the number of digits expected after the decimal point.
  771. * <p>
  772. * The Type defined by this method fixes the Java type that must be
  773. * retrieved using the getter methods of CallableStatement.
  774. *
  775. * @param parameterName
  776. * the parameter name
  777. * @param sqlType
  778. * a JDBC type expressed as a constant from {@link Types}
  779. * @param scale
  780. * the number of digits after the decimal point. Must be greater
  781. * than or equal to 0.
  782. * @throws SQLException
  783. * if a database error happens
  784. */
  785. public void registerOutParameter(String parameterName, int sqlType,
  786. int scale) throws SQLException;
  787. /**
  788. * Defines the Type of a specified OUT parameter. This variant of the method
  789. * is designed for use with parameters that are User Defined Types (UDT) or
  790. * a REF type, although it can be used for any type.Registers the designated
  791. * output parameter.
  792. *
  793. * @param parameterName
  794. * the parameter name
  795. * @param sqlType
  796. * a JDBC type expressed as a constant from {@link Types}
  797. * @param typeName
  798. * the fully qualified name of an SQL structured type. For a REF
  799. * type, this name should be the fully qualified name of the
  800. * referenced type.
  801. * @throws SQLException
  802. * if a database error happens
  803. */
  804. public void registerOutParameter(String parameterName, int sqlType,
  805. String typeName) throws SQLException;
  806. /**
  807. * Sets the value of a specified parameter to the content of a supplied
  808. * InputStream, which has a specified number of bytes.
  809. * <p>
  810. * This is a good method for setting an SQL LONVARCHAR parameter where the
  811. * length of the data is large. Data is read from the InputStream until
  812. * end-of-file is reached or the specified number of bytes is copied.
  813. *
  814. * @param parameterName
  815. * the parameter name
  816. * @param theInputStream
  817. * the ASCII InputStream carrying the data to update the
  818. * parameter with
  819. * @param length
  820. * the number of bytes in the InputStream to copy to the
  821. * parameter
  822. * @throws SQLException
  823. * if a database error happens
  824. */
  825. public void setAsciiStream(String parameterName,
  826. InputStream theInputStream, int length) throws SQLException;
  827. /**
  828. * Sets the value of a specified parameter to a supplied
  829. * java.math.BigDecimal value.
  830. *
  831. * @param parameterName
  832. * the name of the parameter
  833. * @param theBigDecimal
  834. * the java.math.BigInteger value to set
  835. * @throws SQLException
  836. * if a database error happens
  837. */
  838. public void setBigDecimal(String parameterName, BigDecimal theBigDecimal)
  839. throws SQLException;
  840. /**
  841. * Sets the value of a specified parameter to the content of a supplied
  842. * binary InputStream, which has a specified number of bytes.
  843. * <p>
  844. * Use this method when a large amount of data needs to be set into a
  845. * LONGVARBINARY parameter.
  846. *
  847. * @param parameterName
  848. * the name of the parameter
  849. * @param theInputStream
  850. * the binary InputStream carrying the data to update the
  851. * parameter
  852. * @param length
  853. * the number of bytes in the InputStream to copy to the
  854. * parameter
  855. * @throws SQLException
  856. * if a database error happens
  857. */
  858. public void setBinaryStream(String parameterName,
  859. InputStream theInputStream, int length) throws SQLException;
  860. /**
  861. * Sets the value of a specified parameter to a supplied boolean value.
  862. *
  863. * @param parameterName
  864. * the parameter name
  865. * @param theBoolean
  866. * the new value with which to update the parameter
  867. * @throws SQLException
  868. * if a database error happens
  869. */
  870. public void setBoolean(String parameterName, boolean theBoolean)
  871. throws SQLException;
  872. /**
  873. * Sets the value of a specified parameter to a supplied byte value.
  874. *
  875. * @param parameterName
  876. * the parameter name
  877. * @param theByte
  878. * the new value with which to update the parameter
  879. * @throws SQLException
  880. * if a database error happens
  881. */
  882. public void setByte(String parameterName, byte theByte) throws SQLException;
  883. /**
  884. * Sets the value of a specified parameter to a supplied array of bytes. The
  885. * array is mapped to <code>VARBINARY</code> or else
  886. * <code>LONGVARBINARY</code> in the connected database.
  887. *
  888. * @param parameterName
  889. * the parameter name
  890. * @param theBytes
  891. * the new value with which to update the parameter
  892. * @throws SQLException
  893. * if a database error happens
  894. */
  895. public void setBytes(String parameterName, byte[] theBytes)
  896. throws SQLException;
  897. /**
  898. * Sets the value of a specified parameter to the character content of a
  899. * Reader object, with the specified length of character data.
  900. *
  901. * @param parameterName
  902. * the parameter name
  903. * @param reader
  904. * the new value with which to update the parameter
  905. * @param length
  906. * a count of the characters contained in <code>reader</code>
  907. * @throws SQLException
  908. * if a database error happens
  909. */
  910. public void setCharacterStream(String parameterName, Reader reader,
  911. int length) throws SQLException;
  912. /**
  913. * Sets the value of a specified parameter to a supplied java.sql.Date
  914. * value.
  915. *
  916. * @param parameterName
  917. * the parameter name
  918. * @param theDate
  919. * the new value with which to update the parameter
  920. * @throws SQLException
  921. * if a database error happens
  922. */
  923. public void setDate(String parameterName, Date theDate) throws SQLException;
  924. /**
  925. * Sets the value of a specified parameter to a supplied java.sql.Date
  926. * value, using a supplied Calendar to map the Date. The Calendar allows the
  927. * application to control the timezone used to compute the SQL DATE in the
  928. * database - without the supplied Calendar, the driver uses the default
  929. * timezone of the Java virtual machine.
  930. *
  931. * @param parameterName
  932. * the parameter name
  933. * @param theDate
  934. * the new value with which to update the parameter
  935. * @param cal
  936. * a Calendar to use to construct the SQL DATE value
  937. * @throws SQLException
  938. * if a database error happens
  939. */
  940. public void setDate(String parameterName, Date theDate, Calendar cal)
  941. throws SQLException;
  942. /**
  943. * Sets the value of a specified parameter to a supplied double value.
  944. *
  945. * @param parameterName
  946. * the parameter name
  947. * @param theDouble
  948. * the new value with which to update the parameter
  949. * @throws SQLException
  950. * if a database error happens
  951. */
  952. public void setDouble(String parameterName, double theDouble)
  953. throws SQLException;
  954. /**
  955. * Sets the value of a specified parameter to to a supplied float value.
  956. *
  957. * @param parameterName
  958. * the parameter name
  959. * @param theFloat
  960. * the new value with which to update the parameter
  961. * @throws SQLException
  962. * if a database error happens
  963. */
  964. public void setFloat(String parameterName, float theFloat)
  965. throws SQLException;
  966. /**
  967. * Sets the value of a specified parameter to a supplied int value.
  968. *
  969. * @param parameterName
  970. * the parameter name
  971. * @param theInt
  972. * the new value with which to update the parameter
  973. * @throws SQLException
  974. * if a database error happens
  975. */
  976. public void setInt(String parameterName, int theInt) throws SQLException;
  977. /**
  978. * Sets the value of a specified parameter to a supplied long value.
  979. *
  980. * @param parameterName
  981. * the parameter name
  982. * @param theLong
  983. * the new value with which to update the parameter
  984. * @throws SQLException
  985. * if a database error happens
  986. */
  987. public void setLong(String parameterName, long theLong) throws SQLException;
  988. /**
  989. * Sets the value of a specified parameter to SQL NULL. Don't use this
  990. * version of setNull for User Defined Types or for REF type parameters.
  991. *
  992. * @param parameterName
  993. * the parameter name
  994. * @param sqlType
  995. * a JDBC type expressed as a constant from {@link Types}
  996. * @throws SQLException
  997. * if a database error happens
  998. */
  999. public void setNull(String parameterName, int sqlType) throws SQLException;
  1000. /**
  1001. * Sets the value of a specified parameter to be SQL NULL where the
  1002. * parameter type is either <code>REF</code> or user defined (e.g.
  1003. * <code>STRUCT</code>, <code>JAVA_OBJECT</code> etc).
  1004. * <p>
  1005. * For reasons of portability, the caller is expected to supply both the SQL
  1006. * Type code and Type name (which is just the parameter name if the type is
  1007. * user defined, or the name of the type being referenced if a REF).
  1008. *
  1009. * @param parameterName
  1010. * the parameter name
  1011. * @param sqlType
  1012. * a JDBC type expressed as a constant from {@link Types}
  1013. * @param typeName
  1014. * if the target parameter is a user defined type then this
  1015. * should contain the full type name
  1016. *
  1017. * the fully qualified name of a UDT or REF type - ignored if the parameter
  1018. * is not a UDT.
  1019. * @throws SQLException
  1020. * if a database error happens
  1021. */
  1022. public void setNull(String parameterName, int sqlType, String typeName)
  1023. throws SQLException;
  1024. /**
  1025. * Sets the value of a specified parameter using a supplied object. Prior to
  1026. * issuing this request to the connected database <code>theObject</code>
  1027. * is transformed to the corresponding SQL type according to the normal Java
  1028. * to SQL mapping rules.
  1029. * <p>
  1030. * If the object's class implements the interface SQLData, the JDBC driver
  1031. * calls <code>SQLData.writeSQL</code> to write it to the SQL data stream.
  1032. * If <code>theObject</code> implements any of the following interfaces
  1033. * then it is the role of the driver to flow the value to the connected
  1034. * database using the appropriate SQL type :
  1035. * <ul>
  1036. * <li>{@link Ref}
  1037. * <li>{@link Struct}
  1038. * <li>{@link Array}
  1039. * <li>{@link Clob}
  1040. * <li>{@link Blob}
  1041. * </ul>
  1042. *
  1043. * @param parameterName
  1044. * the parameter name
  1045. * @param theObject
  1046. * the new value with which to update the parameter
  1047. * @throws SQLException
  1048. * if a database error happens
  1049. */
  1050. public void setObject(String parameterName, Object theObject)
  1051. throws SQLException;
  1052. /**
  1053. * Sets the value of a specified parameter using a supplied object.
  1054. * <p>
  1055. * The Object is converted to the given targetSqlType before it is sent to
  1056. * the database. If the object has a custom mapping (its class implements
  1057. * the interface SQLData), the JDBC driver will call the method
  1058. * SQLData.writeSQL to write it to the SQL data stream. If
  1059. * <code>theObject</code> implements any of the following interfaces then
  1060. * it is the role of the driver to flow the value to the connected database
  1061. * using the appropriate SQL type :
  1062. * <ul>
  1063. * <li>{@link Ref}
  1064. * <li>{@link Struct}
  1065. * <li>{@link Array}
  1066. * <li>{@link Clob}
  1067. * <li>{@link Blob}
  1068. * </ul>
  1069. *
  1070. * @param parameterName
  1071. * the parameter name
  1072. * @param theObject
  1073. * the new value with which to update the parameter
  1074. * @param targetSqlType
  1075. * a JDBC type expressed as a constant from {@link Types}
  1076. * @throws SQLException
  1077. * if a database error happens
  1078. */
  1079. public void setObject(String parameterName, Object theObject,
  1080. int targetSqlType) throws SQLException;
  1081. /**
  1082. * Sets the value of a specified parameter using a supplied object.
  1083. * <p>
  1084. * The Object is converted to the given targetSqlType before it is sent to
  1085. * the database. If the object has a custom mapping (its class implements
  1086. * the interface SQLData), the JDBC driver will call the method
  1087. * SQLData.writeSQL to write it to the SQL data stream. If
  1088. * <code>theObject</code> implements any of the following interfaces then
  1089. * it is the role of the driver to flow the value to the connected database
  1090. * using the appropriate SQL type :
  1091. * <ul>
  1092. * <li>{@link Ref}
  1093. * <li>{@link Struct}
  1094. * <li>{@link Array}
  1095. * <li>{@link Clob}
  1096. * <li>{@link Blob}
  1097. * </ul>
  1098. *
  1099. * @param parameterName
  1100. * the parameter name
  1101. * @param theObject
  1102. * the new value with which to update the parameter
  1103. * @param targetSqlType
  1104. * a JDBC type expressed as a constant from {@link Types}
  1105. * @param scale
  1106. * where applicable, the number of digits after the decimal
  1107. * point.
  1108. * @throws SQLException
  1109. * if a database error happens
  1110. */
  1111. public void setObject(String parameterName, Object theObject,
  1112. int targetSqlType, int scale) throws SQLException;
  1113. /**
  1114. * Sets the value of a specified parameter to a supplied short value.
  1115. *
  1116. * @param parameterName
  1117. * the name of the parameter
  1118. * @param theShort
  1119. * a short value to update the parameter
  1120. * @throws SQLException
  1121. * if a database error happens
  1122. */
  1123. public void setShort(String parameterName, short theShort)
  1124. throws SQLException;
  1125. /**
  1126. * Sets the value of a specified parameter to a supplied String.
  1127. *
  1128. * @param parameterName
  1129. * the name of the parameter
  1130. * @param theString
  1131. * a String value to update the parameter
  1132. * @throws SQLException
  1133. * if a database error happens
  1134. */
  1135. public void setString(String parameterName, String theString)
  1136. throws SQLException;
  1137. /**
  1138. * Sets the value of the parameter named <code>parameterName</code> to the
  1139. * value of the supplied <code>java.sql.Time</code>.
  1140. *
  1141. * @param parameterName
  1142. * the parameter name
  1143. * @param theTime
  1144. * the new value with which to update the parameter
  1145. * @throws SQLException
  1146. * if a database error happens
  1147. */
  1148. public void setTime(String parameterName, Time theTime) throws SQLException;
  1149. /**
  1150. * Sets the value of the parameter named <code>parameterName</code> to the
  1151. * value of the supplied <code>java.sql.Time</code> using the supplied
  1152. * Calendar.
  1153. * <p>
  1154. * The driver uses the supplied Calendar to create the SQL TIME value, which
  1155. * allows it to use a custom timezone - otherwise the driver uses the
  1156. * default timezone of the Java virtual machine.
  1157. *
  1158. * @param parameterName
  1159. * the parameter name
  1160. * @param theTime
  1161. * the new value with which to update the parameter
  1162. * @param cal
  1163. * used for creating the new SQL <code>TIME</code> value
  1164. * @throws SQLException
  1165. * if a database error happens
  1166. */
  1167. public void setTime(String parameterName, Time theTime, Calendar cal)
  1168. throws SQLException;
  1169. /**
  1170. * Sets the value of a specified parameter to a supplied java.sql.Timestamp
  1171. * value.
  1172. *
  1173. * @param parameterName
  1174. * the parameter name
  1175. * @param theTimestamp
  1176. * the new value with which to update the parameter
  1177. * @throws SQLException
  1178. * if a database error happens
  1179. */
  1180. public void setTimestamp(String parameterName, Timestamp theTimestamp)
  1181. throws SQLException;
  1182. /**
  1183. * Sets the value of a specified parameter to a supplied java.sql.Timestamp
  1184. * value, using the supplied Calendar.
  1185. * <p>
  1186. * The driver