org.dbunit.util
Class SQLHelper

java.lang.Object
  extended by org.dbunit.util.SQLHelper

public class SQLHelper
extends java.lang.Object

Helper for SQL-related stuff.
TODO: testcases

Since:
Nov 5, 2005
Version:
$Revision: 499 $
Author:
Felipe Leme

Method Summary
static void close(java.sql.ResultSet rs, java.sql.Statement stmt)
          Close a result set and a prepared statement, checking for null references.
static void close(java.sql.Statement stmt)
          Close a preparement statement, checking for null references.
static java.lang.String getPrimaryKeyColumn(java.sql.Connection conn, java.lang.String table)
          Gets the primary column for a table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPrimaryKeyColumn

public static java.lang.String getPrimaryKeyColumn(java.sql.Connection conn,
                                                   java.lang.String table)
                                            throws java.sql.SQLException
Gets the primary column for a table.

Parameters:
conn - connection with the database
table - table name
Returns:
name of primary column for a table (assuming it's just 1 column).
Throws:
java.sql.SQLException - raised while getting the meta data

close

public static void close(java.sql.ResultSet rs,
                         java.sql.Statement stmt)
                  throws java.sql.SQLException
Close a result set and a prepared statement, checking for null references.

Parameters:
rs - result set to be closed
stmt - prepared statement to be closed
Throws:
java.sql.SQLException - exception raised in either close() method

close

public static void close(java.sql.Statement stmt)
                  throws java.sql.SQLException
Close a preparement statement, checking for null references.

Parameters:
rs - result set to be closed
stmt - statement to be closed
Throws:
java.sql.SQLException - exception raised while closing the statement


Copyright © 2002-2006 null. All Rights Reserved.