OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SqlCreateServer.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.SqlCreate;
6 import org.apache.calcite.sql.SqlKind;
7 import org.apache.calcite.sql.SqlNode;
9 import org.apache.calcite.sql.SqlSpecialOperator;
10 import org.apache.calcite.sql.parser.SqlParserPos;
11 
12 import java.util.List;
13 import java.util.Map;
14 
18 public class SqlCreateServer extends SqlCreate implements JsonSerializableDdl {
19  private static final SqlOperator OPERATOR =
20  new SqlSpecialOperator("CREATE_SERVER", SqlKind.OTHER_DDL);
21 
22  public static class Builder extends SqlOptionsBuilder {
23  private boolean ifNotExists;
24  private String serverName;
25  private String dataWrapper;
26  private SqlParserPos pos;
27 
28  public void setIfNotExists(final boolean ifNotExists) {
29  this.ifNotExists = ifNotExists;
30  }
31 
32  public void setServerName(final String serverName) {
33  this.serverName = serverName;
34  }
35 
36  public void setDataWrapper(final String dataWrapper) {
37  this.dataWrapper = dataWrapper;
38  }
39 
40  public void setPos(final SqlParserPos pos) {
41  this.pos = pos;
42  }
43 
45  return new SqlCreateServer(
46  pos, ifNotExists, serverName, dataWrapper, super.options);
47  }
48  }
49 
50  @Expose
51  private boolean ifNotExists;
52  @Expose
53  private String serverName;
54  @Expose
55  private String dataWrapper;
56  @Expose
57  private String command;
58  @Expose
59  private Map<String, String> options;
60 
61  public SqlCreateServer(final SqlParserPos pos,
62  final boolean ifNotExists,
63  final String serverName,
64  final String dataWrapper,
65  final Map<String, String> options) {
66  super(OPERATOR, pos, false, ifNotExists);
67  this.ifNotExists = ifNotExists;
68  this.serverName = serverName;
69  this.command = OPERATOR.getName();
70  this.dataWrapper = dataWrapper;
71  this.options = options;
72  }
73 
74  @Override
75  public List<SqlNode> getOperandList() {
76  return null;
77  }
78 
79  @Override
80  public String toString() {
81  return toJsonString();
82  }
83 }
SqlCreateServer(final SqlParserPos pos, final boolean ifNotExists, final String serverName, final String dataWrapper, final Map< String, String > options)