[#3234] Fixed resource leak in new benchmark test

This commit is contained in:
Lukas Eder 2014-05-06 12:23:49 +02:00
parent 2548ec2e06
commit d3d5d2ec41

View File

@ -192,24 +192,35 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
configuration.settings().setExecuteLogging(false);
DSLContext create = create(configuration);
ResultQuery<?> q = null;
try {
// System.out.println("Start");
// System.in.read();
// System.in.read();
ResultQuery<?> q = create
.select()
.from("t_book")
.where("id = ?", -1)
.keepStatement(true);
StopWatch watch = new StopWatch();
for (int i = 0; i < REPETITIONS_PLAIN_SQL; i++) {
q.bind(1, i % 4 + 1).fetchOne();
}
q = create
.select()
.from("t_book")
.where("id = ?", -1)
.keepStatement(true);
StopWatch watch = new StopWatch();
for (int i = 0; i < REPETITIONS_PLAIN_SQL; i++) {
q.bind(1, i % 4 + 1).fetchOne();
}
watch.splitInfo("Done with " + REPETITIONS_PLAIN_SQL + " repetitions");
watch.splitInfo("Done with " + REPETITIONS_PLAIN_SQL + " repetitions");
// System.out.println("Stop");
// System.in.read();
// System.in.read();
}
finally {
if (q != null)
q.close();
}
}
private void testBenchmarkReuseSQLString(DSLContext create, int repetitions) throws Exception {