improved sql parser.

This commit is contained in:
wenshao
2017-07-17 10:10:25 +08:00
parent 9e105a68f2
commit 5dac70deb0
20 changed files with 1510 additions and 69 deletions
@@ -2009,12 +2009,15 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
}
protected void printCreateTable(SQLCreateTableStatement x) {
print0(ucase ? "CREATE TABLE " : "create table ");
if (SQLCreateTableStatement.Type.GLOBAL_TEMPORARY.equals(x.getType())) {
print0(ucase ? "CREATE " : "create ");
final SQLCreateTableStatement.Type tableType = x.getType();
if (SQLCreateTableStatement.Type.GLOBAL_TEMPORARY.equals(tableType)) {
print0(ucase ? "GLOBAL TEMPORARY " : "global temporary ");
} else if (SQLCreateTableStatement.Type.LOCAL_TEMPORARY.equals(x.getType())) {
} else if (SQLCreateTableStatement.Type.LOCAL_TEMPORARY.equals(tableType)) {
print0(ucase ? "LOCAL TEMPORARY " : "local temporary ");
}
print0(ucase ? "TABLE " : "table ");
printTableSourceExpr(x.getName());
@@ -0,0 +1,23 @@
/*
* Copyright 1999-2017 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.sql.visitor;
/**
* Created by wenshao on 16/07/2017.
*/
public interface SQLTransformVisitor extends SQLASTVisitor {
String getSrcDbType();
}