Package org.apache.commons.dbutils

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


        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";
            Bill jsonBill = (Bill)storage.get("2013/bill/"+billNo, Bill.class);
View Full Code Here


        logger.info("Bills checked, writing observations to db...");

        for (ReportObservation observation : observations) {
            //logger.info("inserting observation  "+observation.getOid() + " " + observation.getField() + " " + observation.getActualValue() + " " + observation.getObservedValue());
            runner.update(
                    "INSERT INTO report_observation (reportId, oid, field, actualValue, observedValue) VALUES (?, ?, ?, ?, ?)",
                    observation.getReportId(),
                    observation.getOid(),
                    observation.getField(),
                    observation.getActualValue(),
View Full Code Here

    {
        // Insert changes into database.
        DataSource datasource = Application.getDB().getDataSource();
        QueryRunner run = new QueryRunner(datasource);
        try {
            run.update("BEGIN");
            for(Entry<String, Change> entry: entries) {
                Change change = entry.getValue();
                run.update("INSERT INTO changelog (otype, oid, time, status) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE oid = ?",
                        change.getOtype(), change.getOid(), change.getTime(), change.getStatus().name(), change.getOid());
            }
View Full Code Here

        QueryRunner run = new QueryRunner(datasource);
        try {
            run.update("BEGIN");
            for(Entry<String, Change> entry: entries) {
                Change change = entry.getValue();
                run.update("INSERT INTO changelog (otype, oid, time, status) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE oid = ?",
                        change.getOtype(), change.getOid(), change.getTime(), change.getStatus().name(), change.getOid());
            }
            run.update("COMMIT");
        }
        catch (SQLException e) {
View Full Code Here

            for(Entry<String, Change> entry: entries) {
                Change change = entry.getValue();
                run.update("INSERT INTO changelog (otype, oid, time, status) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE oid = ?",
                        change.getOtype(), change.getOid(), change.getTime(), change.getStatus().name(), change.getOid());
            }
            run.update("COMMIT");
        }
        catch (SQLException e) {
            e.printStackTrace();
            return false;
        }
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.