Package java.sql

Examples of java.sql.PreparedStatement.clearBatch()


    pStmt.addBatch();
    pStmt.setInt(1, 2);
    pStmt.addBatch();
    pStmt.setInt(1, 3);
    pStmt.addBatch();
    pStmt.clearBatch();
    updateCount = pStmt.executeBatch();

    if (updateCount.length != 0) {
      System.out.println("ERROR: there were 0 statements in the batch");
      passed = false;
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

                stmtInsert.setLong(1, vmId);
                stmtInsert.addBatch();
                count++;
                if (count % 16 ==0) {
                    queryResult = stmtInsert.executeBatch();
                    stmtInsert.clearBatch();
                }
            }
            queryResult = stmtInsert.executeBatch();
           
            txn.commit();
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

                insertRuleRelation.setLong(1,program.getId());
                insertRuleRelation.setLong(2,rule.getId());
                insertRuleRelation.addBatch();
            }
            insertRuleRelation.executeBatch();
            insertRuleRelation.clearBatch();
        }

        // done
    }
View Full Code Here

            }

            //    2b) check if namespaces have been removed, and remove them if necessary from the database
            PreparedStatement deleteProgramNS = getPreparedStatement("programs.delete_ns");
            synchronized (deleteProgramNS) {
                deleteProgramNS.clearBatch();
                for(Map.Entry<String,String> oldNS : old.getNamespaces().entrySet()) {
                    if(!program.getNamespaces().entrySet().contains(oldNS)) {
                        deleteProgramNS.setLong(1,old.getId());
                        deleteProgramNS.setString(2,oldNS.getKey());
                        deleteProgramNS.setString(3,oldNS.getValue());
View Full Code Here

            }

            //    2c) check if namespaces have been added, and add them if necessary to the database
            PreparedStatement addProgramNS = getPreparedStatement("programs.add_ns");
            synchronized (addProgramNS) {
                addProgramNS.clearBatch();
                for(Map.Entry<String,String> newNS : program.getNamespaces().entrySet()) {
                    if(!old.getNamespaces().entrySet().contains(newNS)) {
                        addProgramNS.setLong(1,old.getId());
                        addProgramNS.setString(2, newNS.getKey());
                        addProgramNS.setString(3, newNS.getValue());
View Full Code Here

            //    2d) check if rules have been removed, and remove them if necessary from the database
            PreparedStatement deleteProgramRule = getPreparedStatement("programs.delete_rule");
            PreparedStatement deleteRule        = getPreparedStatement("rules.delete_by_id");
            synchronized (deleteProgramRule) {
                deleteProgramRule.clearBatch();
                deleteRule.clearBatch();
                for(Rule oldRule : old.getRules()) {
                    if(!program.getRules().contains(oldRule)) {
                        deleteProgramRule.setLong(1,old.getId());
                        deleteProgramRule.setLong(2,oldRule.getId());
                        deleteProgramRule.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.