All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sf.database.jdbc.rowmapper.ArrayRowMapper Maven / Gradle / Ivy

The newest version!
package sf.database.jdbc.rowmapper;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;


/**
 * 结果集转为数组
 */
public class ArrayRowMapper implements RowMapper {

    @Override
    public Object[] handle(ResultSet rs, ResultSetMetaData rsmd, int rowNum) throws SQLException {
        int cols = rsmd.getColumnCount();
        Object[] result = new Object[cols];

        for (int i = 0; i < cols; i++) {
            result[i] = rs.getObject(i + 1);
        }

        return result;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy