当前位置: 首页>>代码示例>>Java>>正文


Java BasicRowProcessor类代码示例

本文整理汇总了Java中org.apache.commons.dbutils.BasicRowProcessor的典型用法代码示例。如果您正苦于以下问题:Java BasicRowProcessor类的具体用法?Java BasicRowProcessor怎么用?Java BasicRowProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicRowProcessor类属于org.apache.commons.dbutils包,在下文中一共展示了BasicRowProcessor类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateProperDbUtilsVersion

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
private void validateProperDbUtilsVersion() {
    Package dbutilsPackage = BasicRowProcessor.class.getPackage();
    String dbutilsVersion = dbutilsPackage.getSpecificationVersion();

    if (dbutilsVersion == null) {
        return;  // in case the jar is shaded, this information may not be available; hence, we are forced to return
    }
    String[] versionParts = dbutilsVersion.split("\\.");
    if (versionParts.length < 2) {
        throw new IllegalArgumentException("Improper dbutils version; must have at least two parts x.y; " + dbutilsVersion);
    }

    int majorVersion = Integer.valueOf(versionParts[0]).intValue();
    int minorVersion = Integer.valueOf(versionParts[1]).intValue();

    if (!(majorVersion >= 1 && minorVersion >= 6)) {
        throw new IllegalArgumentException("commons-dbutils:commons-dbutils version must be >= 1.6 to avoid bugs w/ JDBC getColumnName() usage in <= 1.5");
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:DbInputReader.java

示例2: queryEntity

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
@Override
public <T> T queryEntity(Class<T> entityClass, String sql, Object... params) {
    T result;
    try {
        Map<String, String> columnMap = EntityHelper.getColumnMap(entityClass);
        if (MapUtils.isNotEmpty(columnMap)) {
            result = queryRunner.query(sql, new BeanHandler<T>(entityClass, new BasicRowProcessor(new BeanProcessor(columnMap))), params);
        } else {
            result = queryRunner.query(sql, new BeanHandler<T>(entityClass), params);
        }
    } catch (SQLException e) {
        logger.error("查询出错!", e);
        throw new RuntimeException(e);
    }
    printSQL(sql);
    return result;
}
 
开发者ID:xuerong,项目名称:MMServerEngine,代码行数:18,代码来源:DefaultDataAccessor.java

示例3: queryEntityList

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
@Override
public <T> List<T> queryEntityList(Class<T> entityClass, String sql, Object... params) {
    List<T> result;
    try {
        Map<String, String> columnMap = EntityHelper.getColumnMap(entityClass);
        if (MapUtils.isNotEmpty(columnMap)) {
            result = queryRunner.query(sql, new BeanListHandler<T>(entityClass, new BasicRowProcessor(new BeanProcessor(columnMap))), params);
        } else {
            result = queryRunner.query(sql, new BeanListHandler<T>(entityClass), params);
        }
    } catch (SQLException e) {
        logger.error("查询出错!", e);
        throw new RuntimeException(e);
    }
    printSQL(sql);
    return result;
}
 
开发者ID:xuerong,项目名称:MMServerEngine,代码行数:18,代码来源:DefaultDataAccessor.java

示例4: queryEntity

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
@Override
public <T> T queryEntity(Class<T> entityClass, String sql, Object... params) {
    T result;
    try {
        Map<String, String> columnMap = EntityHelper.getColumnMap(entityClass);
        if (MapUtil.isNotEmpty(columnMap)) {
            result = queryRunner.query(sql, new BeanHandler<>(entityClass, new BasicRowProcessor(new BeanProcessor(columnMap))), params);
        } else {
            result = queryRunner.query(sql, new BeanHandler<>(entityClass), params);
        }
    } catch (SQLException e) {
        logger.error("查询出错!", e);
        throw new RuntimeException(e);
    }
    printSQL(sql);
    return result;
}
 
开发者ID:wsldl123292,项目名称:testeverything,代码行数:18,代码来源:DefaultDataAccessor.java

示例5: queryEntityList

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
@Override
public <T> List<T> queryEntityList(Class<T> entityClass, String sql, Object... params) {
    List<T> result;
    try {
        Map<String, String> columnMap = EntityHelper.getColumnMap(entityClass);
        if (MapUtil.isNotEmpty(columnMap)) {
            result = queryRunner.query(sql, new BeanListHandler<T>(entityClass, new BasicRowProcessor(new BeanProcessor(columnMap))), params);
        } else {
            result = queryRunner.query(sql, new BeanListHandler<T>(entityClass), params);
        }
    } catch (SQLException e) {
        logger.error("查询出错!", e);
        throw new RuntimeException(e);
    }
    printSQL(sql);
    return result;
}
 
开发者ID:wsldl123292,项目名称:testeverything,代码行数:18,代码来源:DefaultDataAccessor.java

示例6: queryBean

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
public static <T> T queryBean(QueryRunner runner, Class<T> cls, Map<String, String> map, String sql, Object... params) {
    T result;
    try {
        if (MapUtil.isNotEmpty(map)) {
            result = runner.query(sql, new BeanHandler<T>(cls, new BasicRowProcessor(new BeanProcessor(map))), params);
        } else {
            result = runner.query(sql, new BeanHandler<T>(cls), params);
        }
        printSQL(sql);
    } catch (SQLException e) {
        logger.error("查询出错!", e);
        throw new RuntimeException(e);
    }
    return result;
}
 
开发者ID:thinkhoon,项目名称:tkhoon,代码行数:16,代码来源:DBUtil.java

示例7: queryBeanList

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
public static <T> List<T> queryBeanList(QueryRunner runner, Class<T> cls, Map<String, String> map, String sql, Object... params) {
    List<T> result;
    try {
        if (MapUtil.isNotEmpty(map)) {
            result = runner.query(sql, new BeanListHandler<T>(cls, new BasicRowProcessor(new BeanProcessor(map))), params);
        } else {
            result = runner.query(sql, new BeanListHandler<T>(cls), params);
        }
        printSQL(sql);
    } catch (SQLException e) {
        logger.error("查询出错!", e);
        throw new RuntimeException(e);
    }
    return result;
}
 
开发者ID:thinkhoon,项目名称:tkhoon,代码行数:16,代码来源:DBUtil.java

示例8: getRowProcessor

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
public static synchronized RowProcessor getRowProcessor(Class<?> modelCls, ModelMeta modelMeta) {
    if(ROW_PROCESSOR_MAP.containsKey(modelCls)) {
        return ROW_PROCESSOR_MAP.get(modelCls);
    }
    RowProcessor rowProcessor = new BasicRowProcessor(new JdbcOrmBeanProcessor(modelCls, modelMeta));
    ROW_PROCESSOR_MAP.put(modelCls, rowProcessor);
    return rowProcessor;
}
 
开发者ID:zoowii,项目名称:jpa-utils,代码行数:9,代码来源:JdbcOrmBeanHandler.java

示例9: resultSetToMaps

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
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));
        }

        return results;
    }
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:12,代码来源:TestUtils.java

示例10: resultSetToArrays

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
public static List<Object[]> resultSetToArrays(ResultSet rs) throws SQLException {
    List<Object[]> results =new ArrayList<>();
    BasicRowProcessor brp = new BasicRowProcessor();

    while (rs.next()){
        results.add(brp.toArray(rs));
    }

    return results;
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:11,代码来源:TestUtils.java

示例11: netProcessor

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
public static RowProcessor netProcessor(Object... netConfig) {
	getCurrentExplainers().add(new EntityNetSqlExplainer(netConfig));
	return new BasicRowProcessor();
}
 
开发者ID:drinkjava2,项目名称:jSqlBox,代码行数:5,代码来源:SqlBoxContext.java

示例12: ResultSetIterator

import org.apache.commons.dbutils.BasicRowProcessor; //导入依赖的package包/类
/**
 * Constructor for ResultSetIterator.
 * @param rs Wrap this <code>ResultSet</code> in an <code>Iterator</code>.
 */
public ResultSetIterator(ResultSet rs) {
    this(rs , new BasicRowProcessor());
}
 
开发者ID:NCAR,项目名称:dls-repository-stack,代码行数:8,代码来源:ResultSetIterator.java


注:本文中的org.apache.commons.dbutils.BasicRowProcessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。