Java Code Examples for org.springframework.jdbc.support.rowset.SqlRowSet#getObject()

The following examples show how to use org.springframework.jdbc.support.rowset.SqlRowSet#getObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BatchDao.java    From appstatus with Apache License 2.0 6 votes vote down vote up
/**
 * Read batch object from result set.
 * 
 * @param srs
 * @return
 * @throws IOException
 * @throws SQLException
 */
private BdBatch mappinpBdbatch(SqlRowSet srs) throws SQLException,
		IOException {
	BdBatch bdBatch = new BdBatch();
	bdBatch.setUuid(srs.getString("UUID_BATCH"));
	bdBatch.setCurrentItem(srs.getString("ITEM"));
	bdBatch.setEndDate(srs.getDate("END_DATE"));
	bdBatch.setGroup(srs.getString("GROUP_BATCH"));
	bdBatch.setItemCount(srs.getLong("ITEMCOUNT"));
	bdBatch.setLastMessage(srs.getString("LAST_MSG"));
	bdBatch.setLastUpdate(srs.getDate("UPDATED"));
	bdBatch.setName(srs.getString("NAME_BATCH"));
	bdBatch.setProgress(srs.getFloat("PROGRESS"));
	bdBatch.setStartDate(srs.getDate("START_DATE"));
	bdBatch.setStatus(srs.getString("STATUS"));
	bdBatch.setSuccess(srs.getBoolean("SUCCESS"));

	// Clob
	Clob reject = (Clob) srs.getObject("REJECT");
	bdBatch.setReject(clobToString(reject));

	return bdBatch;
}
 
Example 2
Source File: CmsDataBackDaoImpl.java    From Lottery with GNU General Public License v2.0 5 votes vote down vote up
public List<Object[]> createTableData(String tablename) {
	int filedNum = getTableFieldNums(tablename);
	List<Object[]> results = new ArrayList<Object[]>();
	String sql = " select * from   " + tablename;
	SqlRowSet set = getJdbcTemplate().queryForRowSet(sql);
	while (set.next()) {
		Object[] oneResult = new Object[filedNum];
		for (int i = 1; i <= filedNum; i++) {
			oneResult[i - 1] = set.getObject(i);
		}
		results.add(oneResult);
	}
	return results;
}
 
Example 3
Source File: JdbcEventAnalyticsManager.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
@Override
public Rectangle getRectangle( EventQueryParams params )
{
    String clusterField = params.getCoordinateField();
    String quotedClusterField = quoteAlias( clusterField );

    String sql = "select count(psi) as " + COL_COUNT + ", ST_Extent(" + quotedClusterField + ") as " + COL_EXTENT + " ";

    sql += getFromClause( params );

    sql += getWhereClause( params );

    log.debug( String.format( "Analytics event count and extent SQL: %s", sql ) );

    Rectangle rectangle = new Rectangle();

    SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );

    if ( rowSet.next() )
    {
        Object extent = rowSet.getObject( COL_EXTENT );

        rectangle.setCount( rowSet.getLong( COL_COUNT ) );
        rectangle.setExtent( extent != null ? String.valueOf( rowSet.getObject( COL_EXTENT ) ) : null );
    }

    return rectangle;
}