TMS2.0中对DBUtil的改动

1. 改动类:org.apache.commons.dbutils.QueryRunner
    添加方法:
      1.public Object query(Connection conn,String sql,Object[] params,ResultSetHandler rsh,int startPos, int count) throws SQLException
      2.public Object query(String sql, Object param, ResultSetHandler rsh,int startPos,int count) throwsSQLException
      3.public Object query(Connection conn, String sql, ResultSetHandler rsh,int startPos,int count) throwsSQLException
      4.public Object query(String sql, Object[] params, ResultSetHandler rsh,int startPos,int count) throwsSQLException
      以上方法主要用于添加分页支持。  

2. 改动类:org.apache.commons.dbutils.RowProcessor(接口)
    添加方法:
    1.public List toBeanList(ResultSet rs, Class type,int startPos,int count) throws SQLException
    用于支持分页查询操作。

3. 改动类:org.apache.commons.dbutils.BasicRowProcessor
    添加方法:
    1.public List toBeanList(ResultSet rs, Class type, int startPos, int count) throws SQLException
    用于支持分页。
    修改方法:
    1.private Object createBean(ResultSet rs,Class type,PropertyDescriptor[] props,int[] columnToProperty,int cols) throws SQLException 
        修改部分(添加):
        else if(value == null){
        }
        else if (propType == java.sql.Date.class) {
            value = rs.getDate(i);
        }
        else if (propType == java.util.Date.class) {
            value = rs.getDate(i);
        }
        else if (propType == java.sql.Timestamp.class){
            value = rs.getTimestamp(i);
        }
        else if (propType == org.apache.struts.upload.FormFile.class){
            //to do.
        }
        以上用于支持新的类型。

4. 改动类:org.apache.commons.dbutils.ResultSetHandler(接口)
    添加方法:
    1.public Object handle(ResultSet rs,int startPos,int count) throws SQLException
    用于支持分页。

5. 改动类:org.apache.commons.dbutils.handlers.ArrayHandler,
                    org.apache.commons.dbutils.handlers.BeanHandler,
                    org.apache.commons.dbutils.handlers.MapHandler,
                    org.apache.commons.dbutils.handlers.ScalarHandler
    改动:
    1. 添加public Object handle(ResultSet rs,int startPos,int count) throws SQLException方法,
        直接调用public Object handle(ResultSet rs) throws SQLException,忽略后面2个参数。

6. 改动类:org.apache.commons.dbutils.handlers.ArrayListHandler,
                    org.apache.commons.dbutils.handlers.BeanListHandler,
                    org.apache.commons.dbutils.handlers.MapListHandler
    改动:
    1. 添加public Object handle(ResultSet rs,int startPos,int count) throws SQLException方法,
        实现分页查询。祥见每个类对应的方法。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值