Skip to content

Commit

Permalink
Minor refactor for view statement
Browse files Browse the repository at this point in the history
  • Loading branch information
strongduanmu committed Jan 9, 2025
1 parent 466ba41 commit 81ce5f1
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public ASTNode visitAlterView(final AlterViewContext ctx) {
@Override
public ASTNode visitDropView(final DropViewContext ctx) {
DorisDropViewStatement result = new DorisDropViewStatement();
result.setIfExists(null != ctx.ifExists());
result.getViews().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.viewNames())).getValue());
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ public ASTNode visitDropFunction(final DropFunctionContext ctx) {
@Override
public ASTNode visitDropView(final DropViewContext ctx) {
OpenGaussDropViewStatement result = new OpenGaussDropViewStatement();
result.setIfExists(null != ctx.ifExists());
result.getViews().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.qualifiedNameList())).getValue());
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ public ASTNode visitDropGroup(final DropGroupContext ctx) {
@Override
public ASTNode visitDropView(final DropViewContext ctx) {
PostgreSQLDropViewStatement result = new PostgreSQLDropViewStatement();
result.setIfExists(null != ctx.ifExists());
result.getViews().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.qualifiedNameList())).getValue());
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public ASTNode visitCreateView(final CreateViewContext ctx) {
@Override
public ASTNode visitDropView(final DropViewContext ctx) {
PrestoDropViewStatement result = new PrestoDropViewStatement();
result.setIfExists(null != ctx.ifExists());
result.getViews().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.viewNames())).getValue());
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ public ASTNode visitDropProcedure(final DropProcedureContext ctx) {
@Override
public ASTNode visitDropView(final DropViewContext ctx) {
SQLServerDropViewStatement result = new SQLServerDropViewStatement();
result.setIfExists(null != ctx.ifExists());
for (ViewNameContext each : ctx.viewName()) {
result.getViews().add((SimpleTableSegment) visit(each));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@

package org.apache.shardingsphere.sql.parser.statement.doris.ddl;

import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.doris.DorisStatement;

/**
* Doris drop view statement.
*/
@Getter
@Setter
public final class DorisDropViewStatement extends DropViewStatement implements DorisStatement {

private boolean ifExists;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@

package org.apache.shardingsphere.sql.parser.statement.opengauss.ddl;

import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.opengauss.OpenGaussStatement;

/**
* OpenGauss drop view statement.
*/
@Getter
@Setter
public final class OpenGaussDropViewStatement extends DropViewStatement implements OpenGaussStatement {

private boolean ifExists;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@

package org.apache.shardingsphere.sql.parser.statement.postgresql.ddl;

import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.postgresql.PostgreSQLStatement;

/**
* PostgreSQL drop view statement.
*/
@Getter
@Setter
public final class PostgreSQLDropViewStatement extends DropViewStatement implements PostgreSQLStatement {

private boolean ifExists;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@

package org.apache.shardingsphere.sql.parser.statement.presto.ddl;

import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.presto.PrestoStatement;

/**
* Presto drop view statement.
*/
@Getter
@Setter
public final class PrestoDropViewStatement extends DropViewStatement implements PrestoStatement {

private boolean ifExists;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@

package org.apache.shardingsphere.sql.parser.statement.sqlserver.ddl;

import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.sqlserver.SQLServerStatement;

/**
* SQLServer drop view statement.
*/
@Getter
@Setter
public final class SQLServerDropViewStatement extends DropViewStatement implements SQLServerStatement {

private boolean ifExists;
}

0 comments on commit 81ce5f1

Please sign in to comment.