| 1 | |
package liquibase.executor.jvm; |
| 2 | |
|
| 3 | |
import java.sql.PreparedStatement; |
| 4 | |
import java.sql.SQLException; |
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
class ArgPreparedStatementSetter implements PreparedStatementSetter { |
| 12 | |
|
| 13 | |
private final Object[] args; |
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | 0 | public ArgPreparedStatementSetter(Object[] args) { |
| 22 | 0 | this.args = args; |
| 23 | 0 | } |
| 24 | |
|
| 25 | |
public void setValues(PreparedStatement ps) throws SQLException { |
| 26 | 0 | if (this.args != null) { |
| 27 | 0 | for (int i = 0; i < this.args.length; i++) { |
| 28 | 0 | Object arg = this.args[i]; |
| 29 | 0 | if (arg instanceof SqlParameterValue) { |
| 30 | 0 | SqlParameterValue paramValue = (SqlParameterValue) arg; |
| 31 | 0 | StatementCreatorUtils.setParameterValue(ps, i + 1, paramValue, paramValue.getValue()); |
| 32 | 0 | } else { |
| 33 | 0 | StatementCreatorUtils.setParameterValue(ps, i + 1, SqlTypeValue.TYPE_UNKNOWN, arg); |
| 34 | |
} |
| 35 | |
} |
| 36 | |
} |
| 37 | 0 | } |
| 38 | |
|
| 39 | |
} |