use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class JdbcParameterMetaData method getPrecision.
/**
* Returns the parameter precision.
* The value 0 is returned if the precision is not known.
*
* @param param the column index (1,2,...)
* @return the precision
*/
@Override
public int getPrecision(int param) throws SQLException {
try {
debugCodeCall("getPrecision", param);
ParameterInterface p = getParameter(param);
return MathUtils.convertLongToInt(p.getPrecision());
} catch (Exception e) {
throw logAndConvert(e);
}
}
use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class JdbcPreparedStatement method addBatch.
/**
* Adds the current settings to the batch.
*/
@Override
public void addBatch() throws SQLException {
try {
debugCodeCall("addBatch");
checkClosedForWrite();
try {
ArrayList<? extends ParameterInterface> parameters = command.getParameters();
int size = parameters.size();
Value[] set = new Value[size];
for (int i = 0; i < size; i++) {
ParameterInterface param = parameters.get(i);
param.checkSet();
Value value = param.getParamValue();
set[i] = value;
}
if (batchParameters == null) {
batchParameters = New.arrayList();
}
batchParameters.add(set);
} finally {
afterWriting();
}
} catch (Exception e) {
throw logAndConvert(e);
}
}
use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class TcpServerThread method setParameters.
private void setParameters(Command command) throws IOException {
int len = transfer.readInt();
ArrayList<? extends ParameterInterface> params = command.getParameters();
for (int i = 0; i < len; i++) {
Parameter p = (Parameter) params.get(i);
p.setValue(transfer.readValue());
}
}
use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class CommandRemote method sendParameters.
private void sendParameters(Transfer transfer) throws IOException {
int len = parameters.size();
transfer.writeInt(len);
for (ParameterInterface p : parameters) {
Value pVal = p.getParamValue();
if (pVal == null && cmdType == EXPLAIN) {
pVal = ValueNull.INSTANCE;
}
transfer.writeValue(pVal);
}
}
use of org.h2.expression.ParameterInterface in project h2database by h2database.
the class Command method reuse.
/**
* The command is now re-used, therefore reset the canReuse flag, and the
* parameter values.
*/
public void reuse() {
canReuse = false;
ArrayList<? extends ParameterInterface> parameters = getParameters();
for (ParameterInterface param : parameters) {
param.setValue(null, true);
}
}
Aggregations