net.mtu.eggplant.util.sql
Class SQLFunctions

java.lang.Object
  extended by net.mtu.eggplant.util.sql.SQLFunctions

public final class SQLFunctions
extends Object

Handy functions for SQL

Version:
$Revision$

Method Summary
static void close(Connection connection)
          Close connection and ignore SQLExceptions.
static void close(PreparedStatement prep)
          Close prep and ignore SQLExceptions.
static void close(ResultSet rs)
          Close rs and ignore SQLExceptions.
static void close(Statement stmt)
          Close stmt and ignore SQLExceptions.
static Class<?> getClassForType(int type)
          Do simple mapping from an SQL type to a Java Class.
static Collection<String> getTablesInDB(Connection connection)
          Get the tables in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClassForType

public static Class<?> getClassForType(int type)
Do simple mapping from an SQL type to a Java Class.


close

public static void close(Statement stmt)
Close stmt and ignore SQLExceptions. This is useful in a finally so that all of the finally block gets executed. Handles null.


close

public static void close(PreparedStatement prep)
Close prep and ignore SQLExceptions. This is useful in a finally so that all of the finally block gets executed. Handles null.


close

public static void close(ResultSet rs)
Close rs and ignore SQLExceptions. This is useful in a finally so that all of the finally block gets executed. Handles null.


close

public static void close(Connection connection)
Close connection and ignore SQLExceptions. This is useful in a finally so that all of the finally block gets executed. Handles null.


getTablesInDB

public static Collection<String> getTablesInDB(Connection connection)
                                        throws SQLException
Get the tables in the database.

Parameters:
connection - the connection to the database
Returns:
the names of the tables that are of type "TABLE", the names will be all lowercase
Throws:
SQLException
See Also:
DatabaseMetaData.getTables(String, String, String, String[])