Merge pull request #354 from actiontech/issue-346

#346 Suggested:when view set `ALGORITHM` ,dble can return unsupported…
This commit is contained in:
tiger.yan
2017-11-30 17:06:11 +08:00
committed by GitHub
3 changed files with 17 additions and 0 deletions

View File

@@ -71,6 +71,10 @@ public class ViewMeta {
viewParser.parseCreateView(this);
try {
if ("".equals(viewName)) {
throw new Exception("sql not supported ");
}
DbleServer.getInstance().getTmManager().addMetaLock(schema, viewName);
//check if the select part has

View File

@@ -91,6 +91,8 @@ public class ViewMetaParser {
return originalSql.substring(viewNameStat, offset);
}
}
} else {
return "";
}
}
}

View File

@@ -38,6 +38,17 @@ public class ViewMetaParserTest {
}
@Test
public void getViewNodeSupportTest() {
ViewMetaParser x = new ViewMetaParser("create or replace ALGORITHM = MERGE view x_xx__xx(id,name)as select * from suntest");
Assert.assertEquals("", x.getViewName());
x = new ViewMetaParser("create or replace DEFINER = CURRENT_USER view x_xx__xx(id,name)as select * from suntest");
Assert.assertEquals("", x.getViewName());
x = new ViewMetaParser("create or replace SQL SECURITY DEFINER view x_xx__xx(id,name)as select * from suntest");
Assert.assertEquals("", x.getViewName());
}
@Test
public void parseTotalTest() {
ViewMetaParser x = new ViewMetaParser(" create or replace view x_xx__xx(id,name)as select * from suntest");