Inheritance: WSqlFragment
コード例 #1
0
        public override void Visit(WMatchPath node)
        {
            foreach (var sourceEdge in node.PathEdgeList)
            {
                WSchemaObjectName source            = sourceEdge.Item1;
                string            tableAlias        = source.BaseIdentifier.Value;
                WEdgeColumnReferenceExpression edge = sourceEdge.Item2;

                if (accessedColumns.ContainsKey(tableAlias))
                {
                    switch (edge.EdgeType)
                    {
                    case WEdgeType.OutEdge:
                        accessedColumns[tableAlias].Add(ColumnGraphType.OutAdjacencyList.ToString());
                        break;

                    case WEdgeType.InEdge:
                        accessedColumns[tableAlias].Add(ColumnGraphType.InAdjacencyList.ToString());
                        break;

                    case WEdgeType.BothEdge:
                        accessedColumns[tableAlias].Add(ColumnGraphType.BothAdjacencyList.ToString());
                        break;

                    default:
                        break;
                    }
                }
            }
        }
コード例 #2
0
 public virtual void Visit(WMatchPath node)
 {
     node.AcceptChildren(this);
 }
コード例 #3
0
ファイル: GraphViewParser.cs プロジェクト: champmit/GraphView
        private static bool ParseMatchPath(
            IList<TSqlParserToken> tokens,
            ref int nextToken,
            ref WMatchPath result,
            ref int farestError)
        {
            var currentToken = nextToken;
            var firstToken = nextToken;

            var nodeList = new List<Tuple<WSchemaObjectName, WEdgeColumnReferenceExpression>>();

            Tuple<WSchemaObjectName, WEdgeColumnReferenceExpression> tuple = null;
            while (ParseMatchPathPart(tokens, ref currentToken, ref tuple, ref farestError))
            {
                if (nodeList.Count > 0)
                {
                    var preTuple = nodeList.Last();
                    if (preTuple.Item2.Alias == null)
                    {
                        preTuple.Item2.Alias = String.Format(CultureInfo.CurrentCulture, "{0}_{1}_{2}",
                            preTuple.Item1.BaseIdentifier.Value,
                            preTuple.Item2.MultiPartIdentifier.Identifiers.Last().Value,
                            tuple.Item1.BaseIdentifier.Value);
                        preTuple.Item2.AliasRole = AliasType.Default;
                    }

                    
                }
                nodeList.Add(tuple);
            }

            if (nodeList.Count == 0)
                return false;

            WSchemaObjectName tail = null;

            if (!ParseSchemaObjectName(tokens, ref currentToken, ref tail, ref farestError))
                return false;

            var lastTuple = nodeList.Last();
            if (lastTuple.Item2.Alias == null)
            {
                lastTuple.Item2.Alias = String.Format(CultureInfo.CurrentCulture, "{0}_{1}_{2}", lastTuple.Item1.BaseIdentifier.Value,
                        lastTuple.Item2.MultiPartIdentifier.Identifiers.Last().Value, tail.BaseIdentifier.Value);
                lastTuple.Item2.AliasRole = AliasType.Default;
            }

            result = new WMatchPath
            {
                PathNodeList = nodeList,
                Tail = tail,
                FirstTokenIndex = firstToken,
                LastTokenIndex = currentToken - 1
            };
            nextToken = currentToken;
            return true;
        }
コード例 #4
0
 public virtual void Visit(WMatchPath node)
 {
     node.AcceptChildren(this);
 }
コード例 #5
0
        private static bool ParseMatchPath(
            IList<TSqlParserToken> tokens,
            ref int nextToken,
            ref WMatchPath result,
            ref int farestError)
        {
            var currentToken = nextToken;
            var firstToken = nextToken;

            var nodeList = new List<Tuple<WSchemaObjectName, WEdgeColumnReferenceExpression>>();

            Tuple<WSchemaObjectName, WEdgeColumnReferenceExpression> tuple = null;
            while (ParseMatchPathPart(tokens, ref currentToken, ref tuple, ref farestError))
            {
                nodeList.Add(tuple);
            }

            if (nodeList.Count == 0)
                return false;

            WSchemaObjectName tail = null;

            if (!ParseSchemaObjectName(tokens, ref currentToken, ref tail, ref farestError))
                return false;

            result = new WMatchPath
            {
                PathEdgeList = nodeList,
                Tail = tail,
                FirstTokenIndex = firstToken,
                LastTokenIndex = currentToken - 1
            };
            nextToken = currentToken;
            return true;
        }