提交 bad2c71f authored 作者: Thomas Mueller's avatar Thomas Mueller

Benchmark: the number of executed statements was incorrect.

上级 c7038f81
...@@ -317,8 +317,10 @@ class Database { ...@@ -317,8 +317,10 @@ class Database {
void update(PreparedStatement prep, String trace) throws SQLException { void update(PreparedStatement prep, String trace) throws SQLException {
test.trace(trace); test.trace(trace);
prep.executeUpdate(); prep.executeUpdate();
if (test.collect) {
executedStatements++; executedStatements++;
} }
}
/** /**
* Execute an SQL statement. * Execute an SQL statement.
...@@ -328,7 +330,9 @@ class Database { ...@@ -328,7 +330,9 @@ class Database {
void update(String sql) throws SQLException { void update(String sql) throws SQLException {
sql = getSQL(sql); sql = getSQL(sql);
if (sql.trim().length() > 0) { if (sql.trim().length() > 0) {
if (test.collect) {
executedStatements++; executedStatements++;
}
stat.execute(sql); stat.execute(sql);
} else { } else {
System.out.println("?"); System.out.println("?");
...@@ -414,7 +418,9 @@ class Database { ...@@ -414,7 +418,9 @@ class Database {
// if(time > 100) { // if(time > 100) {
// System.out.println("time="+time); // System.out.println("time="+time);
// } // }
if (test.collect) {
executedStatements++; executedStatements++;
}
return rs; return rs;
} }
......
...@@ -89,8 +89,6 @@ public class TestPerformance { ...@@ -89,8 +89,6 @@ public class TestPerformance {
exit = true; exit = true;
} }
} }
openResults(init);
Properties prop = new Properties(); Properties prop = new Properties();
InputStream in = getClass().getResourceAsStream("test.properties"); InputStream in = getClass().getResourceAsStream("test.properties");
prop.load(in); prop.load(in);
...@@ -129,6 +127,7 @@ public class TestPerformance { ...@@ -129,6 +127,7 @@ public class TestPerformance {
Statement stat = null; Statement stat = null;
PrintWriter writer = null; PrintWriter writer = null;
try { try {
openResults(init);
conn = getResultConnection(); conn = getResultConnection();
stat = conn.createStatement(); stat = conn.createStatement();
prep = conn prep = conn
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论