Example usage for org.apache.commons.dbutils BasicRowProcessor toMap

List of usage examples for org.apache.commons.dbutils BasicRowProcessor toMap

Introduction

In this page you can find the example usage for org.apache.commons.dbutils BasicRowProcessor toMap.

Prototype

@Override
public Map<String, Object> toMap(ResultSet rs) throws SQLException 

Source Link

Document

Convert a ResultSet row into a Map.

Usage

From source file:com.splicemachine.homeless.TestUtils.java

public static List<Map> resultSetToMaps(ResultSet rs) throws SQLException {

    List<Map> results = new ArrayList<>();
    BasicRowProcessor brp = new BasicRowProcessor();

    while (rs.next()) {
        results.add(brp.toMap(rs));
    }/*www.j  av  a2s  . c  o  m*/

    return results;
}

From source file:com.mirth.connect.connectors.jdbc.DatabaseReceiver.java

/**
 * For each record in the given ResultSet, convert it to XML and dispatch it as a raw message to
 * the channel. Then run the post-process if applicable.
 *//*from ww  w .j a  v  a 2  s .  co  m*/
@SuppressWarnings("unchecked")
private void processResultSet(ResultSet resultSet)
        throws SQLException, InterruptedException, DatabaseReceiverException {
    BasicRowProcessor basicRowProcessor = new BasicRowProcessor();

    // loop through the ResultSet rows and convert them into hash maps for processing
    while (resultSet.next()) {
        if (isTerminated()) {
            return;
        }

        processRecord((Map<String, Object>) basicRowProcessor.toMap(resultSet));
    }
}