private void ProcessRtes(QueryTreeDataInternal result, JToken query)
        {
            var rTable = query.SelectToken("QUERY.rtable");

            foreach (var child in rTable.Children())
            {
                var rte      = child.SelectToken("RTE");
                Rte rteToAdd = new Rte();
                rteToAdd.RteKind = EnumParsingSupport.ConvertFromNumericOrDefault <RteKind>(rte.SelectToken("rtekind").Value <int>());
                switch (rteToAdd.RteKind)
                {
                case RteKind.Relation:
                {
                    rteToAdd.RelId   = rte.SelectToken("relid").Value <uint>();
                    rteToAdd.RelKind = EnumParsingSupport.ConvertUsingAttributeOrDefault <RelKind, EnumMemberAttribute, string>(rte.SelectToken("relkind").Value <string>(), x => x.Value);
                }
                break;

                case RteKind.Subquery:
                {
                    rteToAdd.SubQuery = ProcessQuery(result, rte.SelectToken("subquery"));
                }
                break;

                case RteKind.Join:
                {
                    rteToAdd.JoinType = EnumParsingSupport.ConvertFromNumericOrDefault <JoinType>(rte.SelectToken("jointype").Value <int>());
                    foreach (var expr in rte.SelectToken("joinaliasvars").Children())
                    {
                        rteToAdd.JoinVars.Add(ResolveExpression(result, expr));
                    }
                }
                break;

                case RteKind.Function:
                    break;

                case RteKind.TableFunc:
                    break;

                case RteKind.Values:
                    break;

                case RteKind.CTE:
                {
                    rteToAdd.CteName = rte.SelectToken("ctename").Value <string>();
                }
                break;

                case RteKind.NamedTupleStore:
                    break;
                }
                result.Rtes.Add(rteToAdd);
            }
        }
Beispiel #2
0
        private void ProcessRtes(QueryTreeDataInternal result, JToken query)
        {
            var rTable = query.SelectToken("..rtable");

            foreach (var child in rTable.Children())
            {
                var rte      = child.SelectToken("RTE");
                Rte rteToAdd = new Rte();
                rteToAdd.RteKind = EnumParsingSupport.ConvertFromNumericOrDefault <RteKind>(rte.SelectToken("rtekind").Value <int>());
                switch (rteToAdd.RteKind)
                {
                case RteKind.Relation:
                {
                    rteToAdd.RelId   = rte.SelectToken("relid").Value <uint>();
                    rteToAdd.RelKind = EnumParsingSupport.ConvertUsingAttributeOrDefault <RelKind, EnumMemberAttribute, string>(rte.SelectToken("relkind").Value <string>(), x => x.Value);
                }
                break;
                }
                result.Rtes.Add(rteToAdd);
            }
        }