|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil
JDBCUtil takes care of some of the more anoying JDBC tasks. It hanles safe closing of jdbc resources, setting statement parameters and loading query results.
Constructor Summary | |
JDBCUtil()
|
Method Summary | |
static Object |
coerceToSQLType(int jdbcType,
Object value)
Coerces the input value into the correct type for the specified jdbcType. |
static byte[] |
convertObjectToByteArray(Object value)
Coverts the value into a byte array. |
static Object |
convertToObject(byte[] input)
Coverts the input into an object. |
static Object |
convertToObject(InputStream input)
Coverts the input into an object. |
static byte[] |
getByteArray(InputStream input)
Read the entire input stream provided and return its content as a byte array. |
static String |
getJDBCTypeName(int jdbcType)
Gets the JDBC type name corresponding to the given type code. |
static String |
getLongString(ResultSet rs,
int index)
Get the indicated result set parameter as a character stream and return it's entire content as a String. |
static Object |
getParameter(org.jboss.logging.Logger log,
CallableStatement cs,
int index,
int jdbcType,
Class destination)
Used for all retrieval of parameters from CallableStatement s. |
static JDBCParameterSetter |
getParameterSetter(int jdbcType,
Class javaType)
|
static JDBCResultSetReader |
getResultReaderByType(Class destination)
|
static JDBCResultSetReader |
getResultSetReader(int jdbcType,
Class destination)
|
static void |
safeClose(Connection con)
|
static void |
safeClose(InputStream in)
|
static void |
safeClose(OutputStream out)
|
static void |
safeClose(Reader reader)
|
static void |
safeClose(ResultSet rs)
|
static void |
safeClose(Statement statement)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JDBCUtil()
Method Detail |
public static void safeClose(Connection con)
public static void safeClose(ResultSet rs)
public static void safeClose(Statement statement)
public static void safeClose(InputStream in)
public static void safeClose(OutputStream out)
public static void safeClose(Reader reader)
public static Object coerceToSQLType(int jdbcType, Object value)
jdbcType
- the jdbc type to which the value will be assignedvalue
- the value to coerce
public static byte[] convertObjectToByteArray(Object value) throws SQLException
value
- the value to convert into a byte array
SQLException
- if a problem occures in the conversionpublic static Object convertToObject(byte[] input) throws SQLException
input
- the bytes to convert
SQLException
- if a problem occures in the conversionpublic static Object convertToObject(InputStream input) throws SQLException
input
- the bytes to convert
SQLException
- if a problem occures in the conversionpublic static String getLongString(ResultSet rs, int index) throws SQLException
rs
- the ResultSet
from which a result is
being retrieved.index
- index of the result column.
SQLException
public static byte[] getByteArray(InputStream input) throws SQLException
input
- the InputStream
from which a result is
being retrieved.
SQLException
public static JDBCResultSetReader getResultSetReader(int jdbcType, Class destination)
public static JDBCResultSetReader getResultReaderByType(Class destination)
public static JDBCParameterSetter getParameterSetter(int jdbcType, Class javaType)
public static String getJDBCTypeName(int jdbcType)
jdbcType
- the integer JDBC type code.
Types
public static Object getParameter(org.jboss.logging.Logger log, CallableStatement cs, int index, int jdbcType, Class destination) throws SQLException
CallableStatement
s.
Implements tracing, and allows some tweaking of returned types.
log
- where to log tocs
- the CallableStatement
from which an out parameter is being retrievedindex
- index of the result column.jdbcType
- a Types
constant used to determine the
most appropriate way to extract the data from rs.destination
- The class of the variable this is going into
SQLException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |