Example usage for java.sql ResultSet getStatement

List of usage examples for java.sql ResultSet getStatement

Introduction

In this page you can find the example usage for java.sql ResultSet getStatement.

Prototype

Statement getStatement() throws SQLException;

Source Link

Document

Retrieves the Statement object that produced this ResultSet object.

Usage

From source file:org.springframework.jdbc.support.lob.OracleLobHandler.java

@Override
public byte[] getBlobAsBytes(ResultSet rs, int columnIndex) throws SQLException {
    logger.debug("Returning Oracle BLOB as bytes");
    Blob blob = rs.getBlob(columnIndex);
    initializeResourcesBeforeRead(rs.getStatement().getConnection(), blob);
    byte[] retVal = (blob != null ? blob.getBytes(1, (int) blob.length()) : null);
    releaseResourcesAfterRead(rs.getStatement().getConnection(), blob);
    return retVal;
}

From source file:org.springframework.jdbc.support.lob.OracleLobHandler.java

@Override
public InputStream getBlobAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException {
    logger.debug("Returning Oracle BLOB as binary stream");
    Blob blob = rs.getBlob(columnIndex);
    initializeResourcesBeforeRead(rs.getStatement().getConnection(), blob);
    InputStream retVal = (blob != null ? blob.getBinaryStream() : null);
    releaseResourcesAfterRead(rs.getStatement().getConnection(), blob);
    return retVal;
}

From source file:org.springframework.jdbc.support.lob.OracleLobHandler.java

@Override
public String getClobAsString(ResultSet rs, int columnIndex) throws SQLException {
    logger.debug("Returning Oracle CLOB as string");
    Clob clob = rs.getClob(columnIndex);
    initializeResourcesBeforeRead(rs.getStatement().getConnection(), clob);
    String retVal = (clob != null ? clob.getSubString(1, (int) clob.length()) : null);
    releaseResourcesAfterRead(rs.getStatement().getConnection(), clob);
    return retVal;
}

From source file:org.springframework.jdbc.support.lob.OracleLobHandler.java

@Override
public InputStream getClobAsAsciiStream(ResultSet rs, int columnIndex) throws SQLException {
    logger.debug("Returning Oracle CLOB as ASCII stream");
    Clob clob = rs.getClob(columnIndex);
    initializeResourcesBeforeRead(rs.getStatement().getConnection(), clob);
    InputStream retVal = (clob != null ? clob.getAsciiStream() : null);
    releaseResourcesAfterRead(rs.getStatement().getConnection(), clob);
    return retVal;
}

From source file:org.springframework.jdbc.support.lob.OracleLobHandler.java

@Override
public Reader getClobAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException {
    logger.debug("Returning Oracle CLOB as character stream");
    Clob clob = rs.getClob(columnIndex);
    initializeResourcesBeforeRead(rs.getStatement().getConnection(), clob);
    Reader retVal = (clob != null ? clob.getCharacterStream() : null);
    releaseResourcesAfterRead(rs.getStatement().getConnection(), clob);
    return retVal;
}

From source file:org.xsystem.sql2.dml.DmlCommand.java

Map<String, Object> rowAsMap(ResultSet rs) throws SQLException {
    Map row = new LinkedHashMap();

    Connection con = rs.getStatement().getConnection();
    AbstactNativeHelper nativeHelper = nativeHelperFactory(con);
    ResultSetMetaData metaData = rs.getMetaData();
    int cnt = metaData.getColumnCount();
    for (int i = 1; i <= cnt; i++) {
        String cn = metaData.getColumnName(i);
        int jdbcType = metaData.getColumnType(i);
        String colTypeName = metaData.getColumnTypeName(i);
        Object value = rs.getObject(i);
        if (rs.wasNull()) {
            value = null;//from  ww w. j a  va 2 s  .  com
        }
        if (upperTag != null) {
            if (upperTag) {
                cn = cn.toUpperCase();
            } else {
                cn = cn.toLowerCase();
            }
        }
        value = getValue(value, jdbcType, colTypeName, con, nativeHelper);
        row.put(cn, value);
    }

    return row;
}