Druid SQL???????????????
?????SegmentFault ???????[ 2017/1/23 11:30:26 ] ????????????? SQL Server
????Select ????????
?????? SQLSelectStatement ????????????????????????????????????????
????????ζ????? Druid ??????????????????? Select ???????г????????
????Visitor
?????? demo ?????п???????????? AST ?????????????? visitor ????????
????// ???visitor??????AST
????MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor();
????statement.accept(visitor);
????System.out.println(visitor.getColumns());
????System.out.println(visitor.getOrderByColumns());
????statement ???? accept ???????? visitor ???????????????????á??????? statement ??????????? SQLSelectStatement ??
?????? Druid ?У???? SQL ????е?????????????λ?????ε???????????? SQLObject ??statement ????? SQLObject?????? expr ?????? SQLObject??????????Ρ???????????Щ??????? SQLObject??SQLObject ????????? accept ?????????????????????????÷?????????? SQLObject ?????????????Щ???飬???÷????????????????????????????? SQLObject ???Щ?????
????????? accept() ?????? SQLObjectImpl ??????У??????????????
????public final void accept(SQLASTVisitor visitor) {
????if (visitor == null) {
????throw new IllegalArgumentException();
????}
????visitor.preVisit(this);
????accept0(visitor);
????visitor.postVisit(this);
????}
??????????? final ????????ζ?????е??????????????壬???? accept ????????visitor ???????Щ???????????????????????? accept0() ??????????????? ?????? ??
??????????? Druid ??????η??? AST ??????? SQLSelectStatement ?? accept0() ??????????????
????protected void accept0(SQLASTVisitor visitor) {
????if (visitor.visit(this)) {
????acceptChild(visitor?? this.select);
????}
????visitor.endVisit(this);
????}
?????????? visitor ??????????????????visitor ????????????????????????
?????? MySqlSchemaStateVisitor ?? visit ???????????????visitor ?????Щ?£????????????? aliasMap????? return true??????ζ???????? SQLSelectStatement ??????
????public boolean visit(SQLSelectStatement x) {
????setAliasMap();
????return true;
????}
???????????????????
????protected final void acceptChild(SQLASTVisitor visitor?? SQLObject child) {
????if (child == null) {
????return;
????}
????child.accept(visitor);
????}
???????????????SQLObject ?????? visitor ????????????Щ?????? visitor ?????????????????У????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???????sql server 2000??????????????SQL Server???????????????????λ?????SQL Server??????????????????????????????SQL Server??Azure SQL??SQL SERVER ?????????????汾??????SQL Server??WITH (NOLOCK)SQL Server??????????????DML??????????SQL Server????????????????????SQL Server??????SQL Server???????????Ч?????????SQL Server?????????????????SQL Server?????????????????SQL Server????????SQL SERVER????????SQL Server????δ???????SQL SERVER??????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????