本文整理汇总了Java中java.sql.CallableStatement.getBlob方法的典型用法代码示例。如果您正苦于以下问题:Java CallableStatement.getBlob方法的具体用法?Java CallableStatement.getBlob怎么用?Java CallableStatement.getBlob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.CallableStatement
的用法示例。
在下文中一共展示了CallableStatement.getBlob方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNullableResult
import java.sql.CallableStatement; //导入方法依赖的package包/类
@Override
public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
Blob blob = cs.getBlob(columnIndex);
byte[] returnValue = null;
if (null != blob) {
returnValue = blob.getBytes(1, (int) blob.length());
}
try {
return new String(returnValue, DEFAULT_CHARSET);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Blob Encoding Error!");
}
}
示例2: getNullableResult
import java.sql.CallableStatement; //导入方法依赖的package包/类
@Override
public byte[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
Blob blob = cs.getBlob(columnIndex);
byte[] returnValue = null;
if (null != blob) {
returnValue = blob.getBytes(1, (int) blob.length());
}
return returnValue;
}
示例3: getAppObject
import java.sql.CallableStatement; //导入方法依赖的package包/类
/** Gets a parameter from the CallableStatement.
* @return the parameter.
* @param engineType The engine type as defined in init.xml
* @param cstmt The CallableStatement.
* @param parameterIndex The index of the parameter.
* @throws SQLException if a database access error occurs.
* @throws IOException if any error occurs in reading the data from the database.
*/
public Object getAppObject(CallableStatement cstmt, int parameterIndex, String engineType) throws SQLException, IOException {
Blob blob = cstmt.getBlob(parameterIndex);
if (blob != null)
return blob.getBytes(1, (int) blob.length());
else
return null;
}