Package java.sql

Examples of java.sql.Statement.executeBatch()


    }

    beforeOpenStatementCount = ((com.mysql.jdbc.Connection) multiConn)
        .getActiveStatementCount();

    multiStmt.executeBatch();

    afterOpenStatementCount = ((com.mysql.jdbc.Connection) multiConn)
        .getActiveStatementCount();

    assertEquals(beforeOpenStatementCount, afterOpenStatementCount);
View Full Code Here


    PreparedStatement batchPStmt = null;
    Statement batchStmt = null;

    try {
      batchStmt = rewriteConn.createStatement();
      assertEquals(0, batchStmt.executeBatch().length);

      batchStmt.addBatch("INSERT INTO testBug30550 VALUES (1)");
      int[] counts = batchStmt.executeBatch();
      assertEquals(1, counts.length);
      assertEquals(1, counts[0]);
View Full Code Here

    try {
      batchStmt = rewriteConn.createStatement();
      assertEquals(0, batchStmt.executeBatch().length);

      batchStmt.addBatch("INSERT INTO testBug30550 VALUES (1)");
      int[] counts = batchStmt.executeBatch();
      assertEquals(1, counts.length);
      assertEquals(1, counts[0]);
      assertEquals(0, batchStmt.executeBatch().length);

      batchPStmt = rewriteConn
View Full Code Here

      batchStmt.addBatch("INSERT INTO testBug30550 VALUES (1)");
      int[] counts = batchStmt.executeBatch();
      assertEquals(1, counts.length);
      assertEquals(1, counts[0]);
      assertEquals(0, batchStmt.executeBatch().length);

      batchPStmt = rewriteConn
          .prepareStatement("INSERT INTO testBug30550 VALUES (?)");
      batchPStmt.setInt(1, 1);
      assertEquals(0, batchPStmt.executeBatch().length);
View Full Code Here

        public void run() {
          try {
            deadlockStmt.addBatch("INSERT INTO t2 VALUES (1, 0)");
            deadlockStmt.addBatch("INSERT INTO t2 VALUES (2, 0)");
            deadlockStmt.addBatch("UPDATE t1 SET x=2 WHERE id=0");
            deadlockStmt.executeBatch();
          } catch (SQLException sqlEx) {
            sqlEx.printStackTrace();
            try {
              deadlockConn.rollback();
            } catch (SQLException e) {
View Full Code Here

            for (int j = 0; j < 10; j++) {
              twoStmt.addBatch("INSERT INTO " + tableName
                  + " (p) VALUES ('" + j + "')");
            }

            twoStmt.executeBatch(); // UGH: No getGeneratedKeys()
                        // support in JDBC spec, but we
                        // allow it...might have to
                        // rewrite test if/when we don't
            this.rs = twoStmt.getGeneratedKeys();
View Full Code Here

      for (int i = 0; i < 20; i++) {
        rewriteStmt
            .addBatch("INSERT INTO testBug51704 VALUES ({tsp '2002-11-12 10:00:00'})");
      }

      rewriteStmt.executeBatch(); // this should pass, because mysqld
                    // doesn't validate any escape
                    // sequences,
                    // it just strips them, where our escape
                    // processor validates them
View Full Code Here

      Statement batchStmt = conn.createStatement();
      batchStmt.setEscapeProcessing(false);
      batchStmt
          .addBatch("INSERT INTO testBug51704 VALUES ({tsp '2002-11-12 10:00:00'})");
      batchStmt.executeBatch(); // same here
    } finally {
      rewriteConn.close();
    }
  }
View Full Code Here

      updateCountsPstmt = e1.getUpdateCounts();
    }

    int[] updateCountsStmt = null;
    try {
      updateCountsStmt = statement.executeBatch();
    } catch (BatchUpdateException e) {
      e2 = e;
      updateCountsStmt = e1.getUpdateCounts();
    }
View Full Code Here

      for (int i = 0; i < 100; i++) {
        reconnectStmt.addBatch("INSERT INTO testBug13255 VALUES (" + i + ")")
      }
     
      try {
        reconnectStmt.executeBatch();
      } catch (SQLException sqlEx) {
        // We expect this...we killed the connection
      }
     
      assertEquals(2, getRowCount("testBug13255"));
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.