OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 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  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.

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

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 83 of file SqlCreateView.java.

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

Definition at line 66 of file SqlCreateView.java.

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

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

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: