com.github.javaclub.cdl.client.matrix.parser.SQLParserFactory Maven / Gradle / Ivy
/**
* Copyright 1999-2015 dangdang.com.
*
* 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.github.javaclub.cdl.client.matrix.parser;
import java.util.List;
import java.util.Map;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.SQLDeleteStatement;
import com.alibaba.druid.sql.ast.statement.SQLInsertStatement;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.sql.ast.statement.SQLUpdateStatement;
import com.alibaba.druid.sql.dialect.db2.parser.DB2StatementParser;
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
import com.alibaba.druid.sql.dialect.sqlserver.parser.SQLServerStatementParser;
import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
import com.github.javaclub.cdl.client.matrix.exception.SQLParserException;
import com.github.javaclub.cdl.client.matrix.jdbc.DatabaseType;
import com.github.javaclub.cdl.client.matrix.parser.visitor.VisitorLogProxy;
import com.github.javaclub.cdl.client.parameter.ParameterContext;
/**
* SQL解析器工厂.
*
* @author gaohongtao, zhangliang
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class SQLParserFactory {
/**
* 创建解析器引擎对象.
*
* @param databaseType 数据库类型
* @param sql SQL语句
* @param parameters SQL中参数的值
* @param shardingColumns 分片列名称集合
* @return 解析器引擎对象
* @throws SQLParserException SQL解析异常
*/
public static SQLParseEngine create(final DatabaseType databaseType, final String sql, final List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy