zoukankan      html  css  js  c++  java
  • JDBC -- DBUtils

    DBUtils framework:

      Constructor:

        QueryRunner(); 

        QueryRunner(DataSource dataSource);

      Method:

        batch:

          batch(Connection conn, String sql, Object[][] params);  ----->  when you use the default constructor

          batch(String sql, Object[][] params);  ----->  high dimensionality: the amount of statement low dimensionality: the parameter each statement needs

        query:

          <T> T query(String sql, ResultSetHandler<T> rsh, Object... params);

          <T> T query(Connection conn, String sql, ResultSetHandler<T> rsh, Object... params);

        update:

          update(String sql, Object... parmas);

          update(Connection conn, String sql, Object... params);

        When you want to call the update method for several times, pleas use update(Connection conn, String sql, Object... parmas), and the default constructor is needed.

    ResultSetHandler of DBUtils:

      ArrayHandler: used when the result set has only one result in the set, the return value is Object[], the records in the list is the data of every column.

      ArrayListHandler: used when the result set has many results in the set, the return value is List<Object[]> , the records are encapsulated in the List, every Object[] represents one row of data.

      BeanHandler: return one JavaBean record 

      BeanListHandler: return a List of JavaBean record

      ColumnListHandler: used when want to query one column, the return value is List<Object>, the value in the List is the column's values.

      KeyedHandler: used when the result set has many records, the return value is Map<Object,Map<String,Object>>

      MapHandler: used when the result set has only one record, the return value is Map<String,Object>, key is the filed name, value is the filed value.

      MapListHandler: ... the return value is List<Map<String,Object>>

      ScalarHandler: used when the result has only one row and one column, the return value is Object

  • 相关阅读:
    第15.26节 PyQt(Python+Qt)入门学习:Model/View架构中的便利类QListWidget详解
    第二十一章、 Model/View便利类列表部件QListWidget详解
    PyQt(Python+Qt)学习随笔:QListWidget的信号简介
    iis日志存放位置 及 查看方法
    如何查看和分析IIS日志
    IIS网站设置禁止IP访问设置方法
    修改php默认的FastCGI模式为ISAPI模式的方法
    VPS/云主机CPU占用100%故障排查
    APACHE服务器httpd.exe进程占用cpu100%的解决方法
    httpd.exe占用100%CPU
  • 原文地址:https://www.cnblogs.com/ppcoder/p/7491992.html
Copyright © 2011-2022 走看看