예제 #1
0
        public static CreateViewStatement Create(PlSqlParser.CreateViewStatementContext context)
        {
            var orReplace = context.OR() != null && context.REPLACE() != null;

            var viewName = Name.Object(context.objectName());
            var query = (SqlQueryExpression) Expression.Build(context.subquery());

            string[] columnNames = null;
            if (context.columnList() != null) {
                columnNames = context.columnList().columnName().Select(Name.Simple).ToArray();
            }

            return new CreateViewStatement(viewName, columnNames, query) {
                ReplaceIfExists = orReplace
            };
        }