|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectliquibase.util.JdbcUtils
public abstract class JdbcUtils
Field Summary | |
---|---|
static int |
TYPE_UNKNOWN
Constant that indicates an unknown (or unspecified) SQL type. |
Constructor Summary | |
---|---|
JdbcUtils()
|
Method Summary | |
---|---|
static void |
close(ResultSet rs,
Statement stmt)
|
static void |
closeResultSet(ResultSet rs)
Close the given JDBC ResultSet and ignore any thrown exception. |
static void |
closeStatement(Statement stmt)
Close the given JDBC Statement and ignore any thrown exception. |
static Object |
getResultSetValue(ResultSet rs,
int index)
Retrieve a JDBC column value from a ResultSet, using the most appropriate value type. |
static String |
getValueForColumn(ResultSet rs,
String columnNameToCheck,
Database database)
Checks whether a result set has a column matching the specified column name. |
static boolean |
isNumeric(int sqlType)
Check whether the given SQL type is numeric. |
static Object |
requiredSingleResult(Collection results)
Return a single result object from the given Collection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_UNKNOWN
Types
,
Constant Field ValuesConstructor Detail |
---|
public JdbcUtils()
Method Detail |
---|
public static void closeStatement(Statement stmt)
stmt
- the JDBC Statement to close (may be null
)public static void closeResultSet(ResultSet rs)
rs
- the JDBC ResultSet to close (may be null
)public static void close(ResultSet rs, Statement stmt)
public static Object getResultSetValue(ResultSet rs, int index) throws SQLException
Uses the getObject(index)
method, but includes additional "hacks"
to get around Oracle 10g returning a non-standard object for its TIMESTAMP
datatype and a java.sql.Date
for DATE columns leaving out the
time portion: These columns will explicitly be extracted as standard
java.sql.Timestamp
object.
rs
- is the ResultSet holding the dataindex
- is the column index
SQLException
- if thrown by the JDBC APIBlob
,
Clob
,
Timestamp
public static boolean isNumeric(int sqlType)
sqlType
- the SQL type to be checked
public static Object requiredSingleResult(Collection results) throws DatabaseException
Throws an exception if 0 or more than 1 element found.
results
- the result Collection (can be null
)
DatabaseException
public static String getValueForColumn(ResultSet rs, String columnNameToCheck, Database database) throws SQLException
rs
- result set to checkcolumnNameToCheck
- column name to check
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |