Package org.adbcj

Examples of org.adbcj.Connection.executeUpdate()


  public void testRollback() throws Exception {
    Connection connection = connectionManager.connect().get();
    try {
      // Clear out updates table
      Result result = connection.executeUpdate("DELETE FROM updates").get();
      assertNotNull(result);

      // Make sure updates is empty
      ResultSet rs = connection.executeQuery("SELECT id FROM updates").get();
      assertNotNull(rs);
View Full Code Here


      assertEquals(rs.size(), 0);

      connection.beginTransaction();

      // Insert a row
      result = connection.executeUpdate("INSERT INTO updates (id) VALUES (1)").get();
      assertNotNull(result);
      assertEquals(result.getAffectedRows(), Long.valueOf(1));

      // Make sure we can select the row
      rs = connection.executeQuery("SELECT id FROM updates").get();
View Full Code Here

      String a = randString();
      String b = randString();
      String c = randString();
      final String insert = String.format(insertTemplate, a, b, c);
      mysql.executeUpdate(insert).get();
      pg.executeUpdate(insert).get();
    }
//    mysql.close(false).get();
//    pg.close(false).get();
//    mysqlCM.close(true);
//    pgCM.close(true);
View Full Code Here

  public void testSimpleUpdates() throws InterruptedException {
    Connection connection = connectionManager.connect().get();
    assertNotNull(connection);

    // Clear out updates table
    Result result = connection.executeUpdate("DELETE FROM updates").get();
    assertNotNull(result);

    // Insert a row
    result = connection.executeUpdate("INSERT INTO updates (id) VALUES (1)").get();
    assertNotNull(result);
View Full Code Here

    // Clear out updates table
    Result result = connection.executeUpdate("DELETE FROM updates").get();
    assertNotNull(result);

    // Insert a row
    result = connection.executeUpdate("INSERT INTO updates (id) VALUES (1)").get();
    assertNotNull(result);
    assertEquals(result.getAffectedRows(), Long.valueOf(1));

    // Select the row
    ResultSet rs = connection.executeQuery("SELECT id FROM updates").get();
View Full Code Here

    Value value = rs.get(0).get(0);
    assertEquals(value.getInt(), 1);
    assertEquals(value.getField().getColumnLabel(), "id");

    // Update nothing
    result = connection.executeUpdate("UPDATE updates SET id=1 WHERE id=2").get();
    assertNotNull(result);
    assertEquals(result.getAffectedRows(), Long.valueOf(0));
   
    // Update inserted row
    result = connection.executeUpdate("UPDATE updates SET id=2").get();
View Full Code Here

    result = connection.executeUpdate("UPDATE updates SET id=1 WHERE id=2").get();
    assertNotNull(result);
    assertEquals(result.getAffectedRows(), Long.valueOf(0));
   
    // Update inserted row
    result = connection.executeUpdate("UPDATE updates SET id=2").get();
    assertNotNull(result);
    assertEquals(result.getAffectedRows(), Long.valueOf(1));
   
    // Delete inserted row
    result = connection.executeUpdate("DELETE FROM updates WHERE id=2").get();
View Full Code Here

    result = connection.executeUpdate("UPDATE updates SET id=2").get();
    assertNotNull(result);
    assertEquals(result.getAffectedRows(), Long.valueOf(1));
   
    // Delete inserted row
    result = connection.executeUpdate("DELETE FROM updates WHERE id=2").get();
    assertNotNull(result);
    assertEquals(result.getAffectedRows(), Long.valueOf(1));
  }
 
}
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.