Coverage Report - org.mule.providers.jdbc.JdbcUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
JdbcUtils
0%
0/14
0%
0/5
2.667
 
 1  
 /*
 2  
  * $Id: JdbcUtils.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.providers.jdbc;
 12  
 
 13  
 import java.sql.Connection;
 14  
 import java.sql.SQLException;
 15  
 
 16  
 /**
 17  
  * Utility methods for working with various parts of JDBC.
 18  
  */
 19  0
 public abstract class JdbcUtils
 20  
 {
 21  
 
 22  
     public static void close(Connection con) throws SQLException
 23  
     {
 24  0
         if (con != null && !con.isClosed())
 25  
         {
 26  0
             con.close();
 27  
         }
 28  0
     }
 29  
 
 30  
     public static void commitAndClose(Connection con) throws SQLException
 31  
     {
 32  0
         if (con != null)
 33  
         {
 34  0
             if (con.getAutoCommit() == false)
 35  
             {
 36  0
                 con.commit();
 37  
             }
 38  0
             con.close();
 39  
         }
 40  0
     }
 41  
 
 42  
     public static void rollbackAndClose(Connection con) throws SQLException
 43  
     {
 44  0
         if (con != null)
 45  
         {
 46  0
             if (con.getAutoCommit() == false)
 47  
             {
 48  0
                 con.rollback();
 49  
             }
 50  0
             con.close();
 51  
         }
 52  0
     }
 53  
 
 54  
 }