Package java.sql

Examples of java.sql.Statement.addBatch()


            case derby:
                sql = "LOCK TABLE " + QueueContants.TABLE_NAME_MAXID + " IN EXCLUSIVE MODE";
                String sql2 = "LOCK TABLE " + QueueContants.TABLE_NAME_MINID + " IN EXCLUSIVE MODE";
                stmt = connection.createStatement();
                stmt.addBatch(sql);
                stmt.addBatch(sql2);
                stmt.executeBatch();
                break;
            case mysql:
                sql = "lock tables " + QueueContants.TABLE_NAME_MAXID + " write" + "," + QueueContants.TABLE_NAME_MINID
                        + " write";
View Full Code Here


       
        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 6));
        conn = DriverManager.getConnection(getUrl(), props);
        Statement stmt = conn.createStatement();
        try {
            stmt.addBatch("upsert into t values ('c', 3)");
            stmt.addBatch("select count(*) from t");
            stmt.addBatch("upsert into t values ('a', 4)");
            ResultSet rs = stmt.executeQuery("select count(*) from t");
            assertTrue(rs.next());
            assertEquals(2, rs.getInt(1));
View Full Code Here

        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 6));
        conn = DriverManager.getConnection(getUrl(), props);
        Statement stmt = conn.createStatement();
        try {
            stmt.addBatch("upsert into t values ('c', 3)");
            stmt.addBatch("select count(*) from t");
            stmt.addBatch("upsert into t values ('a', 4)");
            ResultSet rs = stmt.executeQuery("select count(*) from t");
            assertTrue(rs.next());
            assertEquals(2, rs.getInt(1));
            int[] result = stmt.executeBatch();
View Full Code Here

        conn = DriverManager.getConnection(getUrl(), props);
        Statement stmt = conn.createStatement();
        try {
            stmt.addBatch("upsert into t values ('c', 3)");
            stmt.addBatch("select count(*) from t");
            stmt.addBatch("upsert into t values ('a', 4)");
            ResultSet rs = stmt.executeQuery("select count(*) from t");
            assertTrue(rs.next());
            assertEquals(2, rs.getInt(1));
            int[] result = stmt.executeBatch();
            assertEquals(3,result.length);
View Full Code Here

            switch (databaseType) {
            case derby:
                sql = "LOCK TABLE " + QueueContants.TABLE_NAME_MAXID + " IN EXCLUSIVE MODE";
                String sql2 = "LOCK TABLE " + QueueContants.TABLE_NAME_MINID + " IN EXCLUSIVE MODE";
                stmt = connection.createStatement();
                stmt.addBatch(sql);
                stmt.addBatch(sql2);
                stmt.executeBatch();
                break;
            case mysql:
                sql = "lock tables " + QueueContants.TABLE_NAME_MAXID + " write" + "," + QueueContants.TABLE_NAME_MINID
View Full Code Here

            case derby:
                sql = "LOCK TABLE " + QueueContants.TABLE_NAME_MAXID + " IN EXCLUSIVE MODE";
                String sql2 = "LOCK TABLE " + QueueContants.TABLE_NAME_MINID + " IN EXCLUSIVE MODE";
                stmt = connection.createStatement();
                stmt.addBatch(sql);
                stmt.addBatch(sql2);
                stmt.executeBatch();
                break;
            case mysql:
                sql = "lock tables " + QueueContants.TABLE_NAME_MAXID + " write" + "," + QueueContants.TABLE_NAME_MINID
                        + " write";
View Full Code Here

   
    /* Fixture that verifies tables can be created in batch */
    public void testMinimalDDLInBatch() throws SQLException {
       
        Statement stmt = createStatement();
        stmt.addBatch("create table ddltsttable1(c1 int)");
        stmt.addBatch("create procedure ddlinteg() language java " +
            "parameter style java external name 'java.lang.Integer'");
        stmt.addBatch("create table ddltable2(c1 date)");
        int expectedCount[] = {0,0,0};
        assertBatchUpdateCounts(expectedCount, stmt.executeBatch());
View Full Code Here

    /* Fixture that verifies tables can be created in batch */
    public void testMinimalDDLInBatch() throws SQLException {
       
        Statement stmt = createStatement();
        stmt.addBatch("create table ddltsttable1(c1 int)");
        stmt.addBatch("create procedure ddlinteg() language java " +
            "parameter style java external name 'java.lang.Integer'");
        stmt.addBatch("create table ddltable2(c1 date)");
        int expectedCount[] = {0,0,0};
        assertBatchUpdateCounts(expectedCount, stmt.executeBatch());
        ResultSet rs = stmt.executeQuery(
View Full Code Here

       
        Statement stmt = createStatement();
        stmt.addBatch("create table ddltsttable1(c1 int)");
        stmt.addBatch("create procedure ddlinteg() language java " +
            "parameter style java external name 'java.lang.Integer'");
        stmt.addBatch("create table ddltable2(c1 date)");
        int expectedCount[] = {0,0,0};
        assertBatchUpdateCounts(expectedCount, stmt.executeBatch());
        ResultSet rs = stmt.executeQuery(
            "select count(*) from SYS.SYSTABLES where tablename like 'DDL%'");
        JDBC.assertSingleValueResultSet(rs, "2");
View Full Code Here

    // try executing a batch which single statement in it. Should work.
    public void testSingleStatementBatch() throws SQLException {

        Statement stmt = createStatement();
        println("Positive Statement: testing 1 statement batch");
        stmt.addBatch("insert into t1 values(2)");

        assertBatchUpdateCounts(new int[] {1}, stmt.executeBatch());
        stmt.close();
        commit();
    }
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.