提交 2d4dd6fd authored 作者: Thomas Mueller's avatar Thomas Mueller

Improve code coverage (remove unused code).

上级 d1c791cd
......@@ -15,7 +15,6 @@ import org.h2.engine.Session;
import org.h2.expression.ParameterInterface;
import org.h2.message.DbException;
import org.h2.message.Trace;
import org.h2.message.TraceObject;
import org.h2.result.ResultInterface;
/**
......@@ -265,7 +264,7 @@ public abstract class Command implements CommandInterface {
}
public String toString() {
return TraceObject.toString(sql, getParameters());
return sql + getParameters();
}
public boolean isCacheable() {
......
......@@ -14,7 +14,6 @@ import org.h2.expression.ParameterInterface;
import org.h2.expression.ParameterRemote;
import org.h2.message.DbException;
import org.h2.message.Trace;
import org.h2.message.TraceObject;
import org.h2.result.ResultInterface;
import org.h2.result.ResultRemote;
import org.h2.util.New;
......@@ -245,7 +244,7 @@ public class CommandRemote implements CommandInterface {
}
public String toString() {
return TraceObject.toString(sql, getParameters());
return sql + getParameters();
}
public int getCommandType() {
......
......@@ -6,6 +6,8 @@
*/
package org.h2.command.ddl;
import java.util.ArrayList;
import java.util.List;
import org.h2.command.CommandInterface;
import org.h2.command.Prepared;
import org.h2.command.dml.Query;
......@@ -16,14 +18,10 @@ import org.h2.engine.DbObject;
import org.h2.engine.Session;
import org.h2.expression.Parameter;
import org.h2.message.DbException;
import org.h2.message.TraceObject;
import org.h2.schema.Schema;
import org.h2.table.Table;
import org.h2.table.TableView;
import java.util.ArrayList;
import java.util.List;
/**
* This class represents the statement
* CREATE VIEW
......@@ -108,7 +106,7 @@ public class CreateView extends SchemaCommand {
if (params != null && params.size() > 0) {
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, "parameters in views");
}
querySQL = TraceObject.toString(select.getPlanSQL(), select.getParameters());
querySQL = select.getPlanSQL();
}
Session sysSession = db.getSystemSession();
TableView view;
......
......@@ -8,10 +8,7 @@ package org.h2.message;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Map;
import org.h2.expression.ParameterInterface;
import org.h2.util.StatementBuilder;
import org.h2.util.StringUtils;
/**
......@@ -358,18 +355,7 @@ public class TraceObject {
if (map.size() == 0) {
return "new Map()";
}
StringBuilder buff = new StringBuilder("new Map() /* ");
try {
for (Map.Entry<String, Class <?>> entry : map.entrySet()) {
String key = entry.getKey();
Class<?> clazz = entry.getValue();
buff.append(key).append(':').append(clazz.getName());
}
} catch (Exception e) {
buff.append(e.toString()).append(": ").append(map.toString());
}
buff.append("*/");
return buff.toString();
return "new Map() /* " + map.toString() + " */";
}
/**
......@@ -408,32 +394,4 @@ public class TraceObject {
}
}
/**
* INTERNAL
*/
public static String toString(String sql, ArrayList<? extends ParameterInterface> params) {
StatementBuilder buff = new StatementBuilder(sql);
if (params != null && params.size() > 0) {
buff.append(" {");
int i = 0;
for (ParameterInterface p : params) {
i++;
try {
buff.appendExceptFirst(", ");
buff.append(i).append(": ");
if (p == null || p.getParamValue() == null) {
buff.append('-');
} else {
buff.append(p.getParamValue().getSQL());
}
} catch (Exception e) {
buff.append("/* ").append(i).append(": ").append(e.toString()).append("*/ ");
}
}
buff.append("};");
}
return buff.toString();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论