Package org.apache.commons.dbutils

Examples of org.apache.commons.dbutils.QueryRunner.query()


            blogContent = (List) qr.query(blogSql, new BeanListHandler(Blog.class));
            blog = (Blog) blogContent.get(0);

            blogList = (List) qr.query(blogListSql, new BeanListHandler(
                    Blog.class));
            commentList = (List) qr.query(commentSql, new BeanListHandler(
                    Comment.class));
            commentsList = (List) qr.query(commentsSql, new BeanListHandler(
                    Comment.class));
            categoryList = (List) qr.query(categorySql, new BeanListHandler(
                    Category.class));
View Full Code Here


            blogList = (List) qr.query(blogListSql, new BeanListHandler(
                    Blog.class));
            commentList = (List) qr.query(commentSql, new BeanListHandler(
                    Comment.class));
            commentsList = (List) qr.query(commentsSql, new BeanListHandler(
                    Comment.class));
            categoryList = (List) qr.query(categorySql, new BeanListHandler(
                    Category.class));
        } catch (SQLException e) {
            e.printStackTrace();
View Full Code Here

                    Blog.class));
            commentList = (List) qr.query(commentSql, new BeanListHandler(
                    Comment.class));
            commentsList = (List) qr.query(commentsSql, new BeanListHandler(
                    Comment.class));
            categoryList = (List) qr.query(categorySql, new BeanListHandler(
                    Category.class));
        } catch (SQLException e) {
            e.printStackTrace();
        }
View Full Code Here

    String sql = "select category_id as id,category_name as name,category_level as level from category where category_id="
        + id;
    QueryRunner qr = DbHelper.getQueryRunner();
    Category category = null;
    try {
      List list = (List) qr.query(sql,
          new BeanListHandler(Category.class));
      category = (Category) list.get(0);
    } catch (SQLException e) {
      e.printStackTrace();
    }
View Full Code Here

    String sql = "select category_id as id,category_name as name,category_level as level from category order by category_level desc, category_id desc";
    QueryRunner qr = DbHelper.getQueryRunner();
    List list = null;
    try {
      list = (List) qr.query(sql, new BeanListHandler(Category.class));
    } catch (SQLException e) {

      e.printStackTrace();
    }
    request.setAttribute("list", list);
View Full Code Here

     
    @Override
    public DbRowsImpl query(String query, Object... params) throws JuDbException {
      try {
        QueryRunner qr = new QueryRunner();
        return qr.query(this.getConnection(), query, new DbRowResultSetHandler(), this.processParams(params));
      } catch (SQLException ex) {
        throw new JuDbException("Couldn't execute query: " + query, ex);
      }
    }
View Full Code Here

        QueryRunner runner = new QueryRunner();
        Connection conn = Application.getDB().getDataSource().getConnection();

        runner.update(conn, "UPDATE report_observation SET errorId = NULL WHERE 1=1");
        runner.update(conn, "DELETE FROM report_error WHERE 1=1");
        Collection<Report> reports = runner.query(conn, "SELECT * FROM report order by time ASC", reportHandler);
        for (Report report : reports) {
            logger.info("Generating errors for report: "+report);
            Collection<ReportError> oldOpenErrors = runner.query(conn, "SELECT * FROM report_error WHERE closedAt IS NULL" , reportErrorHandler);

            Collection<ReportObservation> observations = runner.query(conn, "SELECT * FROM report_observation WHERE reportId = ?", reportObservationHandler, report.getId());
View Full Code Here

        runner.update(conn, "UPDATE report_observation SET errorId = NULL WHERE 1=1");
        runner.update(conn, "DELETE FROM report_error WHERE 1=1");
        Collection<Report> reports = runner.query(conn, "SELECT * FROM report order by time ASC", reportHandler);
        for (Report report : reports) {
            logger.info("Generating errors for report: "+report);
            Collection<ReportError> oldOpenErrors = runner.query(conn, "SELECT * FROM report_error WHERE closedAt IS NULL" , reportErrorHandler);

            Collection<ReportObservation> observations = runner.query(conn, "SELECT * FROM report_observation WHERE reportId = ?", reportObservationHandler, report.getId());
            for (ReportObservation observation : observations) {
                boolean matched = false;
                for(ReportError error : oldOpenErrors) {
View Full Code Here

        Collection<Report> reports = runner.query(conn, "SELECT * FROM report order by time ASC", reportHandler);
        for (Report report : reports) {
            logger.info("Generating errors for report: "+report);
            Collection<ReportError> oldOpenErrors = runner.query(conn, "SELECT * FROM report_error WHERE closedAt IS NULL" , reportErrorHandler);

            Collection<ReportObservation> observations = runner.query(conn, "SELECT * FROM report_observation WHERE reportId = ?", reportObservationHandler, report.getId());
            for (ReportObservation observation : observations) {
                boolean matched = false;
                for(ReportError error : oldOpenErrors) {
                    if (error.getOid().equals(observation.getOid()) && error.getField().equals(observation.getField())) {
                        // A matched error is still open so remove it from the "old" list
View Full Code Here

        loadPageFile(new File(directory, prefix+".page_file.txt"), bills);

        SpotCheckBill testbill = bills.get("S1743A");

        runner.update("insert ignore into report(time) values(?)", date);
        Report report = runner.query("select * from report where time = ?", new BeanHandler<Report>(Report.class), date);
        runner.update("delete from report_observation where reportId = ?", report.getId());

        for(String id : bills.keySet()) {
            //logger.info("checking bill "+id);
            String billNo = id+"-2013";
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.