Package java.sql

Examples of java.sql.PreparedStatement.clearBatch()


            // first create a new entry in the rules table
            PreparedStatement insertRule = getPreparedStatement("rules.insert");
            PreparedStatement addProgramRule = getPreparedStatement("programs.add_rule");
            synchronized (insertRule) {
                insertRule.clearBatch();
                addProgramRule.clearBatch();

                for(Rule rule : program.getRules()) {
                    if(!old.getRules().contains(rule)) {
                        rule.setId(getNextSequence("seq.rules"));
View Full Code Here


        // 1. delete all rule associations and rules including the justifications they depend on
        PreparedStatement deleteProgramRule = getPreparedStatement("programs.delete_rule");
        PreparedStatement deleteRule        = getPreparedStatement("rules.delete_by_id");
        synchronized (deleteProgramRule) {
            deleteProgramRule.clearBatch();
            deleteRule.clearBatch();
            for(Rule rule : program.getRules()) {
                deleteProgramRule.setLong(1, program.getId());
                deleteProgramRule.setLong(2, rule.getId());
                deleteProgramRule.addBatch();
View Full Code Here

        }

        // 2. delete all namespaces
        PreparedStatement deleteProgramNS = getPreparedStatement("programs.delete_ns");
        synchronized (deleteProgramNS) {
            deleteProgramNS.clearBatch();
            for(Map.Entry<String,String> ns : program.getNamespaces().entrySet()) {
                deleteProgramNS.setLong(1,   program.getId());
                deleteProgramNS.setString(2, ns.getKey());
                deleteProgramNS.setString(3, ns.getValue());
                deleteProgramNS.addBatch();
View Full Code Here

        PreparedStatement justificationAddRule   = getPreparedStatement("justifications.add_rule");

        synchronized (insertJustification) {
            insertJustification.clearBatch();
            justificationAddTriple.clearBatch();
            justificationAddRule.clearBatch();

            for(Justification j : justifications) {
                if(j.getId() != null) {
                    log.warn("justification is already stored in database, not persisting again (database ID: {})", j.getId());
                } else {
View Full Code Here

        PreparedStatement deleteJustificationTriples = getPreparedStatement("justifications.del_triple");

        synchronized (deleteJustification) {
            deleteJustification.clearBatch();
            deleteJustificationRules.clearBatch();
            deleteJustificationTriples.clearBatch();

            while(justifications.hasNext()) {
                Justification j = justifications.next();
                if(j.getId() == null) {
                    log.error("cannot delete justification since it does not have a database ID");
View Full Code Here

        pStmt.addBatch();
        pStmt.setInt(1, 2);
        pStmt.addBatch();
        pStmt.setInt(1, 3);
        pStmt.addBatch();
        pStmt.clearBatch();
        /* there were 0 statements in the batch,
         * update count length should be 0 */
        assertBatchUpdateCounts(new int[] {}, pStmt.executeBatch());

        println("Positive Prepared Stat: " +
View Full Code Here

        pStmt.addBatch();
        pStmt.setInt(1, 2);
        pStmt.addBatch();
        pStmt.setInt(1, 3);
        pStmt.addBatch();
        pStmt.clearBatch();
        pStmt.setInt(1, 1);
        pStmt.addBatch();
        pStmt.setInt(1, 2);
        pStmt.addBatch();
        pStmt.setInt(1, 3);
View Full Code Here

        }

        // 2) create namespace entries in the reasoner_program_namespaces table
        PreparedStatement insertNamespaces = getPreparedStatement("programs.add_ns");
        synchronized (insertNamespaces) {
            insertNamespaces.clearBatch();
            for(Map.Entry<String,String> entry : program.getNamespaces().entrySet()) {
                insertNamespaces.clearParameters();
                insertNamespaces.setLong(1, program.getId());
                insertNamespaces.setString(2,entry.getKey());
                insertNamespaces.setString(3,entry.getValue());
View Full Code Here

                insertNamespaces.setString(2,entry.getKey());
                insertNamespaces.setString(3,entry.getValue());
                insertNamespaces.addBatch();
            }
            insertNamespaces.executeBatch();
            insertNamespaces.clearBatch();
        }


        // 3) create rules in the reasoner_rules table
        for(Rule rule : program.getRules()) {
View Full Code Here

        }

        // 4) add relation between program and rules to the reasoner_program_rules table
        PreparedStatement insertRuleRelation = getPreparedStatement("programs.add_rule");
        synchronized (insertRuleRelation) {
            insertRuleRelation.clearBatch();
            for(Rule rule : program.getRules()) {
                insertRuleRelation.clearParameters();
                insertRuleRelation.setLong(1,program.getId());
                insertRuleRelation.setLong(2,rule.getId());
                insertRuleRelation.addBatch();
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.