Example usage for javax.sql.rowset JdbcRowSet getObject

List of usage examples for javax.sql.rowset JdbcRowSet getObject

Introduction

In this page you can find the example usage for javax.sql.rowset JdbcRowSet getObject.

Prototype

Object getObject(int columnIndex) throws SQLException;

Source Link

Document

Gets the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.

Usage

From source file:com.kumarvv.setl.core.Extractor.java

/**
 * parses data row to {@link Row} object
 *
 * @param jrs//ww  w. j ava  2 s  .  c  o  m
 * @param meta
 * @return {@link Row}
 * @throws SQLException
 */
Row parseDataRow(JdbcRowSet jrs, ResultSetMetaData meta) throws SQLException {
    if (jrs == null || meta == null) {
        return null;
    }

    int colCount = meta.getColumnCount();

    Map<String, Object> row = new HashMap<>();
    for (int c = 1; c <= colCount; c++) {
        row.put(meta.getColumnName(c).toLowerCase(), jrs.getObject(c));
    }

    Row ro = new Row(fromColumns, row);
    addToQueue(ro);
    return ro;
}

From source file:com.kumarvv.setl.core.Loader.java

/**
 * process and store return values from previous load
 *
 * @param load// w  w  w. j  a va 2s .c o  m
 * @param row
 * @param jrs
 * @return
 */
protected boolean processReturns(Load load, Row row, JdbcRowSet jrs) {
    if (load == null || row == null || jrs == null) {
        return false;
    }

    if (CollectionUtils.isEmpty(load.getReturns())) {
        return true;
    }

    for (String rc : load.getReturns()) {
        try {
            Object rcv = jrs.getObject(rc);
            row.getData().put("rc_" + load.getTable() + "_" + rc, rcv);
        } catch (SQLException sqle) {
            Logger.warn("return value error: " + sqle.getMessage());
            Logger.trace(sqle);
        }
    }
    return true;
}