提交 9a63cfc7 authored 作者: Owner's avatar Owner

Reverted to simple change for schemaName null bug

上级 d4795db2
...@@ -1105,7 +1105,7 @@ public class Parser { ...@@ -1105,7 +1105,7 @@ public class Parser {
if (readIf("(")) { if (readIf("(")) {
/* a select query is supplied */ /* a select query is supplied */
if (isSelect()) { if (isSelect()) {
command.setQuery(parseSelectRetainingSchema()); command.setQuery(parseSelect());
read(")"); read(")");
} }
command.setQueryAlias(readFromAlias(null, Arrays.asList("ON"))); command.setQueryAlias(readFromAlias(null, Arrays.asList("ON")));
...@@ -1877,35 +1877,27 @@ public class Parser { ...@@ -1877,35 +1877,27 @@ public class Parser {
} }
return command; return command;
} }
private Query parseSelectRetainingSchema() {
// The parseSelect() method nulls the schema name sometimes - make sure it is reverted if nulled private Query parseSelect() {
// This method and its subroutines sometimes resets the schema name - the try-finally block
// makes sure it is reverted if nulled
String savedSchemaName = schemaName; String savedSchemaName = schemaName;
Throwable error=null;
Query command = null; Query command = null;
try{ try{
command = parseSelect();
}
catch(Throwable e){
error = e;
throw e;
}
finally{
if(schemaName==null && error==null){
schemaName = savedSchemaName;
}
}
return command;
}
private Query parseSelect() {
int paramIndex = parameters.size(); int paramIndex = parameters.size();
Query command = parseSelectUnion(); command = parseSelectUnion();
ArrayList<Parameter> params = New.arrayList(); ArrayList<Parameter> params = New.arrayList();
for (int i = paramIndex, size = parameters.size(); i < size; i++) { for (int i = paramIndex, size = parameters.size(); i < size; i++) {
params.add(parameters.get(i)); params.add(parameters.get(i));
} }
command.setParameterList(params); command.setParameterList(params);
command.init(); command.init();
}
finally{
if(schemaName==null){
schemaName = savedSchemaName;
}
}
return command; return command;
} }
...@@ -5186,7 +5178,7 @@ public class Parser { ...@@ -5186,7 +5178,7 @@ public class Parser {
try { try {
read("AS"); read("AS");
read("("); read("(");
Query withQuery = parseSelectRetainingSchema(); Query withQuery = parseSelect();
read(")"); read(")");
columnTemplateList = createQueryColumnTemplateList(cols, withQuery, querySQLOutput); columnTemplateList = createQueryColumnTemplateList(cols, withQuery, querySQLOutput);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论