未验证 提交 666c1e2a 编写于 作者: J Juan Pan(Trista) 提交者: GitHub

Refactor FormatSQLVisitorFacade (#7887)

上级 dca16847
......@@ -19,10 +19,10 @@ package org.apache.shardingsphere.sql.parser.mysql;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.mysql.lexer.MySQLLexer;
import org.apache.shardingsphere.sql.parser.mysql.parser.MySQLParser;
import org.apache.shardingsphere.sql.parser.mysql.visitor.statement.MySQLStatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.mysql.visitor.MySQLSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
/**
......@@ -46,7 +46,7 @@ public final class MySQLParserConfiguration implements SQLParserConfiguration {
}
@Override
public Class<? extends StatementSQLVisitorFacade> getVisitorFacadeClass() {
return MySQLStatementSQLVisitorFacade.class;
public Class<? extends SQLVisitorFacade> getVisitorFacadeClass() {
return MySQLSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.MySQLFormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.mysql.visitor.statement.MySQLStatementSQLVisitorFacade;
/**
* MySQL SQL visitor facade.
*/
public final class MySQLSQLVisitorFacade implements SQLVisitorFacade {
@Override
public Class<? extends StatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
return MySQLStatementSQLVisitorFacade.class;
}
@Override
public Class<? extends FormatSQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
return MySQLFormatSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor.format;
import lombok.AccessLevel;
import lombok.Getter;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementBaseVisitor;
/**
* MySQL Format SQL visitor.
*/
@Getter(AccessLevel.PROTECTED)
public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<String> {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor.format;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DALFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DDLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DMLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.RLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.TCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl.MySQLDALFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl.MySQLDCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl.MySQLDDLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl.MySQLDMLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl.MySQLRLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl.MySQLTCLFormatSQLVisitor;
/**
* Format SQL Visitor facade for MySQL.
*/
public final class MySQLFormatSQLVisitorFacade implements FormatSQLVisitorFacade {
@Override
public Class<? extends DMLFormatSQLVisitor> getDMLVisitorClass() {
return MySQLDMLFormatSQLVisitor.class;
}
@Override
public Class<? extends DDLFormatSQLVisitor> getDDLVisitorClass() {
return MySQLDDLFormatSQLVisitor.class;
}
@Override
public Class<? extends TCLFormatSQLVisitor> getTCLVisitorClass() {
return MySQLTCLFormatSQLVisitor.class;
}
@Override
public Class<? extends DCLFormatSQLVisitor> getDCLVisitorClass() {
return MySQLDCLFormatSQLVisitor.class;
}
@Override
public Class<? extends DALFormatSQLVisitor> getDALVisitorClass() {
return MySQLDALFormatSQLVisitor.class;
}
@Override
public Class<? extends RLFormatSQLVisitor> getRLVisitorClass() {
return MySQLRLFormatSQLVisitor.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DALFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.MySQLFormatSQLVisitor;
/**
* DAL Format SQL visitor for MySQL.
*/
public final class MySQLDALFormatSQLVisitor extends MySQLFormatSQLVisitor implements DALFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.MySQLFormatSQLVisitor;
/**
* DCL Format SQL visitor for MySQL.
*/
public final class MySQLDCLFormatSQLVisitor extends MySQLFormatSQLVisitor implements DCLFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DDLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.MySQLFormatSQLVisitor;
/**
* DDL Format SQL visitor for MySQL.
*/
public final class MySQLDDLFormatSQLVisitor extends MySQLFormatSQLVisitor implements DDLFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DMLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.MySQLFormatSQLVisitor;
/**
* DML Format SQL visitor for MySQL.
*/
public final class MySQLDMLFormatSQLVisitor extends MySQLFormatSQLVisitor implements DMLFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.RLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.MySQLFormatSQLVisitor;
/**
* RL Format SQL visitor for MySQL.
*/
public final class MySQLRLFormatSQLVisitor extends MySQLFormatSQLVisitor implements RLFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.mysql.visitor.format.impl;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.TCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.mysql.visitor.format.MySQLFormatSQLVisitor;
/**
* TCL Format SQL visitor for MySQL.
*/
public final class MySQLTCLFormatSQLVisitor extends MySQLFormatSQLVisitor implements TCLFormatSQLVisitor {
}
......@@ -19,10 +19,10 @@ package org.apache.shardingsphere.sql.parser.oracle;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.oracle.lexer.OracleLexer;
import org.apache.shardingsphere.sql.parser.oracle.parser.OracleParser;
import org.apache.shardingsphere.sql.parser.oracle.visitor.OracleStatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.oracle.visitor.OracleSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
/**
......@@ -46,7 +46,7 @@ public final class OracleParserConfiguration implements SQLParserConfiguration {
}
@Override
public Class<? extends StatementSQLVisitorFacade> getVisitorFacadeClass() {
return OracleStatementSQLVisitorFacade.class;
public Class<? extends SQLVisitorFacade> getVisitorFacadeClass() {
return OracleSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.oracle.visitor;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.oracle.visitor.format.OracleFormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.oracle.visitor.statement.OracleStatementSQLVisitorFacade;
/**
* Oracle SQL visitor facade.
*/
public final class OracleSQLVisitorFacade implements SQLVisitorFacade {
@Override
public Class<? extends StatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
return OracleStatementSQLVisitorFacade.class;
}
@Override
public Class<? extends FormatSQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
return OracleFormatSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.oracle.visitor.format;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DALFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DDLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DMLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.RLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.TCLFormatSQLVisitor;
/**
* Format SQL Visitor facade for MySQL.
*/
public final class OracleFormatSQLVisitorFacade implements FormatSQLVisitorFacade {
@Override
public Class<? extends DMLFormatSQLVisitor> getDMLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DDLFormatSQLVisitor> getDDLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends TCLFormatSQLVisitor> getTCLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DCLFormatSQLVisitor> getDCLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DALFormatSQLVisitor> getDALVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends RLFormatSQLVisitor> getRLVisitorClass() {
throw new UnsupportedOperationException();
}
}
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.oracle.visitor;
package org.apache.shardingsphere.sql.parser.oracle.visitor.statement;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.impl.DALStatementSQLVisitor;
......
......@@ -19,10 +19,10 @@ package org.apache.shardingsphere.sql.parser.postgresql;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.postgresql.lexer.PostgreSQLLexer;
import org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLParser;
import org.apache.shardingsphere.sql.parser.postgresql.visitor.PostgreSQLStatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.postgresql.visitor.PostgreSQLSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
/**
......@@ -46,7 +46,7 @@ public final class PostgreSQLParserConfiguration implements SQLParserConfigurati
}
@Override
public Class<? extends StatementSQLVisitorFacade> getVisitorFacadeClass() {
return PostgreSQLStatementSQLVisitorFacade.class;
public Class<? extends SQLVisitorFacade> getVisitorFacadeClass() {
return PostgreSQLSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.postgresql.visitor;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.postgresql.visitor.format.PostgreSQLFormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.PostgreSQLStatementSQLVisitorFacade;
/**
* PostgreSQL SQL visitor facade.
*/
public final class PostgreSQLSQLVisitorFacade implements SQLVisitorFacade {
@Override
public Class<? extends StatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
return PostgreSQLStatementSQLVisitorFacade.class;
}
@Override
public Class<? extends FormatSQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
return PostgreSQLFormatSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.postgresql.visitor.format;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DALFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DDLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DMLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.RLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.TCLFormatSQLVisitor;
/**
* Format SQL Visitor facade for MySQL.
*/
public final class PostgreSQLFormatSQLVisitorFacade implements FormatSQLVisitorFacade {
@Override
public Class<? extends DMLFormatSQLVisitor> getDMLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DDLFormatSQLVisitor> getDDLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends TCLFormatSQLVisitor> getTCLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DCLFormatSQLVisitor> getDCLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DALFormatSQLVisitor> getDALVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends RLFormatSQLVisitor> getRLVisitorClass() {
throw new UnsupportedOperationException();
}
}
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.postgresql.visitor;
package org.apache.shardingsphere.sql.parser.postgresql.visitor.statement;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.impl.DALStatementSQLVisitor;
......
......@@ -19,11 +19,11 @@ package org.apache.shardingsphere.sql.parser.sql92;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
import org.apache.shardingsphere.sql.parser.sql92.lexer.SQL92Lexer;
import org.apache.shardingsphere.sql.parser.sql92.parser.SQL92Parser;
import org.apache.shardingsphere.sql.parser.sql92.visitor.SQL92StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.sql92.visitor.SQL92SQLVisitorFacade;
/**
* SQL parser configuration for SQL92.
......@@ -46,7 +46,7 @@ public final class SQL92ParserConfiguration implements SQLParserConfiguration {
}
@Override
public Class<? extends StatementSQLVisitorFacade> getVisitorFacadeClass() {
return SQL92StatementSQLVisitorFacade.class;
public Class<? extends SQLVisitorFacade> getVisitorFacadeClass() {
return SQL92SQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.sql92.visitor;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.sql92.visitor.format.SQL92FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.sql92.visitor.statement.SQL92StatementSQLVisitorFacade;
/**
* SQL92 SQL visitor facade.
*/
public final class SQL92SQLVisitorFacade implements SQLVisitorFacade {
@Override
public Class<? extends StatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
return SQL92StatementSQLVisitorFacade.class;
}
@Override
public Class<? extends FormatSQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
return SQL92FormatSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.sql92.visitor.format;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DALFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DDLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DMLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.RLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.TCLFormatSQLVisitor;
/**
* Format SQL Visitor facade for MySQL.
*/
public final class SQL92FormatSQLVisitorFacade implements FormatSQLVisitorFacade {
@Override
public Class<? extends DMLFormatSQLVisitor> getDMLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DDLFormatSQLVisitor> getDDLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends TCLFormatSQLVisitor> getTCLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DCLFormatSQLVisitor> getDCLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DALFormatSQLVisitor> getDALVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends RLFormatSQLVisitor> getRLVisitorClass() {
throw new UnsupportedOperationException();
}
}
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.sql92.visitor;
package org.apache.shardingsphere.sql.parser.sql92.visitor.statement;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.impl.DALStatementSQLVisitor;
......
......@@ -19,11 +19,11 @@ package org.apache.shardingsphere.sql.parser.sqlserver;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
import org.apache.shardingsphere.sql.parser.sqlserver.lexer.SQLServerLexer;
import org.apache.shardingsphere.sql.parser.sqlserver.parser.SQLServerParser;
import org.apache.shardingsphere.sql.parser.sqlserver.visitor.SQLServerStatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.sqlserver.visitor.SQLServerSQLVisitorFacade;
/**
* SQL parser configuration for SQLServer.
......@@ -46,7 +46,7 @@ public final class SQLServerParserConfiguration implements SQLParserConfiguratio
}
@Override
public Class<? extends StatementSQLVisitorFacade> getVisitorFacadeClass() {
return SQLServerStatementSQLVisitorFacade.class;
public Class<? extends SQLVisitorFacade> getVisitorFacadeClass() {
return SQLServerSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.sqlserver.visitor;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.sqlserver.visitor.format.SQLServerFormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.SQLServerStatementSQLVisitorFacade;
/**
* SQLServer SQL visitor facade.
*/
public final class SQLServerSQLVisitorFacade implements SQLVisitorFacade {
@Override
public Class<? extends StatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
return SQLServerStatementSQLVisitorFacade.class;
}
@Override
public Class<? extends FormatSQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
return SQLServerFormatSQLVisitorFacade.class;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.sqlserver.visitor.format;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DALFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DDLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DMLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.RLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.TCLFormatSQLVisitor;
/**
* Format SQL Visitor facade for MySQL.
*/
public final class SQLServerFormatSQLVisitorFacade implements FormatSQLVisitorFacade {
@Override
public Class<? extends DMLFormatSQLVisitor> getDMLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DDLFormatSQLVisitor> getDDLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends TCLFormatSQLVisitor> getTCLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DCLFormatSQLVisitor> getDCLVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends DALFormatSQLVisitor> getDALVisitorClass() {
throw new UnsupportedOperationException();
}
@Override
public Class<? extends RLFormatSQLVisitor> getRLVisitorClass() {
throw new UnsupportedOperationException();
}
}
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.sqlserver.visitor;
package org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.impl.DALStatementSQLVisitor;
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.core.visitor.statement;
package org.apache.shardingsphere.sql.parser.core.visitor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
......@@ -26,7 +26,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatementTyp
* Statement SQL Visitor rule.
*/
@RequiredArgsConstructor
public enum StatementSQLVisitorRule {
public enum SQLVisitorRule {
SELECT("Select", SQLStatementType.DML),
......@@ -201,9 +201,9 @@ public enum StatementSQLVisitorRule {
* @param parseTreeClass parse tree class
* @return visitor rule
*/
public static StatementSQLVisitorRule valueOf(final Class<? extends ParseTree> parseTreeClass) {
public static SQLVisitorRule valueOf(final Class<? extends ParseTree> parseTreeClass) {
String parseTreeClassName = parseTreeClass.getSimpleName();
for (StatementSQLVisitorRule each : values()) {
for (SQLVisitorRule each : values()) {
if (each.getContextName().equals(parseTreeClassName)) {
return each;
}
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.core.visitor.format;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.core.SQLParserConfigurationRegistry;
import org.apache.shardingsphere.sql.parser.core.visitor.SQLVisitorRule;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatementType;
/**
* Format SQL visitor factory.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class FormatSQLVisitorFactory {
/**
* New instance of statement SQL visitor.
*
* @param databaseTypeName name of database type
* @param SQLVisitorRule visitor rule
* @return parse tree visitor
*/
public static ParseTreeVisitor newInstance(final String databaseTypeName, final SQLVisitorRule SQLVisitorRule) {
return createParseTreeVisitor(SQLParserConfigurationRegistry.getInstance().getSQLParserConfiguration(databaseTypeName), SQLVisitorRule.getType());
}
@SneakyThrows(ReflectiveOperationException.class)
private static ParseTreeVisitor createParseTreeVisitor(final SQLParserConfiguration config, final SQLStatementType type) {
FormatSQLVisitorFacade visitorFacade =
config.getVisitorFacadeClass().getConstructor().newInstance().getFormatSQLVisitorFacadeClass().getConstructor().newInstance();
switch (type) {
case DML:
return (ParseTreeVisitor) visitorFacade.getDMLVisitorClass().getConstructor().newInstance();
case DDL:
return (ParseTreeVisitor) visitorFacade.getDDLVisitorClass().getConstructor().newInstance();
case TCL:
return (ParseTreeVisitor) visitorFacade.getTCLVisitorClass().getConstructor().newInstance();
case DCL:
return (ParseTreeVisitor) visitorFacade.getDCLVisitorClass().getConstructor().newInstance();
case DAL:
return (ParseTreeVisitor) visitorFacade.getDALVisitorClass().getConstructor().newInstance();
case RL:
return (ParseTreeVisitor) visitorFacade.getRLVisitorClass().getConstructor().newInstance();
default:
throw new SQLParsingException("Can not support SQL statement type: `%s`", type);
}
}
}
......@@ -23,6 +23,7 @@ import lombok.SneakyThrows;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.core.SQLParserConfigurationRegistry;
import org.apache.shardingsphere.sql.parser.core.visitor.SQLVisitorRule;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatementType;
......@@ -37,16 +38,17 @@ public final class StatementSQLVisitorFactory {
* New instance of statement SQL visitor.
*
* @param databaseTypeName name of database type
* @param statementSQLVisitorRule visitor rule
* @param SQLVisitorRule visitor rule
* @return parse tree visitor
*/
public static ParseTreeVisitor newInstance(final String databaseTypeName, final StatementSQLVisitorRule statementSQLVisitorRule) {
return createParseTreeVisitor(SQLParserConfigurationRegistry.getInstance().getSQLParserConfiguration(databaseTypeName), statementSQLVisitorRule.getType());
public static ParseTreeVisitor newInstance(final String databaseTypeName, final SQLVisitorRule SQLVisitorRule) {
return createParseTreeVisitor(SQLParserConfigurationRegistry.getInstance().getSQLParserConfiguration(databaseTypeName), SQLVisitorRule.getType());
}
@SneakyThrows(ReflectiveOperationException.class)
private static ParseTreeVisitor createParseTreeVisitor(final SQLParserConfiguration config, final SQLStatementType type) {
StatementSQLVisitorFacade visitorFacade = config.getVisitorFacadeClass().getConstructor().newInstance();
StatementSQLVisitorFacade visitorFacade =
config.getVisitorFacadeClass().getConstructor().newInstance().getStatementSQLVisitorFacadeClass().getConstructor().newInstance();
switch (type) {
case DML:
return (ParseTreeVisitor) visitorFacade.getDMLVisitorClass().getConstructor().newInstance();
......
......@@ -20,7 +20,7 @@ package org.apache.shardingsphere.sql.parser.engine.statement.standard;
import lombok.RequiredArgsConstructor;
import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.shardingsphere.sql.parser.core.visitor.statement.StatementSQLVisitorFactory;
import org.apache.shardingsphere.sql.parser.core.visitor.statement.StatementSQLVisitorRule;
import org.apache.shardingsphere.sql.parser.core.visitor.SQLVisitorRule;
import org.apache.shardingsphere.sql.parser.engine.statement.StatementSQLParserEngine;
import org.apache.shardingsphere.sql.parser.core.parser.SQLParserExecutor;
import org.apache.shardingsphere.sql.parser.hook.ParsingHookRegistry;
......@@ -70,7 +70,7 @@ public final class StandardSQLParserEngine implements StatementSQLParserEngine {
}
}
ParseTree parseTree = new SQLParserExecutor(databaseTypeName, sql).execute().getRootNode();
SQLStatement result = (SQLStatement) StatementSQLVisitorFactory.newInstance(databaseTypeName, StatementSQLVisitorRule.valueOf(parseTree.getClass())).visit(parseTree);
SQLStatement result = (SQLStatement) StatementSQLVisitorFactory.newInstance(databaseTypeName, SQLVisitorRule.valueOf(parseTree.getClass())).visit(parseTree);
if (useCache) {
cache.put(sql, result);
}
......
......@@ -18,21 +18,20 @@
package org.apache.shardingsphere.sql.parser.core.visitor;
import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.shardingsphere.sql.parser.core.visitor.statement.StatementSQLVisitorRule;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public final class StatementSQLVisitorRuleTest {
public final class SQLVisitorRuleTest {
@Test
public void assertValueOfParseTreeClassSuccess() {
assertThat(StatementSQLVisitorRule.valueOf(SelectContext.class), is(StatementSQLVisitorRule.SELECT));
assertThat(SQLVisitorRule.valueOf(SelectContext.class), is(SQLVisitorRule.SELECT));
}
@Test(expected = IllegalArgumentException.class)
public void assertValueOfParseTreeClassFailure() {
StatementSQLVisitorRule.valueOf(ParseTree.class);
SQLVisitorRule.valueOf(ParseTree.class);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.FormatSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
/**
* SQL visitor facade.
*/
public interface SQLVisitorFacade {
/**
* Get Statement visitor facade class.
*
* @return DML visitor class
*/
Class<? extends StatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass();
/**
* Get Format visitor facade class.
*
* @return DDL visitor class
*/
Class<? extends FormatSQLVisitorFacade> getFormatSQLVisitorFacadeClass();
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor;
/**
* SQL visitor type.
*/
public enum SQLVisitorType {
STATEMENT, FORMAT
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor.format;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DALFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DCLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DDLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.DMLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.RLFormatSQLVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.format.impl.TCLFormatSQLVisitor;
/**
* Format SQL visitor facade.
*/
public interface FormatSQLVisitorFacade {
/**
* Get DML visitor class.
*
* @return DML visitor class
*/
Class<? extends DMLFormatSQLVisitor> getDMLVisitorClass();
/**
* Get DDL visitor class.
*
* @return DDL visitor class
*/
Class<? extends DDLFormatSQLVisitor> getDDLVisitorClass();
/**
* Get TCL visitor class.
*
* @return TCL visitor class
*/
Class<? extends TCLFormatSQLVisitor> getTCLVisitorClass();
/**
* Get DCL visitor class.
*
* @return DCL visitor class
*/
Class<? extends DCLFormatSQLVisitor> getDCLVisitorClass();
/**
* Get DAL visitor class.
*
* @return DAL visitor class
*/
Class<? extends DALFormatSQLVisitor> getDALVisitorClass();
/**
* Get RL visitor class.
*
* @return RL visitor class
*/
Class<? extends RLFormatSQLVisitor> getRLVisitorClass();
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor.format.impl;
/**
* DAL format SQL visitor.
*/
public interface DALFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor.format.impl;
/**
* DCL format SQL visitor.
*/
public interface DCLFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor.format.impl;
/**
* DDL format SQL visitor.
*/
public interface DDLFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor.format.impl;
/**
* DML format SQL visitor.
*/
public interface DMLFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor.format.impl;
/**
* RL format SQL visitor.
*/
public interface RLFormatSQLVisitor {
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.shardingsphere.sql.parser.api.visitor.format.impl;
/**
* TCL format SQL visitor.
*/
public interface TCLFormatSQLVisitor {
}
......@@ -19,7 +19,7 @@ package org.apache.shardingsphere.sql.parser.spi;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.statement.StatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
/**
* SQL parser configuration.
......@@ -52,5 +52,5 @@ public interface SQLParserConfiguration {
*
* @return SQL visitor facade class
*/
Class<? extends StatementSQLVisitorFacade> getVisitorFacadeClass();
Class<? extends SQLVisitorFacade> getVisitorFacadeClass();
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册