org.onetwo.dbm.jdbc.internal.DbmArgumentPreparedStatementSetter Maven / Gradle / Ivy
The newest version!
package org.onetwo.dbm.jdbc.internal;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import org.onetwo.dbm.jdbc.spi.JdbcStatementParameterSetter;
import org.onetwo.dbm.jdbc.spi.SqlParametersProvider;
import org.springframework.jdbc.core.ArgumentPreparedStatementSetter;
public class DbmArgumentPreparedStatementSetter extends ArgumentPreparedStatementSetter implements SqlParametersProvider {
private final Object[] preparedStatementArgs;
private JdbcStatementParameterSetter parameterSetter;
public DbmArgumentPreparedStatementSetter(JdbcStatementParameterSetter parameterSetter, Object[] args) {
super(args);
this.preparedStatementArgs = args;
this.parameterSetter = parameterSetter;
}
protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException {
parameterSetter.setParameterValue(ps, parameterPosition, argValue);
}
@Override
public Object[] getSqlParameters() {
return preparedStatementArgs;
}
@Override
public List> getSqlParameterList() {
return Arrays.asList(preparedStatementArgs);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy