📄 jdbccallablestatement.java
字号:
* Examples of user-defined types include: <code>STRUCT</code>,
* <code>DISTINCT</code>, <code>JAVA_OBJECT</code>, and named array types.
*
* Before executing a stored procedure call, you must explicitly
* call <code>registerOutParameter</code> to register the type from
* <code>java.sql.Types</code> for each
* OUT parameter. For a user-defined parameter, the fully-qualified SQL
* type name of the parameter should also be given, while a
* <code>REF</code> parameter requires that the fully-qualified type name
* of the referenced type be given. A JDBC driver that does not need the
* type code and type name information may ignore it. To be portable,
* however, applications should always provide these values for
* user-defined and <code>REF</code> parameters.
*
* Although it is intended for user-defined and <code>REF</code> parameters,
* this method may be used to register a parameter of any JDBC type.
* If the parameter does not have a user-defined or <code>REF</code> type,
* the <i>typeName</i> parameter is ignored.
*
* <P><B>Note:</B> When reading the value of an out parameter, you
* must use the getter method whose Java type corresponds to the
* parameter's registered SQL type. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>.
* </div>
* <!-- end release-specific documentation -->
*
* @param paramIndex the first parameter is 1, the second is 2,...
* @param sqlType a value from {@link java.sql.Types}
* @param typeName the fully-qualified name of an SQL structured type
* @exception SQLException if a database access error occurs
* @see java.sql.Types
* @since JDK 1.2 (JDK 1.1.x developers: read the new overview for
* jdbcPreparedStatement)
*
*/
public void registerOutParameter(int paramIndex, int sqlType,
String typeName) throws SQLException {
registerOutParameter(paramIndex, sqlType);
}
// ----------------------------------- JDBC 3 ----------------------------------
/**
* <!-- start generic documentation -->
* Registers the OUT parameter named
* <code>parameterName</code> to the JDBC type
* <code>sqlType</code>. All OUT parameters must be registered
* before a stored procedure is executed.
* <p>
* The JDBC type specified by <code>sqlType</code> for an OUT
* parameter determines the Java type that must be used
* in the <code>get</code> method to read the value of that parameter.
* <p>
* If the JDBC type expected to be returned to this output parameter
* is specific to this particular database, <code>sqlType</code>
* should be <code>java.sql.Types.OTHER</code>. The method
* {@link #getObject} retrieves the value. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>.
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterName the name of the parameter
* @param sqlType the JDBC type code defined by <code>java.sql.Types</code>.
* If the parameter is of JDBC type <code>NUMERIC</code>
* or <code>DECIMAL</code>, the version of
* <code>registerOutParameter</code> that accepts a scale value
* should be used.
* @exception SQLException if a database access error occurs
* @since JDK 1.4, HSQL 1.7.0
* @see java.sql.Types
*/
//#ifdef JDBC3
public void registerOutParameter(String parameterName,
int sqlType) throws SQLException {
registerOutParameter(findParameterIndex(parameterName), sqlType);
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Registers the parameter named
* <code>parameterName</code> to be of JDBC type
* <code>sqlType</code>. This method must be called
* before a stored procedure is executed.
* <p>
* The JDBC type specified by <code>sqlType</code> for an OUT
* parameter determines the Java type that must be used
* in the <code>get</code> method to read the value of that parameter.
* <p>
* This version of <code>registerOutParameter</code> should be
* used when the parameter is of JDBC type <code>NUMERIC</code>
* or <code>DECIMAL</code>. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>.
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterName the name of the parameter
* @param sqlType SQL type code defined by <code>java.sql.Types</code>.
* @param scale the desired number of digits to the right of the
* decimal point. It must be greater than or equal to zero.
* @exception SQLException if a database access error occurs
* @since JDK 1.4, HSQLDB 1.7.0
* @see java.sql.Types
*/
//#ifdef JDBC3
public void registerOutParameter(String parameterName, int sqlType,
int scale) throws SQLException {
registerOutParameter(findParameterIndex(parameterName), sqlType);
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Registers the designated output parameter. This version of
* the method <code>registerOutParameter</code>
* should be used for a user-named or REF output parameter. Examples
* of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
* named array types.
*
* Before executing a stored procedure call, you must explicitly
* call <code>registerOutParameter</code> to register the type from
* <code>java.sql.Types</code> for each
* OUT parameter. For a user-named parameter the fully-qualified SQL
* type name of the parameter should also be given, while a REF
* parameter requires that the fully-qualified type name of the
* referenced type be given. A JDBC driver that does not need the
* type code and type name information may ignore it. To be portable,
* however, applications should always provide these values for
* user-named and REF parameters.
*
* Although it is intended for user-named and REF parameters,
* this method may be used to register a parameter of any JDBC type.
* If the parameter does not have a user-named or REF type, the
* typeName parameter is ignored.
*
* <P><B>Note:</B> When reading the value of an out parameter, you
* must use the <code>getXXX</code> method whose Java type XXX corresponds
* to the parameter's registered SQL type. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>.
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterName the name of the parameter
* @param sqlType a value from {@link java.sql.Types}
* @param typeName the fully-qualified name of an SQL structured type
* @exception SQLException if a database access error occurs
* @see java.sql.Types
* @since JDK 1.4, HSQL 1.7.0
*/
//#ifdef JDBC3
public void registerOutParameter(String parameterName, int sqlType,
String typeName) throws SQLException {
registerOutParameter(findParameterIndex(parameterName), sqlType);
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated JDBC <code>DATALINK</code>
* parameter as a <code>java.net.URL</code> object. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>.
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2,...
* @return a <code>java.net.URL</code> object that represents the
* JDBC <code>DATALINK</code> value used as the designated
* parameter
* @exception SQLException if a database access error occurs,
* or if the URL being returned is
* not a valid URL on the Java platform
* @see #setURL
* @since JDK 1.4, HSQLDB 1.7.0
*/
//#ifdef JDBC3
public java.net.URL getURL(int parameterIndex) throws SQLException {
throw Util.notSupported;
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Sets the designated parameter to the given <code>java.net.URL</code>
* object. The driver converts this to an SQL <code>DATALINK</code>
* value when it sends it to the database. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>.
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterName the name of the parameter
* @param val the parameter value
* @exception SQLException if a database access error occurs,
* or if a URL is malformed
* @see #getURL
* @since JDK 1.4, HSQL 1.7.0
*/
//#ifdef JDBC3
public void setURL(String parameterName,
java.net.URL val) throws SQLException {
setURL(findParameterIndex(parameterName), val);
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Sets the designated parameter to SQL <code>NULL</code>.
*
* <P><B>Note:</B> You must specify the parameter's SQL type. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Starting with 1.7.2, HSLQDB supports this.
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterName the name of the parameter
* @param sqlType the SQL type code defined in <code>java.sql.Types</code>
* @exception SQLException if a database access error occurs
* @since JDK 1.4, HSQLDB 1.7.0
*/
//#ifdef JDBC3
public void setNull(String parameterName,
int sqlType) throws SQLException {
setNull(findParameterIndex(parameterName), sqlType);
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Sets the designated parameter to the given Java <code>boolean</code>
* value. The driver converts this to an SQL <code>BIT</code> value when
* it sends it to the database. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Starting with 1.7.2, HSLQDB supports this.
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterName the name of the parameter
* @param x the parameter value
* @exception SQLException if a database access error occurs
* @see #getBoolean
* @since JDK 1.4, HSQLDB 1.7.0
*/
//#ifdef JDBC3
public void setBoolean(String parameterName,
boolean x) throws SQLException {
setBoolean(findParameterIndex(parameterName), x);
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Sets the designated parameter to the given Java <code>byte</code> value.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -