Exemplo n.º 1
0
            private static TableRef FormTableRef(PlSqlParser.TableRefContext context)
            {
                var source = FormSource(context.dml_table_expression_clause());
                var joinNodes = context.joinClause().Select(FormJoinNode);

                return new TableRef {
                    Source = source,
                    Join = joinNodes.ToArray()
                };
            }
Exemplo n.º 2
0
            private static JoinNode FormJoinNode(PlSqlParser.JoinClauseContext context)
            {
                JoinType joinType;
                if (context.INNER() != null) {
                    joinType = JoinType.Inner;
                } else if (context.outerJoinType() != null) {
                    if (context.outerJoinType().FULL() != null) {
                        joinType = JoinType.Full;
                    } else if (context.outerJoinType().LEFT() != null) {
                        joinType = JoinType.Left;
                    } else if (context.outerJoinType().RIGHT() != null) {
                        joinType = JoinType.Right;
                    } else {
                        throw new ParseCanceledException("Invalid outer join type");
                    }
                } else {
                    throw new ParseCanceledException("Invalid join type");
                }

                var onPart = context.joinOnPart();
                if (onPart.IsEmpty)
                    throw new ParseCanceledException("None ON expression found in JOIN clause");

                var onExp = new SqlExpressionVisitor().Visit(onPart.condition());
                var source = FormSource(context.dml_table_expression_clause());

                return new JoinNode {
                    JoinType = joinType,
                    OnExpression = onExp,
                    Source = source
                };
            }