|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectnet.hasor.jdbc.core.util.JdbcUtils
public class JdbcUtils
| 字段摘要 | |
|---|---|
static int |
TYPE_UNKNOWN
|
| 构造方法摘要 | |
|---|---|
JdbcUtils()
|
|
| 方法摘要 | |
|---|---|
static void |
closeConnection(Connection con)
Close the given JDBC Connection and ignore any thrown exception. |
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 Object |
getResultSetValue(ResultSet rs,
int index,
Class requiredType)
Retrieve a JDBC column value from a ResultSet, using the specified value type. |
static String |
lookupColumnName(ResultSetMetaData resultSetMetaData,
int columnIndex)
Determine the column name to use. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
public static final int TYPE_UNKNOWN
| 构造方法详细信息 |
|---|
public JdbcUtils()
| 方法详细信息 |
|---|
public static String lookupColumnName(ResultSetMetaData resultSetMetaData,
int columnIndex)
throws SQLException
This method implementation takes into account recent clarifications expressed in the JDBC 4.0 specification:
columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column.
resultSetMetaData - the current meta data to usecolumnIndex - the index of the column for the look up
SQLException - in case of lookup failure
public static Object getResultSetValue(ResultSet rs,
int index,
Class requiredType)
throws SQLException
Uses the specifically typed ResultSet accessor methods, falling back to
getResultSetValue(java.sql.ResultSet, int) for unknown types.
Note that the returned value may not be assignable to the specified required type, in case of an unknown type. Calling code needs to deal with this case appropriately, e.g. throwing a corresponding exception.
rs - is the ResultSet holding the dataindex - is the column indexrequiredType - the required value type (may be null)
SQLException - if thrown by the JDBC API
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,
Timestamppublic static void closeConnection(Connection con)
con - the JDBC Connection to close (may be null)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)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||