📄 jdbccallablestatement.java
字号:
String[] names;
String name;
// outRegistrationMap = new IntKeyIntValueHashMap();
parameterNameMap = new IntValueHashMap();
if (pmdDescriptor != null && pmdDescriptor.metaData != null) {
names = pmdDescriptor.metaData.colNames;
for (int i = 0; i < names.length; i++) {
name = names[i];
// PRE: should never happen in practice
if (name == null || name.length() == 0) {
continue; // throw?
}
parameterNameMap.put(name, i);
}
}
}
/**
* Retrieves the parameter index corresponding to the given
* parameter name. <p>
*
* @param parameterName to look up
* @throws SQLException if not found
* @return index for name
*/
int findParameterIndex(String parameterName) throws SQLException {
checkClosed();
int index = parameterNameMap.get(parameterName, -1);
if (index >= 0) {
return index;
}
throw Util.sqlException(Trace.COLUMN_NOT_FOUND, parameterName);
}
/**
* Does the specialized work required to free this object's resources and
* that of it's parent classes. <p>
*
* @throws SQLException if a database access error occurs
*/
public void close() throws SQLException {
if (isClosed()) {
return;
}
// outRegistrationMap = null;
parameterNameMap = null;
super.close();
}
/**
* Performs an internal check for OUT or IN OUT column index validity. <p>
*
* @param i the one-based column index to check
* @throws SQLException if there is no such OUT or IN OUT column
*/
private void checkGetParameterIndex(int i) throws SQLException {
checkClosed();
if (i < 1 || i > parameterModes.length) {
String msg = "Parameter index out of bounds: " + i;
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT, msg);
}
/*
int mode = parameterModes[i - 1];
switch (mode) {
default :
String msg = "Not OUT or IN OUT mode: " + mode
+ " for parameter: " + i;
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT, msg);
case Expression.PARAM_IN_OUT :
case Expression.PARAM_OUT :
break;
// this is OK
}
*/
}
/**
* Checks if the parameter of the given index has been successfully
* registered as an OUT parameter. <p>
*
* @param parameterIndex to check
* @throws SQLException if not registered
*/
/*
private void checkIsRegisteredParameterIndex(int parameterIndex)
throws SQLException {
int type;
String msg;
checkClosed();
type = outRegistrationMap.get(parameterIndex, Integer.MIN_VALUE);
if (type == Integer.MIN_VALUE) {
msg = "Parameter not registered: " + parameterIndex;
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT, msg);
}
}
*/
// ----------------------------------- JDBC 1 ----------------------------------
/**
* <!-- start generic documentation -->
* Registers the OUT parameter in ordinal position
* <code>parameterIndex</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 parameterIndex the first parameter is 1, the second is 2,
* and so on
* @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
* @see java.sql.Types
*/
public void registerOutParameter(int parameterIndex,
int sqlType) throws SQLException {
throw Util.notSupported;
}
/**
* <!-- start generic documentation -->
* Registers the parameter in ordinal position
* <code>parameterIndex</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 parameterIndex the first parameter is 1, the second is 2,
* and so on
* @param sqlType the 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
* @see java.sql.Types
*/
public void registerOutParameter(int parameterIndex, int sqlType,
int scale) throws SQLException {
registerOutParameter(parameterIndex, sqlType);
}
/**
* <!-- start generic documentation -->
* Retrieves whether the last OUT parameter read had the value of
* SQL <code>NULL</code>. Note that this method should be called only
* after calling a getter method; otherwise, there is no value to use in
* determining whether it is <code>null</code> or not. <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 -->
*
* @return <code>true</code> if the last parameter read was SQL
* <code>NULL</code>; <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
public boolean wasNull() throws SQLException {
throw Util.notSupported;
}
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated JDBC <code>CHAR</code>,
* <code>VARCHAR</code>, or <code>LONGVARCHAR</code> parameter as a
* <code>String</code> in the Java programming language.
* <p>
* For the fixed-length type JDBC <code>CHAR</code>,
* the <code>String</code> object
* returned has exactly the same value the JDBC
* <code>CHAR</code> value had in the
* database, including any padding added by 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 parameterIndex the first parameter is 1, the second is 2,
* and so on
* @return the parameter value. If the value is SQL <code>NULL</code>,
* the result
* is <code>null</code>.
* @exception SQLException if a database access error occurs
* @see #setString
*/
public String getString(int parameterIndex) throws SQLException {
throw Util.notSupported;
}
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated JDBC <code>BIT</code> parameter
* as a <code>boolean</code> in the Java programming language. <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,
* and so on
* @return the parameter value. If the value is SQL <code>NULL</code>,
* the result is <code>false</code>.
* @exception SQLException if a database access error occurs
* @see #setBoolean
*/
public boolean getBoolean(int parameterIndex) throws SQLException {
throw Util.notSupported;
}
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated JDBC <code>TINYINT</code>
* parameter as a <code>byte</code> in the Java programming language. <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,
* and so on
* @return the parameter value. If the value is SQL <code>NULL</code>,
* the result is <code>0</code>.
* @exception SQLException if a database access error occurs
* @see #setByte
*/
public byte getByte(int parameterIndex) throws SQLException {
throw Util.notSupported;
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -