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

https://gitlab.com/essere.lab.public/qualitas.class-corpus · Java · 403 lines · 35 code · 26 blank · 342 comment · 0 complexity · ccf78d7932f72965e642ea00b12d7aeb 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.util.Calendar;
  19. import java.util.Map;
  20. import java.net.URL;
  21. import java.io.InputStream;
  22. import java.io.Reader;
  23. /**
  24. * An interface used to call Stored Procedures.
  25. * <p>
  26. * The JDBC API provides an SQL escape syntax allowing Stored Procedures to be
  27. * called in a standard way for all databases. The JDBC escape syntax has two
  28. * forms. One form includes a result parameter. The second form does not include
  29. * a result parameter. Where the result parameter is used, it must be declared
  30. * as an OUT parameter. Other parameters can be declared as IN, OUT or INOUT.
  31. * Parameters are referenced either by name or by a numerical index, with the
  32. * first parameter being 1, the second 1 and so on. Here are examples of the two
  33. * forms of the escape syntax: <code>
  34. *
  35. * { ?= call &lt.procedurename&gt.[([parameter1,parameter2,...])]}
  36. *
  37. * {call &lt.procedurename&gt.[([parameter1,parameter2,...])]}
  38. * </code>
  39. * <p>
  40. * IN parameters are set before calling the procedure, using the setter methods
  41. * which are inherited from <code>PreparedStatement</code>. For OUT
  42. * parameters, their Type must be registered before executing the stored
  43. * procedure, and the value is retrieved using the getter methods defined in the
  44. * CallableStatement interface.
  45. * <p>
  46. * CallableStatements can return one or more ResultSets. Where multiple
  47. * ResultSets are returned they are accessed using the methods inherited from
  48. * the <code>Statement</code> interface.
  49. */
  50. public interface CallableStatement extends PreparedStatement {
  51. /**
  52. * Gets the value of a specified JDBC BLOB parameter as a java.sql.Blob
  53. *
  54. * @param parameterIndex
  55. * the parameter number index, where the first parameter has
  56. * index 1
  57. * @return a java.sql.Blob with the value. null if the value is SQL NULL.
  58. * @throws SQLException
  59. * if a database error happens
  60. */
  61. public Blob getBlob(int parameterIndex) throws SQLException;
  62. /**
  63. * Gets the value of a specified JDBC BIT parameter as a boolean
  64. *
  65. * @param parameterIndex
  66. * the parameter number index, where the first parameter has
  67. * index 1
  68. * @return a boolean representing the parameter value. false if the value is
  69. * SQL NULL
  70. * @throws SQLException
  71. * if a database error happens
  72. */
  73. public boolean getBoolean(int parameterIndex) throws SQLException;
  74. /**
  75. * Gets the value of a specified JDBC TINYINT parameter as a byte
  76. *
  77. * @param parameterIndex
  78. * the parameter number index, where the first parameter has
  79. * index 1
  80. * @return a byte with the value of the parameter. 0 if the value is SQL
  81. * NULL.
  82. * @throws SQLException
  83. * if a database error happens
  84. */
  85. public byte getByte(int parameterIndex) throws SQLException;
  86. /**
  87. * Returns a byte array representation of the indexed JDBC
  88. * <code>BINARY</code> or <code>VARBINARY</code> parameter.
  89. *
  90. * @param parameterIndex
  91. * the parameter number index, where the first parameter has
  92. * index 1
  93. * @return an array of bytes with the value of the parameter. null if the
  94. * value is SQL NULL.
  95. * @throws SQLException
  96. * if there is a problem accessing the database
  97. */
  98. public byte[] getBytes(int parameterIndex) throws SQLException;
  99. /**
  100. * Gets the value of a specified JDBC CLOB parameter as a java.sql.Clob
  101. *
  102. * @param parameterIndex
  103. * the parameter number index, where the first parameter has
  104. * index 1
  105. * @return a java.sql.Clob with the value of the parameter. null if the
  106. * value is SQL NULL.
  107. * @throws SQLException
  108. * if a database error happens
  109. */
  110. public Clob getClob(int parameterIndex) throws SQLException;
  111. /**
  112. * Gets the value of a specified JDBC DATE parameter as a java.sql.Date.
  113. *
  114. * @param parameterIndex
  115. * the parameter number index, where the first parameter has
  116. * index 1
  117. * @return the java.sql.Date with the parameter value. null if the value is
  118. * SQL NULL.
  119. * @throws SQLException
  120. * if a database error happens
  121. */
  122. public Date getDate(int parameterIndex) throws SQLException;
  123. /**
  124. * Gets the value of a specified JDBC DATE parameter as a java.sql.Date.,
  125. * using a specified Calendar to construct the date.
  126. * <p>
  127. * The JDBC driver uses the Calendar to create the Date using a particular
  128. * timezone and locale. Default behaviour of the driver is to use the Java
  129. * virtual machine default settings.
  130. *
  131. * @param parameterIndex
  132. * the parameter number index, where the first parameter has
  133. * index 1
  134. * @param cal
  135. * the Calendar to use to construct the Date
  136. * @return the java.sql.Date with the parameter value. null if the value is
  137. * SQL NULL.
  138. * @throws SQLException
  139. * if a database error happens
  140. */
  141. public Date getDate(int parameterIndex, Calendar cal) throws SQLException;
  142. /**
  143. * Gets the value of a specified JDBC DOUBLE parameter as a double
  144. *
  145. * @param parameterIndex
  146. * the parameter number index, where the first parameter has
  147. * index 1
  148. * @return the double with the parameter value. 0.0 if the value is SQL
  149. * NULL.
  150. * @throws SQLException
  151. * if a database error happens
  152. */
  153. public double getDouble(int parameterIndex) throws SQLException;
  154. /**
  155. * Gets the value of a specified JDBC FLOAT parameter as a float
  156. *
  157. * @param parameterIndex
  158. * the parameter number index, where the first parameter has
  159. * index 1
  160. * @return the float with the parameter value. 0.0 if the value is SQL NULL.
  161. * @throws SQLException
  162. * if a database error happens
  163. */
  164. public float getFloat(int parameterIndex) throws SQLException;
  165. /**
  166. * Gets the value of a specified JDBC INTEGER parameter as an int
  167. *
  168. * @param parameterIndex
  169. * the parameter number index, where the first parameter has
  170. * index 1
  171. * @return the int with the parameter value. 0 if the value is SQL NULL.
  172. * @throws SQLException
  173. * if a database error happens
  174. */
  175. public int getInt(int parameterIndex) throws SQLException;
  176. /**
  177. * Gets the value of a specified JDBC BIGINT parameter as a long
  178. *
  179. * @param parameterIndex
  180. * the parameter number index, where the first parameter has
  181. * index 1
  182. * @return the long with the parameter value. 0 if the value is SQL NULL.
  183. * @throws SQLException
  184. * if a database error happens
  185. */
  186. public long getLong(int parameterIndex) throws SQLException;
  187. /**
  188. * Gets the value of a specified parameter as a Java <code>Object</code>.
  189. * <p>
  190. * The object type returned is the JDBC type registered for the parameter
  191. * with a <code>registerOutParameter</code> call. If a parameter was
  192. * registered as a <code>java.sql.Types.OTHER</code> then it may hold
  193. * abstract types that are particular to the connected database.
  194. *
  195. * @param parameterIndex
  196. * the parameter number index, where the first parameter has
  197. * index 1
  198. * @return an Object holding the value of the parameter.
  199. * @throws SQLException
  200. * if there is a problem accessing the database
  201. */
  202. public Object getObject(int parameterIndex) throws SQLException;
  203. /**
  204. * Gets the value of a specified JDBC SMALLINT parameter as a short
  205. *
  206. * @param parameterIndex
  207. * the parameter number index, where the first parameter has
  208. * index 1
  209. * @return a short with the parameter value. 0 if the value is SQL NULL.
  210. * @throws SQLException
  211. * if a database error happens
  212. */
  213. public short getShort(int parameterIndex) throws SQLException;
  214. /**
  215. * Returns the indexed parameter's value as a string. The parameter value
  216. * must be one of the JDBC types <code>CHAR</code>, <code>VARCHAR</code>
  217. * or <code>LONGVARCHAR</code>.
  218. * <p>
  219. * The string corresponding to a <code>CHAR</code> of fixed length will be
  220. * of identical length to the value in the database inclusive of padding
  221. * characters.
  222. *
  223. * @param parameterIndex
  224. * the parameter number index, where the first parameter has
  225. * index 1
  226. * @return a String with the parameter value. null if the value is SQL NULL.
  227. * @throws SQLException
  228. * if there is a problem accessing the database
  229. */
  230. public String getString(int parameterIndex) throws SQLException;
  231. /**
  232. * Gets the value of a specified JDBC TIME parameter as a java.sql.Time.
  233. *
  234. * @param parameterIndex
  235. * the parameter number index, where the first parameter has
  236. * index 1
  237. * @return a java.sql.Time with the parameter value. null if the value is
  238. * SQL NULL.
  239. * @throws SQLException
  240. * if a database error happens
  241. */
  242. public Time getTime(int parameterIndex) throws SQLException;
  243. /**
  244. * Gets the value of a specified JDBC TIME parameter as a java.sql.Time,
  245. * using the supplied Calendar to construct the time. The JDBC driver uses
  246. * the Calendar to handle specific timezones and locales when creating the
  247. * Time.
  248. *
  249. * @param parameterIndex
  250. * the parameter number index, where the first parameter has
  251. * index 1
  252. * @param cal
  253. * the Calendar to use in constructing the Time.
  254. * @return a java.sql.Time with the parameter value. null if the value is
  255. * SQL NULL.
  256. * @throws SQLException
  257. * if a database error happens
  258. */
  259. public Time getTime(int parameterIndex, Calendar cal) throws SQLException;
  260. /**
  261. * Returns the indexed parameter's <code>TIMESTAMP</code> value as a
  262. * <code>java.sql.Timestamp</code>.
  263. *
  264. * @param parameterIndex
  265. * the parameter number index, where the first parameter has
  266. * index 1
  267. * @return a new <code>java.sql.Timestamp</code> with the parameter value.
  268. * A <code>null</code> reference is returned for an SQL value of
  269. * <code>NULL</code>
  270. * @throws SQLException
  271. * if a database error happens
  272. */
  273. public Timestamp getTimestamp(int parameterIndex) throws SQLException;
  274. /**
  275. * Returns the indexed parameter's <code>TIMESTAMP</code> value as a
  276. * <code>java.sql.Timestamp</code>. The JDBC driver uses the supplied
  277. * <code>Calendar</code> to handle specific timezones and locales when
  278. * creating the result.
  279. *
  280. * @param parameterIndex
  281. * the parameter number index, where the first parameter has
  282. * index 1
  283. * @param cal
  284. * used for creating the returned <code>Timestamp</code>
  285. * @return a new <code>java.sql.Timestamp</code> with the parameter value.
  286. * A <code>null</code> reference is returned for an SQL value of
  287. * <code>NULL</code>
  288. * @throws SQLException
  289. * if a database error happens
  290. */
  291. public Timestamp getTimestamp(int parameterIndex, Calendar cal)
  292. throws SQLException;
  293. /**
  294. * Gets the value of a specified JDBC DATALINK parameter as a java.net.URL.
  295. *
  296. * @param parameterIndex
  297. * the parameter number index, where the first parameter has
  298. * index 1
  299. * @return a java.sql.Datalink with the parameter value. null if the value
  300. * is SQL NULL.
  301. * @throws SQLException
  302. * if a database error happens
  303. */
  304. public URL getURL(int parameterIndex) throws SQLException;
  305. /**
  306. * Defines the Type of a specified OUT parameter. All OUT parameters must
  307. * have their Type defined before a stored procedure is executed.
  308. * <p>
  309. * The Type defined by this method fixes the Java type that must be
  310. * retrieved using the getter methods of CallableStatement. If a database
  311. * specific type is expected for a parameter, the Type java.sql.Types.OTHER
  312. * should be used. Note that there is another variant of this method for
  313. * User Defined Types or a REF type.
  314. *
  315. * @param parameterIndex
  316. * the parameter number index, where the first parameter has
  317. * index 1
  318. * @param sqlType
  319. * the JDBC type as defined by java.sql.Types. The JDBC types
  320. * NUMERIC and DECIMAL should be defined using the version of
  321. * <code>registerOutParameter</code> that takes a
  322. * <code>scale</code> parameter.
  323. * @throws SQLException
  324. * if a database error happens
  325. */
  326. public void registerOutParameter(int parameterIndex, int sqlType)
  327. throws SQLException;
  328. /**
  329. * Defines the Type of a specified OUT parameter. All OUT parameters must
  330. * have their Type defined before a stored procedure is executed. This
  331. * version of the registerOutParameter method, which has a scale parameter,
  332. * should be used for the JDBC types NUMERIC and DECIMAL, where there is a
  333. * need to specify the number of digits expected after the decimal point.
  334. * <p>
  335. * The Type defined by this method fixes the Java type that must be
  336. * retrieved using the getter methods of CallableStatement.
  337. *
  338. * @param parameterIndex
  339. * the parameter number index, where the first parameter has
  340. * index 1
  341. * @param sqlType
  342. * the JDBC type as defined by java.sql.Types.
  343. * @param scale
  344. * the number of digits after the decimal point. Must be greater
  345. * than or equal to 0.
  346. * @throws SQLException
  347. * if a database error happens
  348. */
  349. public void registerOutParameter(int parameterIndex, int sqlType, int scale)
  350. throws SQLException;
  351. /**
  352. * Defines the Type of a specified OUT parameter. This variant of the method
  353. * is designed for use with parameters that are User Defined Types (UDT) or
  354. * a REF type, although it can be used for any type.
  355. *
  356. * @param paramIndex
  357. * the parameter number index, where the first parameter has
  358. * index 1
  359. * @param sqlType
  360. * a JDBC type expressed as a constant from {@link Types}
  361. * @param typeName
  362. * an SQL type name. For a REF type, this name should be the
  363. * fully qualified name of the referenced type.
  364. * @throws SQLException
  365. * if a database error happens
  366. */
  367. public void registerOutParameter(int paramIndex, int sqlType,
  368. String typeName) throws SQLException;
  369. /**
  370. * Gets whether the value of the last OUT parameter read was SQL NULL.
  371. *
  372. * @return true if the last parameter was SQL NULL, false otherwise.
  373. * @throws SQLException
  374. * if a database error happens
  375. */
  376. public boolean wasNull() throws SQLException;
  377. }