com.alibaba.druid.sql.visitor.ExportParameterVisitorUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of druid Show documentation
Show all versions of druid Show documentation
An JDBC datasource implementation.
/*
* Copyright 1999-2018 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 java.util.ArrayList;
import java.util.List;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLObject;
import com.alibaba.druid.sql.ast.expr.*;
import com.alibaba.druid.sql.dialect.db2.visitor.DB2ExportParameterVisitor;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlExportParameterVisitor;
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleExportParameterVisitor;
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGExportParameterVisitor;
import com.alibaba.druid.sql.dialect.sqlserver.visitor.MSSQLServerExportParameterVisitor;
import com.alibaba.druid.util.JdbcUtils;
public final class ExportParameterVisitorUtils {
//private for util class not need new instance
private ExportParameterVisitorUtils() {
super();
}
public static ExportParameterVisitor createExportParameterVisitor(final Appendable out ,final String dbType) {
if (JdbcUtils.MYSQL.equals(dbType)) {
return new MySqlExportParameterVisitor(out);
}
if (JdbcUtils.ORACLE.equals(dbType) || JdbcUtils.ALI_ORACLE.equals(dbType)) {
return new OracleExportParameterVisitor(out);
}
if (JdbcUtils.DB2.equals(dbType)) {
return new DB2ExportParameterVisitor(out);
}
if (JdbcUtils.MARIADB.equals(dbType)) {
return new MySqlExportParameterVisitor(out);
}
if (JdbcUtils.H2.equals(dbType)) {
return new MySqlExportParameterVisitor(out);
}
if (JdbcUtils.POSTGRESQL.equals(dbType)
|| JdbcUtils.ENTERPRISEDB.equals(dbType)) {
return new PGExportParameterVisitor(out);
}
if (JdbcUtils.SQL_SERVER.equals(dbType) || JdbcUtils.JTDS.equals(dbType)) {
return new MSSQLServerExportParameterVisitor(out);
}
return new ExportParameterizedOutputVisitor(out);
}
public static boolean exportParamterAndAccept(final List