All Downloads are FREE. Search and download functionalities are using the official Maven repository.

studio.raptor.sqlparser.wall.WallCheckResult Maven / Gradle / Ivy

/*
 * Copyright 1999-2017 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 studio.raptor.sqlparser.wall;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import studio.raptor.sqlparser.ast.SQLStatement;

public class WallCheckResult {

  private final List statementList;
  private final Map tableStats;

  private final List violations;

  private final Map functionStats;

  private final boolean syntaxError;

  private final WallSqlStat sqlStat;

  private String sql;

  public WallCheckResult() {
    this(null);
  }

  public WallCheckResult(WallSqlStat sqlStat, List stmtList) {
    if (sqlStat != null) {
      tableStats = sqlStat.getTableStats();
      violations = sqlStat.getViolations();
      functionStats = sqlStat.getFunctionStats();
      statementList = stmtList;
      syntaxError = sqlStat.isSyntaxError();
    } else {
      tableStats = Collections.emptyMap();
      violations = Collections.emptyList();
      functionStats = Collections.emptyMap();
      statementList = stmtList;
      syntaxError = false;
    }
    this.sqlStat = sqlStat;
  }

  public WallCheckResult(WallSqlStat sqlStat) {
    this(sqlStat, Collections.emptyList());
  }

  public WallCheckResult(WallSqlStat sqlStat, List violations,
      Map tableStats,
      Map functionStats, List statementList,
      boolean syntaxError) {
    this.sqlStat = sqlStat;
    this.tableStats = tableStats;
    this.violations = violations;
    this.functionStats = functionStats;
    this.statementList = statementList;
    this.syntaxError = syntaxError;
  }

  public String getSql() {
    return sql;
  }

  public void setSql(String sql) {
    this.sql = sql;
  }

  public List getViolations() {
    return violations;
  }

  public List getStatementList() {
    return statementList;
  }

  public Map getTableStats() {
    return tableStats;
  }

  public Map getFunctionStats() {
    return functionStats;
  }

  public boolean isSyntaxError() {
    return syntaxError;
  }

  public WallSqlStat getSqlStat() {
    return sqlStat;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy