use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class JdbcParameterMetaData method getParameterClassName.
/**
* Returns the Java class name of the parameter.
* "java.lang.String" is returned if the type is not known.
*
* @param param the column index (1,2,...)
* @return the Java class name
*/
@Override
public String getParameterClassName(int param) throws SQLException {
try {
debugCodeCall("getParameterClassName", param);
ParameterInterface p = getParameter(param);
int type = p.getType();
if (type == Value.UNKNOWN) {
type = Value.STRING;
}
return DataType.getTypeClassName(type);
} catch (Exception e) {
throw logAndConvert(e);
}
}
use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class JdbcParameterMetaData method getParameterTypeName.
/**
* Returns the parameter type name.
* "VARCHAR" is returned if the type is not known.
*
* @param param the column index (1,2,...)
* @return the type name
*/
@Override
public String getParameterTypeName(int param) throws SQLException {
try {
debugCodeCall("getParameterTypeName", param);
ParameterInterface p = getParameter(param);
int type = p.getType();
if (type == Value.UNKNOWN) {
type = Value.STRING;
}
return DataType.getDataType(type).name;
} catch (Exception e) {
throw logAndConvert(e);
}
}
use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class JdbcCallableStatement method registerOutParameter.
private void registerOutParameter(int parameterIndex) throws SQLException {
try {
checkClosed();
if (outParameters == null) {
maxOutParameters = Math.min(getParameterMetaData().getParameterCount(), getCheckedMetaData().getColumnCount());
outParameters = new BitSet();
}
checkIndexBounds(parameterIndex);
ParameterInterface param = command.getParameters().get(--parameterIndex);
if (!param.isValueSet()) {
param.setValue(ValueNull.INSTANCE, false);
}
outParameters.set(parameterIndex);
} catch (Exception e) {
throw logAndConvert(e);
}
}
use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class JdbcPreparedStatement method clearParameters.
/**
* Clears all parameters.
*
* @throws SQLException if this object is closed or invalid
*/
@Override
public void clearParameters() throws SQLException {
try {
debugCodeCall("clearParameters");
checkClosed();
ArrayList<? extends ParameterInterface> parameters = command.getParameters();
for (ParameterInterface param : parameters) {
// can only delete old temp files if they are not in the batch
param.setValue(null, batchParameters == null);
}
} catch (Exception e) {
throw logAndConvert(e);
}
}
use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class JdbcPreparedStatement method setParameter.
// =============================================================
private void setParameter(int parameterIndex, Value value) {
checkClosed();
parameterIndex--;
ArrayList<? extends ParameterInterface> parameters = command.getParameters();
if (parameterIndex < 0 || parameterIndex >= parameters.size()) {
throw DbException.getInvalidValueException("parameterIndex", parameterIndex + 1);
}
ParameterInterface param = parameters.get(parameterIndex);
// can only delete old temp files if they are not in the batch
param.setValue(value, batchParameters == null);
}
Aggregations