Created a utility class to easy closing statements and connections and
such. git-svn-id: https://samskivert.googlecode.com/svn/trunk@18 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// $Id: JDBCUtil.java,v 1.1 2000/12/06 00:27:30 mdb Exp $
|
||||||
|
|
||||||
|
package com.samskivert.jdbc;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A repository for JDBC related utility functions.
|
||||||
|
*/
|
||||||
|
public class JDBCUtil
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Closes the supplied JDBC statement and gracefully handles being
|
||||||
|
* passed null (by doing nothing).
|
||||||
|
*/
|
||||||
|
public static void close (Statement stmt)
|
||||||
|
throws SQLException
|
||||||
|
{
|
||||||
|
if (stmt != null) {
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the supplied JDBC connection and gracefully handles being
|
||||||
|
* passed null (by doing nothing).
|
||||||
|
*/
|
||||||
|
public static void close (Connection conn)
|
||||||
|
throws SQLException
|
||||||
|
{
|
||||||
|
if (conn != null) {
|
||||||
|
conn.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# $Id: Makefile,v 1.1 2000/12/06 00:27:30 mdb Exp $
|
||||||
|
|
||||||
|
ROOT = ../../..
|
||||||
|
|
||||||
|
SRCS = \
|
||||||
|
JDBCUtil.java \
|
||||||
|
|
||||||
|
include $(ROOT)/build/Makefile.java
|
||||||
Reference in New Issue
Block a user