protected static void setStatementParameters(Object[] values, PreparedStatement ps, @Nullable int[] columnTypes) throws SQLException { int colIndex = 0; for (Object value : values) { colIndex++; if (value instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) value; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } else { int colType; if (columnTypes == null || columnTypes.length < colIndex) { colType = SqlTypeValue.TYPE_UNKNOWN; } else { colType = columnTypes[colIndex - 1]; } StatementCreatorUtils.setParameterValue(ps, colIndex, colType, value); } } }
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { Object[] values = batchArgs.get(i); int colIndex = 0; for (Object value : values) { colIndex++; if (value instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) value; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } else { int colType; if (argTypes.length < colIndex) { colType = SqlTypeValue.TYPE_UNKNOWN; } else { colType = argTypes[colIndex - 1]; } StatementCreatorUtils.setParameterValue(ps, colIndex, colType, value); } } } @Override
/** * Set the value for prepared statements specified parameter index using the passed in value. * This method can be overridden by sub-classes if needed. * @param ps the PreparedStatement * @param parameterPosition index of the parameter position * @param argValue the value to set * @throws SQLException if thrown by PreparedStatement methods */ protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException { if (argValue instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) argValue; StatementCreatorUtils.setParameterValue(ps, parameterPosition, paramValue, paramValue.getValue()); } else { StatementCreatorUtils.setParameterValue(ps, parameterPosition, SqlTypeValue.TYPE_UNKNOWN, argValue); } }
Object value = paramSource.getValue(paramName); if (value instanceof SqlParameterValue) { value = ((SqlParameterValue) value).getValue();
Object value = parameterValue; if (value instanceof SqlParameterValue) { value = ((SqlParameterValue) value).getValue();
in = paramValue.getValue(); declaredParameter = paramValue;
typeNameToUse = parameterValue.getTypeName(); inValueToUse = parameterValue.getValue();
@Override public PreparedStatement createPreparedStatement(Connection con) throws SQLException { PreparedStatement ps = con.prepareStatement(sql); if (returnKeys) { ps = con.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); } else { ps = con.prepareStatement(sql); } if (args != null) { for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) arg; StatementCreatorUtils.setParameterValue(ps, i + 1, paramValue, paramValue.getValue()); } else { StatementCreatorUtils.setParameterValue(ps, i + 1, SqlTypeValue.TYPE_UNKNOWN, arg); } } } return ps; } };
private void doSetStatementParameters(SqlParameterValue[] values, PreparedStatement ps) throws SQLException { int colIndex = 0; for (SqlParameterValue paramValue : values) { colIndex++; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } }
private Object[] convertToObject(SqlParameterValue[] values) { if (ArrayUtil.isEmptyArray(values)) { return new Object[0]; } Object[] params = new Object[values.length]; for (int i = 0; i < values.length; i++) { params[i] = values[i].getValue(); } return params; }
private void doSetStatementParameters(SqlParameterValue[] values, PreparedStatement ps) throws SQLException { int colIndex = 0; for (SqlParameterValue paramValue : values) { colIndex++; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } }
public void setValues(PreparedStatement ps) throws SQLException { if (this.args != null) { for (int i = 0; i < this.args.length; i++) { Object arg = this.args[i]; if (arg instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) arg; StatementCreatorUtils.setParameterValue(ps, i + 1, paramValue, paramValue.getValue()); } else { StatementCreatorUtils.setParameterValue(ps, i + 1, SqlTypeValue.TYPE_UNKNOWN, arg); } } } }
public void setValues(PreparedStatement ps) throws SQLException { if (this.args != null) { for (int i = 0; i < this.args.length; i++) { Object arg = this.args[i]; if (arg instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) arg; StatementCreatorUtils.setParameterValue(ps, i + 1, paramValue, paramValue.getValue()); } else { StatementCreatorUtils.setParameterValue(ps, i + 1, SqlTypeValue.TYPE_UNKNOWN, arg); } } } }
/** * Set the value for prepared statements specified parameter index using the passed in value. * This method can be overridden by sub-classes if needed. * @param ps the PreparedStatement * @param parameterPosition index of the parameter position * @param argValue the value to set * @throws SQLException if thrown by PreparedStatement methods */ protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException { if (argValue instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) argValue; StatementCreatorUtils.setParameterValue(ps, parameterPosition, paramValue, paramValue.getValue()); } else { StatementCreatorUtils.setParameterValue(ps, parameterPosition, SqlTypeValue.TYPE_UNKNOWN, argValue); } }
/** * Set the value for prepared statements specified parameter index using the passed in value. * This method can be overridden by sub-classes if needed. * @param ps the PreparedStatement * @param parameterPosition index of the parameter position * @param argValue the value to set * @throws SQLException */ protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException { if (argValue instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) argValue; StatementCreatorUtils.setParameterValue(ps, parameterPosition, paramValue, paramValue.getValue()); } else { StatementCreatorUtils.setParameterValue(ps, parameterPosition, SqlTypeValue.TYPE_UNKNOWN, argValue); } }
private void doSetStatementParameters(List<Object> values, PreparedStatement ps, int[] columnTypes) throws SQLException { int colIndex = 0; for (Object value : values) { colIndex++; if (value instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) value; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } else { int colType; if (columnTypes == null || columnTypes.length < colIndex) { colType = SqlTypeValue.TYPE_UNKNOWN; } else { colType = columnTypes[colIndex - 1]; } StatementCreatorUtils.setParameterValue(ps, colIndex, colType, value); } } } }
private void doSetStatementParameters(Object[] values, PreparedStatement ps, int[] columnTypes) throws SQLException { int colIndex = 0; for (Object value : values) { colIndex++; if (value instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) value; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } else { int colType; if (columnTypes == null || columnTypes.length < colIndex) { colType = SqlTypeValue.TYPE_UNKNOWN; } else { colType = columnTypes[colIndex - 1]; } StatementCreatorUtils.setParameterValue(ps, colIndex, colType, value); } } } }
protected static void setStatementParameters(Object[] values, PreparedStatement ps, int[] columnTypes) throws SQLException { int colIndex = 0; for (Object value : values) { colIndex++; if (value instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) value; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } else { int colType; if (columnTypes == null || columnTypes.length < colIndex) { colType = SqlTypeValue.TYPE_UNKNOWN; } else { colType = columnTypes[colIndex - 1]; } StatementCreatorUtils.setParameterValue(ps, colIndex, colType, value); } } }
private void doSetStatementParameters(List<Object> values, PreparedStatement ps, int[] columnTypes) throws SQLException { int colIndex = 0; for (Object value : values) { colIndex++; if (value instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) value; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } else { int colType; if (columnTypes == null || columnTypes.length < colIndex) { colType = SqlTypeValue.TYPE_UNKNOWN; } else { colType = columnTypes[colIndex - 1]; } StatementCreatorUtils.setParameterValue(ps, colIndex, colType, value); } } } }
private void doSetStatementParameters(List<Object> values, PreparedStatement ps, Integer[] columnTypes) throws SQLException { int colIndex = 0; for (Object value : values) { colIndex++; if (value instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) value; StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue()); } else { int colType; if (columnTypes == null || columnTypes.length < colIndex) { colType = SqlTypeValue.TYPE_UNKNOWN; } else { colType = columnTypes[colIndex - 1]; } StatementCreatorUtils.setParameterValue(ps, colIndex, colType, value); } } } }