org.objectweb.telosys.dal.sql
Class SqlTool

java.lang.Object
  extended byorg.objectweb.telosys.dal.sql.SqlTool

public final class SqlTool
extends java.lang.Object

Utility class


Constructor Summary
SqlTool()
           
 
Method Summary
static boolean close(java.sql.ResultSet rs)
          Closes the given result set
static java.lang.String connectionStatus(java.sql.Connection con)
          Returns a description about the given connection ( autocomit + isolation level )
static java.sql.ResultSet executeSelect(java.sql.Connection con, java.lang.String sSql, java.lang.Object[] aParameters)
          Execute a SQL "SELECT" with or without parameters and return a ResultSet
static java.lang.Object getColValue(java.sql.ResultSet rs, int iCol, int iColType)
          Returns a column value from a ResultSet ( value can be null )
static int getIsolationLevel(java.lang.String sIsolationLevel, int iDefaultValue)
          Returns the "isolation level" integer value according to the given string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlTool

public SqlTool()
Method Detail

connectionStatus

public static java.lang.String connectionStatus(java.sql.Connection con)
Returns a description about the given connection ( autocomit + isolation level )

Parameters:
con -
Returns:
the description string

getIsolationLevel

public static int getIsolationLevel(java.lang.String sIsolationLevel,
                                    int iDefaultValue)
Returns the "isolation level" integer value according to the given string

Parameters:
sIsolationLevel - e.g. "TRANSACTION_NONE", "TRANSACTION_READ_COMMITTED", etc
iDefaultValue -
Returns:

executeSelect

public static java.sql.ResultSet executeSelect(java.sql.Connection con,
                                               java.lang.String sSql,
                                               java.lang.Object[] aParameters)
                                        throws java.sql.SQLException
Execute a SQL "SELECT" with or without parameters and return a ResultSet

Parameters:
con - the connection to use
sSql - the SQL SELECT
aParameters -
Returns:
Throws:
java.sql.SQLException

close

public static boolean close(java.sql.ResultSet rs)
Closes the given result set

Parameters:
rs - : the ResultSet to close
Returns:

getColValue

public static java.lang.Object getColValue(java.sql.ResultSet rs,
                                           int iCol,
                                           int iColType)
                                    throws java.sql.SQLException
Returns a column value from a ResultSet ( value can be null )

Parameters:
rs -
iCol -
iColType -
Returns:
: the object containing the value ( String, BigDecimal, Boolean, ... )
Throws:
java.sql.SQLException