|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 java.lang.Object |
coerceToSQLType(int jdbcType,
java.lang.Object value)
Coerces the input value into the correct type for the specified jdbcType. |
static byte[] |
convertObjectToByteArray(java.lang.Object value)
Coverts the value into a byte array. |
static java.lang.Object |
convertToObject(byte[] input)
Coverts the input into an object. |
static java.lang.Object |
convertToObject(java.io.InputStream input)
Coverts the input into an object. |
static byte[] |
getByteArray(java.io.InputStream input)
Read the entire input stream provided and return its content as a byte array. |
static java.lang.String |
getJDBCTypeName(int jdbcType)
Gets the JDBC type name corresponding to the given type code. |
static java.lang.String |
getLongString(java.sql.ResultSet rs,
int index)
Get the indicated result set parameter as a character stream and return it's entire content as a String. |
static java.lang.Object |
getParameter(Logger (src) log,
java.sql.CallableStatement cs,
int index,
int jdbcType,
java.lang.Class destination)
Used for all retrieval of parameters from CallableStatement s. |
static JDBCParameterSetter (src) |
getParameterSetter(int jdbcType,
java.lang.Class javaType)
|
static JDBCResultSetReader (src) |
getResultReaderByType(java.lang.Class destination)
|
static JDBCResultSetReader (src) |
getResultSetReader(int jdbcType,
java.lang.Class destination)
|
static void |
safeClose(java.sql.Connection con)
|
static void |
safeClose(java.io.InputStream in)
|
static void |
safeClose(java.io.OutputStream out)
|
static void |
safeClose(java.io.Reader reader)
|
static void |
safeClose(java.sql.ResultSet rs)
|
static void |
safeClose(java.sql.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(java.sql.Connection con)
public static void safeClose(java.sql.ResultSet rs)
public static void safeClose(java.sql.Statement statement)
public static void safeClose(java.io.InputStream in)
public static void safeClose(java.io.OutputStream out)
public static void safeClose(java.io.Reader reader)
public static java.lang.Object coerceToSQLType(int jdbcType, java.lang.Object value)
jdbcType
- the jdbc type to which the value will be assignedvalue
- the value to coerce
public static byte[] convertObjectToByteArray(java.lang.Object value) throws java.sql.SQLException
value
- the value to convert into a byte array
java.sql.SQLException
- if a problem occures in the conversionpublic static java.lang.Object convertToObject(byte[] input) throws java.sql.SQLException
input
- the bytes to convert
java.sql.SQLException
- if a problem occures in the conversionpublic static java.lang.Object convertToObject(java.io.InputStream input) throws java.sql.SQLException
input
- the bytes to convert
java.sql.SQLException
- if a problem occures in the conversionpublic static java.lang.String getLongString(java.sql.ResultSet rs, int index) throws java.sql.SQLException
rs
- the ResultSet
from which a result is
being retrieved.index
- index of the result column.
java.sql.SQLException
public static byte[] getByteArray(java.io.InputStream input) throws java.sql.SQLException
input
- the InputStream
from which a result is
being retrieved.
java.sql.SQLException
public static JDBCResultSetReader (src) getResultSetReader(int jdbcType, java.lang.Class destination)
public static JDBCResultSetReader (src) getResultReaderByType(java.lang.Class destination)
public static JDBCParameterSetter (src) getParameterSetter(int jdbcType, java.lang.Class javaType)
public static java.lang.String getJDBCTypeName(int jdbcType)
jdbcType
- the integer JDBC type code.
Types
public static java.lang.Object getParameter(Logger (src) log, java.sql.CallableStatement cs, int index, int jdbcType, java.lang.Class destination) throws java.sql.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
java.sql.SQLException
|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |