Package java.sql

Examples of java.sql.Statement.clearBatch()


            if (usingEmbedded())
                assertSQLState("XJ068", sqle);
            else if (usingDerbyNetClient())
                assertSQLState("XJ208", sqle);
           
            stmt.clearBatch();
        }
       
        assertTableRowCount("T1",
                usingEmbedded() ? 0 : 3);
View Full Code Here


            }
        }
        conn.rollback();
        conn2.rollback();
        stmt.clearBatch();
        stmt2.clearBatch();
        stmt.close();
        stmt2.close();
        commit();
        conn2.close();
    }
View Full Code Here

    public void testEmptyStatementBatch() throws SQLException {
        Statement stmt = createStatement();
        // try executing a batch which nothing in it. Should work.
        println("Positive Statement: clear the batch and run the empty batch");
        stmt.clearBatch();
        assertBatchUpdateCounts(new int[0], stmt.executeBatch());

        stmt.close();
        commit();
    }
View Full Code Here

        println("Positive Statement: add 3 statements, clear and execute batch");
        stmt.addBatch("insert into t1 values(2)");
        stmt.addBatch("insert into t1 values(2)");
        stmt.addBatch("insert into t1 values(2)");
        stmt.clearBatch();

        // Batch should be cleared, there should be no update count
        assertBatchUpdateCounts(new int[0], stmt.executeBatch());
        assertTableRowCount("T1", 0);
View Full Code Here

        println("Positive Statement: add 3 statements, clear batch, " +
            "add 3 more statements and execute batch");
        stmt.addBatch("insert into t1 values(2)");
        stmt.addBatch("insert into t1 values(2)");
        stmt.addBatch("insert into t1 values(2)");
        stmt.clearBatch();
        stmt.addBatch("insert into t1 values(2)");
        stmt.addBatch("insert into t1 values(2)");
        stmt.addBatch("insert into t1 values(2)");

        assertBatchUpdateCounts(new int[] {1,1,1}, stmt.executeBatch());
View Full Code Here

            return statement.executeBatch();
        }
        finally
        {
            statement.clearBatch();
            statement.close();
        }
    }

    @Override
View Full Code Here

        Assert.assertEquals(1, dataSource.getActiveCount());
        Assert.assertEquals(0, dataSource.getErrorCount());
       
        Exception error = null;
        try {
            stmt.clearBatch();
        } catch (Exception e) {
            error = e;
        }
        Assert.assertNotNull(error);
       
View Full Code Here

    public void test_clearBatch() throws Exception {
        Connection conn = dataSource.getConnection();
        Statement stmt = conn.createStatement();

        stmt.clearBatch();
        ((DruidPooledStatement) stmt).getStatement().close();

        {
            SQLException error = null;
            try {
View Full Code Here

        ((DruidPooledStatement) stmt).getStatement().close();

        {
            SQLException error = null;
            try {
                stmt.clearBatch();
            } catch (SQLException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
View Full Code Here

            stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE,
                                        ResultSet.CLOSE_CURSORS_AT_COMMIT);
            stmt.setQueryTimeout(stmt.getQueryTimeout());
            stmt.setEscapeProcessing(true);
            stmt.clearBatch();
            stmt.clearWarnings();
            stmt.setCursorName("demo_cur");

            conn.setAutoCommit(false);
            Savepoint point = conn.setSavepoint();
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.