20 import java.sql.PreparedStatement;
21 import java.sql.SQLException;
69 return "allprimitives";
73 public void createInstances(
int numberOfInstances) {
74 for (
int i = 0;
i < numberOfInstances; ++
i) {
75 createAllPrimitiveInstance(
i);
79 public void testDeleteEqualByPrimaryKey() {
80 deleteEqualQuery(
"id",
"PRIMARY", 5, 1);
81 deleteEqualQuery(
"id",
"PRIMARY", 5, 0);
83 connection.setAutoCommit(
false);
84 PreparedStatement preparedStatement = connection.prepareStatement(
"DELETE FROM allprimitives where id = ?");
86 for (
int i = 4;
i < 9; ++
i) {
87 preparedStatement.setInt(1,
i);
88 preparedStatement.addBatch();
90 int[] results = preparedStatement.executeBatch();
92 for (
int i = 0;
i < 5; ++
i) {
93 int expected = (
i == 1) ? 0:1;
94 errorIfNotEqual(
"testDeleteEqualByPrimaryKey result " +
i, expected, results[
i]);
96 }
catch (SQLException e) {
97 error(e.getMessage());
99 equalQuery(
"id",
"PRIMARY", 0, 0);
100 equalQuery(
"id",
"PRIMARY", 1, 1);
101 equalQuery(
"id",
"PRIMARY", 2, 2);
102 equalQuery(
"id",
"PRIMARY", 3, 3);
103 equalQuery(
"id",
"PRIMARY", 4);
104 equalQuery(
"id",
"PRIMARY", 5);
105 equalQuery(
"id",
"PRIMARY", 6);
106 equalQuery(
"id",
"PRIMARY", 7);
107 equalQuery(
"id",
"PRIMARY", 8);
108 equalQuery(
"id",
"PRIMARY", 9, 9);