OmniSciDB  a7179b2938
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com.mapd.parser.extension.ddl.SqlCreateView Class Reference
+ Inheritance diagram for com.mapd.parser.extension.ddl.SqlCreateView:
+ Collaboration diagram for com.mapd.parser.extension.ddl.SqlCreateView:

Public Member Functions

List< SqlNode > getOperandList ()
 
void unparse (SqlWriter writer, int leftPrec, int rightPrec)
 
String toString ()
 

Public Attributes

final SqlIdentifier name
 
final SqlNodeList columnList
 
final SqlNode query
 

Package Functions

 SqlCreateView (SqlParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier name, SqlNodeList columnList, SqlNode query)
 

Static Private Attributes

static final SqlOperator OPERATOR
 

Detailed Description

Parse tree for

CREATE VIEW

statement.

Definition at line 41 of file SqlCreateView.java.

Constructor & Destructor Documentation

com.mapd.parser.extension.ddl.SqlCreateView.SqlCreateView ( SqlParserPos  pos,
boolean  replace,
boolean  ifNotExists,
SqlIdentifier  name,
SqlNodeList  columnList,
SqlNode  query 
)
inlinepackage

Creates a SqlCreateView.

Definition at line 50 of file SqlCreateView.java.

References com.mapd.parser.extension.ddl.SqlCreateView.columnList, com.mapd.parser.extension.ddl.SqlCreateView.name, com.mapd.parser.extension.ddl.SqlCreateView.OPERATOR, and com.mapd.parser.extension.ddl.SqlCreateView.query.

55  {
56  super(OPERATOR, pos, replace, ifNotExists);
57  this.name = Objects.requireNonNull(name);
58  this.columnList = columnList; // may be null
59  this.query = Objects.requireNonNull(query);
60  }

Member Function Documentation

List<SqlNode> com.mapd.parser.extension.ddl.SqlCreateView.getOperandList ( )
inline
String com.mapd.parser.extension.ddl.SqlCreateView.toString ( )
inline

Definition at line 89 of file SqlCreateView.java.

89  {
90  EscapedStringJsonBuilder jsonBuilder = new EscapedStringJsonBuilder();
91  Map<String, Object> map = jsonBuilder.map();
92 
93  jsonBuilder.put(map, "name", this.name.toString());
94 
95  SqlWriterConfig c = SqlPrettyWriter.config()
96  .withDialect(CalciteSqlDialect.DEFAULT)
97  .withQuoteAllIdentifiers(false)
98  .withSelectListItemsOnSeparateLines(false)
99  .withWhereListItemsOnSeparateLines(false)
100  .withValuesListNewline(false);
101  SqlPrettyWriter writer = new SqlPrettyWriter(c);
102  this.query.unparse(writer, 0, 0);
103  jsonBuilder.put(map, "query", writer.toString());
104 
105  jsonBuilder.put(map, "ifNotExists", this.ifNotExists);
106 
107  map.put("command", "CREATE_VIEW");
108  Map<String, Object> payload = jsonBuilder.map();
109  payload.put("payload", map);
110  return jsonBuilder.toJsonString(payload);
111  }
void com.mapd.parser.extension.ddl.SqlCreateView.unparse ( SqlWriter  writer,
int  leftPrec,
int  rightPrec 
)
inline

Definition at line 67 of file SqlCreateView.java.

References com.mapd.parser.extension.ddl.SqlCreateView.columnList.

67  {
68  if (getReplace()) {
69  writer.keyword("CREATE OR REPLACE");
70  } else {
71  writer.keyword("CREATE");
72  }
73  writer.keyword("VIEW");
74  name.unparse(writer, leftPrec, rightPrec);
75  if (columnList != null) {
76  SqlWriter.Frame frame = writer.startList("(", ")");
77  for (SqlNode c : columnList) {
78  writer.sep(",");
79  c.unparse(writer, 0, 0);
80  }
81  writer.endList(frame);
82  }
83  writer.keyword("AS");
84  writer.newlineAndIndent();
85  query.unparse(writer, 0, 0);
86  }

Member Data Documentation

final SqlNodeList com.mapd.parser.extension.ddl.SqlCreateView.columnList
final SqlOperator com.mapd.parser.extension.ddl.SqlCreateView.OPERATOR
staticprivate
Initial value:
=
new SqlSpecialOperator("CREATE VIEW", SqlKind.CREATE_VIEW)

Definition at line 46 of file SqlCreateView.java.

Referenced by com.mapd.parser.extension.ddl.SqlCreateView.SqlCreateView().


The documentation for this class was generated from the following file: