package com.chenyang.druid.wall.spi;

import com.chenyang.druid.DbType;
import com.chenyang.druid.sql.dialect.db2.parser.DB2SQLStatementParser;
import com.chenyang.druid.sql.dialect.db2.visitor.DB2ExportParameterVisitor;
import com.chenyang.druid.sql.parser.SQLParserFeature;
import com.chenyang.druid.sql.parser.SQLStatementParser;
import com.chenyang.druid.sql.visitor.ExportParameterVisitor;
import com.chenyang.druid.wall.WallConfig;
import com.chenyang.druid.wall.WallProvider;
import com.chenyang.druid.wall.WallVisitor;

public class DB2WallProvider extends WallProvider {
   public static final String DEFAULT_CONFIG_DIR = "META-INF/druid/wall/db2";

   public DB2WallProvider() {
      this(new WallConfig("META-INF/druid/wall/db2"));
   }

   public DB2WallProvider(WallConfig config) {
      super(config, DbType.db2);
   }

   public SQLStatementParser createParser(String sql) {
      return new DB2SQLStatementParser(sql, new SQLParserFeature[]{SQLParserFeature.EnableSQLBinaryOpExprGroup});
   }

   public WallVisitor createWallVisitor() {
      return new DB2WallVisitor(this);
   }

   public ExportParameterVisitor createExportParameterVisitor() {
      return new DB2ExportParameterVisitor();
   }
}
