/** * 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 (int i = 0, size = parameters.size(); i < size; i++) { ParameterInterface param = parameters.get(i); param.setValue(null, true); } }
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); }
/** * 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 (int i = 0, size = parameters.size(); i < size; i++) { ParameterInterface param = parameters.get(i); // can only delete old temp files if they are not in the batch param.setValue(null, batchParameters == null); } } catch (Exception e) { throw logAndConvert(e); } }
@Override protected boolean checkClosed() { if (super.checkClosed()) { // if the session was re-connected, re-prepare the statement ArrayList<? extends ParameterInterface> oldParams = command.getParameters(); command = conn.prepareCommand(sqlStatement, fetchSize); ArrayList<? extends ParameterInterface> newParams = command.getParameters(); for (int i = 0, size = oldParams.size(); i < size; i++) { ParameterInterface old = oldParams.get(i); Value value = old.getParamValue(); if (value != null) { ParameterInterface n = newParams.get(i); n.setValue(value, false); } } return true; } return false; }
private void registerOutParameter(int parameterIndex) throws SQLException { try { checkClosed(); if (outParameters == null) { maxOutParameters = Math.min( getParameterMetaData().getParameterCount(), getCheckedMetaData().getColumnCount()); outParameters = new BitField(); } 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); } }
Value value = set[j]; ParameterInterface param = parameters.get(j); param.setValue(value, false);