OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SqlAlterDatabase.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl;
2 
3 import com.google.gson.annotations.Expose;
4 
5 import org.apache.calcite.sql.SqlKind;
7 import org.apache.calcite.sql.SqlSpecialOperator;
8 import org.apache.calcite.sql.parser.SqlParserPos;
9 
13 public class SqlAlterDatabase extends SqlCustomDdl {
14  private static final SqlOperator OPERATOR =
15  new SqlSpecialOperator("ALTER_DATABASE", SqlKind.OTHER_DDL);
16 
24  public enum AlterType { CHANGE_OWNER, RENAME_DATABASE }
25 
26  public static class Builder extends SqlOptionsBuilder {
28  private String databaseName;
29  private String newDatabaseName;
30  private String newOwner;
31  private SqlParserPos pos;
32 
33  public void setAlterType(final AlterType alterType) {
34  this.alterType = alterType;
35  }
36 
37  public void setDatabaseName(final String databaseName) {
38  this.databaseName = databaseName;
39  }
40 
41  public void setNewDatabaseName(final String newDatabaseName) {
42  this.newDatabaseName = newDatabaseName;
43  }
44 
45  public void setNewOwner(final String newOwner) {
46  this.newOwner = newOwner;
47  }
48 
49  public void setPos(final SqlParserPos pos) {
50  this.pos = pos;
51  }
52 
54  return new SqlAlterDatabase(
56  }
57  }
58 
59  @Expose
61  @Expose
62  private String newDatabaseName;
63  @Expose
64  private String newOwner;
65  @Expose
66  private String databaseName;
67 
68  public SqlAlterDatabase(final SqlParserPos pos,
69  final AlterType alterType,
70  final String databaseName,
71  final String newDatabaseName,
72  final String newOwner) {
73  super(OPERATOR, pos);
74  this.alterType = alterType;
75  this.newDatabaseName = newDatabaseName;
76  this.newOwner = newOwner;
77  this.databaseName = databaseName;
78  }
79 }
SqlAlterDatabase(final SqlParserPos pos, final AlterType alterType, final String databaseName, final String newDatabaseName, final String newOwner)
void setNewDatabaseName(final String newDatabaseName)