Coverage Report - liquibase.executor.jvm.ArgPreparedStatementSetter
 
Classes in this File Line Coverage Branch Coverage Complexity
ArgPreparedStatementSetter
0%
0/12
0%
0/6
2.5
 
 1  
 package liquibase.executor.jvm;
 2  
 
 3  
 import java.sql.PreparedStatement;
 4  
 import java.sql.SQLException;
 5  
 
 6  
 /**
 7  
  * Simple adapter for PreparedStatementSetter that applies a given array of arguments.
 8  
  * 
 9  
  * @author Spring Framework
 10  
  */
 11  
 class ArgPreparedStatementSetter implements PreparedStatementSetter {
 12  
 
 13  
     private final Object[] args;
 14  
 
 15  
     /**
 16  
      * Create a new ArgPreparedStatementSetter for the given arguments.
 17  
      * 
 18  
      * @param args
 19  
      *            the arguments to set
 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  
 }