提交 e79a7c8a authored 作者: Noel Grandin's avatar Noel Grandin

fix TestClearReferences

上级 ef4da740
...@@ -819,7 +819,7 @@ public class Parser { ...@@ -819,7 +819,7 @@ public class Parser {
} }
currentPrepared = command; currentPrepared = command;
int start = lastParseIndex; int start = lastParseIndex;
if (!readIf("FROM") && database.getMode() == Mode.MYSQL) { if (!readIf("FROM") && database.getMode() == Mode.getMySQL()) {
readIdentifierWithSchema(); readIdentifierWithSchema();
read("FROM"); read("FROM");
} }
......
...@@ -24,7 +24,6 @@ public class Mode { ...@@ -24,7 +24,6 @@ public class Mode {
static final String REGULAR = "REGULAR"; static final String REGULAR = "REGULAR";
private static final HashMap<String, Mode> MODES = New.hashMap(); private static final HashMap<String, Mode> MODES = New.hashMap();
public static final Mode MYSQL;
// Modes are also documented in the features section // Modes are also documented in the features section
...@@ -236,7 +235,7 @@ public class Mode { ...@@ -236,7 +235,7 @@ public class Mode {
mode.supportedClientInfoPropertiesRegEx = null; mode.supportedClientInfoPropertiesRegEx = null;
add(mode); add(mode);
MYSQL = mode = new Mode("MySQL"); mode = new Mode("MySQL");
mode.convertInsertNullToZero = true; mode.convertInsertNullToZero = true;
mode.indexDefinitionInCreateTable = true; mode.indexDefinitionInCreateTable = true;
mode.lowerCaseIdentifiers = true; mode.lowerCaseIdentifiers = true;
...@@ -311,6 +310,10 @@ public class Mode { ...@@ -311,6 +310,10 @@ public class Mode {
return MODES.get(StringUtils.toUpperEnglish(name)); return MODES.get(StringUtils.toUpperEnglish(name));
} }
public static Mode getMySQL() {
return getInstance("MySQL");
}
public String getName() { public String getName() {
return name; return name;
} }
......
...@@ -58,15 +58,6 @@ public class TestClearReferences extends TestBase { ...@@ -58,15 +58,6 @@ public class TestClearReferences extends TestBase {
TestBase.createCaller().init().test(); TestBase.createCaller().init().test();
} }
private void clear() throws Exception {
ArrayList<Class <?>> classes = New.arrayList();
check(classes, new File("bin/org/h2"));
check(classes, new File("temp/org/h2"));
for (Class<?> clazz : classes) {
clearClass(clazz);
}
}
@Override @Override
public void test() throws Exception { public void test() throws Exception {
// initialize the known classes // initialize the known classes
...@@ -91,14 +82,23 @@ public class TestClearReferences extends TestBase { ...@@ -91,14 +82,23 @@ public class TestClearReferences extends TestBase {
} }
} }
private void check(ArrayList<Class <?>> classes, File file) { private void clear() throws Exception {
ArrayList<Class <?>> classes = New.arrayList();
findClasses(classes, new File("bin/org/h2"));
findClasses(classes, new File("temp/org/h2"));
for (Class<?> clazz : classes) {
clearClass(clazz);
}
}
private void findClasses(ArrayList<Class <?>> classes, File file) {
String name = file.getName(); String name = file.getName();
if (file.isDirectory()) { if (file.isDirectory()) {
if (name.equals("CVS") || name.equals(".svn")) { if (name.equals("CVS") || name.equals(".svn")) {
return; return;
} }
for (File f : file.listFiles()) { for (File f : file.listFiles()) {
check(classes, f); findClasses(classes, f);
} }
} else { } else {
if (!name.endsWith(".class")) { if (!name.endsWith(".class")) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论