This commit is contained in:
wenshao
2013-08-01 21:42:17 +08:00
parent 12c0ae01a1
commit c5b5023dd0
5 changed files with 42 additions and 12 deletions
@@ -15,7 +15,7 @@
*/
package com.alibaba.druid.sql.visitor;
public interface ParameterizedVisitor extends SQLPrintableVisitor {
public interface ParameterizedVisitor extends PrintableVisitor {
int getReplaceCount();
@@ -0,0 +1,23 @@
/*
* Copyright 1999-2011 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;
public interface PrintableVisitor extends SQLASTVisitor {
void print(char value);
void print(String text);
}
@@ -120,7 +120,7 @@ import com.alibaba.druid.sql.ast.statement.SQLUpdateStatement;
import com.alibaba.druid.sql.ast.statement.SQLUseStatement;
import com.alibaba.druid.sql.ast.statement.SQLWithSubqueryClause;
public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements SQLPrintableVisitor {
public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements PrintableVisitor {
protected final Appendable appender;
private String indent = "\t";
@@ -1,3 +1,18 @@
/*
* Copyright 1999-2011 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;
import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
@@ -5,12 +20,12 @@ import com.alibaba.druid.sql.ast.expr.SQLNumberExpr;
public class SQLASTOutputVisitorUtils {
public static boolean visit(SQLPrintableVisitor visitor, SQLIntegerExpr x) {
public static boolean visit(PrintableVisitor visitor, SQLIntegerExpr x) {
visitor.print(x.getNumber().toString());
return false;
}
public static boolean visit(SQLPrintableVisitor visitor, SQLNumberExpr x) {
public static boolean visit(PrintableVisitor visitor, SQLNumberExpr x) {
visitor.print(x.getNumber().toString());
return false;
}
@@ -1,8 +0,0 @@
package com.alibaba.druid.sql.visitor;
public interface SQLPrintableVisitor extends SQLASTVisitor {
void print(char value);
void print(String text);
}