OracleLobHandler.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:lams 作者:
@Override
public void setClobAsAsciiStream(
        PreparedStatement ps, int paramIndex, final InputStream asciiStream, int contentLength)
    throws SQLException {

    if (asciiStream != null) {
        Clob clob = (Clob) createLob(ps, true, new LobCallback() {
            @Override
            public void populateLob(Object lob) throws Exception {
                Method methodToInvoke = lob.getClass().getMethod("getAsciiOutputStream", (Class[]) null);
                OutputStream out = (OutputStream) methodToInvoke.invoke(lob, (Object[]) null);
                FileCopyUtils.copy(asciiStream, out);
            }
        });
        ps.setClob(paramIndex, clob);
        if (logger.isDebugEnabled()) {
            logger.debug("Set ASCII stream for Oracle CLOB with length " + clob.length());
        }
    }
    else {
        ps.setClob(paramIndex, (Clob) null);
        logger.debug("Set Oracle CLOB to null");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号