Coverage Report - org.mule.transport.jdbc.ExtendedQueryRunner
 
Classes in this File Line Coverage Branch Coverage Complexity
ExtendedQueryRunner
0%
0/8
0%
0/2
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transport.jdbc;
 8  
 
 9  
 import java.sql.Connection;
 10  
 import java.sql.PreparedStatement;
 11  
 import java.sql.SQLException;
 12  
 
 13  
 import javax.sql.DataSource;
 14  
 
 15  
 import org.apache.commons.dbutils.QueryRunner;
 16  
 
 17  
 /**
 18  
  * An extended version of the Query runner that supports query timeouts
 19  
  * 
 20  
  * @since 2.2.6
 21  
  */
 22  
 public class ExtendedQueryRunner extends QueryRunner
 23  
 {
 24  
     private int queryTimeout;
 25  
 
 26  
     public ExtendedQueryRunner(DataSource ds, int queryTimeout)
 27  
     {
 28  0
             super (ds);
 29  0
         this.queryTimeout = queryTimeout;
 30  0
     }
 31  
 
 32  
     @Override
 33  
     protected PreparedStatement prepareStatement(Connection conn, String sql) throws SQLException
 34  
     {
 35  0
         PreparedStatement statement = super.prepareStatement(conn, sql);
 36  0
         if (this.queryTimeout >= 0)
 37  
         {
 38  0
             statement.setQueryTimeout(this.queryTimeout);
 39  
         }
 40  0
         return statement;
 41  
     }
 42  
 
 43  
     public int getQueryTimeout()
 44  
     {
 45  0
         return this.queryTimeout;
 46  
     }
 47  
 }