cvs commit: spice/sandbox/repository/componenthaus/sample/sqlexecutor/src/java/net/sf/componentfarm/sqlexecutor/api SqlUtil.java

Mike Hogan <[email protected]> Wed, 05 Nov 2003 11:35:50 -0800
Newsgroups gmane.comp.java.spice.cvs
Message-ID <[email protected]>
hogie       03/11/05 11:35:50

  Added:       sandbox/repository/componenthaus/sample/sqlexecutor/src/java/net/sf/componentfarm/sqlexecutor/api
                        SqlUtil.java
  Log:
  * Can have classes as service interfaces
   * Can have more than one service interface per submission
  
  Revision  Changes    Path
  1.1                  spice/sandbox/repository/componenthaus/sample/sqlexecutor/src/java/net/sf/componentfarm/sqlexecutor/api/SqlUtil.java
  
  Index: SqlUtil.java
  ===================================================================
  package net.sf.componentfarm.sqlexecutor.api;
  
  import java.sql.Connection;
  import java.sql.SQLException;
  import java.sql.ResultSet;
  import java.sql.Statement;
  
  /**
   * Small utility class that performs common operations
   * involved in using JDBC.
   */
  public class SqlUtil {
      /**
       * Close the given Connection, swallowing any SQLException that might be
       * thrown.  The connection can be null, in which case no action will be taken.
       */
      public static void close(Connection connection) {
          if (connection != null) {
              try {
                  connection.close();
              } catch (SQLException e) {
                  //ignore
              }
          }
      }
  
      /**
       * Close the given ResultSet, swallowing any SQLException that might be
       * thrown.  The ResultSet can be null, in which case no action will be taken.
       */
      public static void close(ResultSet resultSet) {
          if (resultSet != null) {
              try {
                  resultSet.close();
              } catch (SQLException e) {
                  //ignore
              }
          }
      }
  
      /**
       * Close the given Statement, swallowing any SQLException that might be
       * thrown.  The Statement can be null, in which case no action will be taken.
       */
      public static void close(Statement statement) {
          if (statement != null) {
              try {
                  statement.close();
              } catch (SQLException e) {
                  //ignore
              }
          }
      }
  }
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/