コード例 #1
0
        public override bool UpdateDataQuerySelects(CallNode callNode, TexlBinding binding, DataSourceToQueryOptionsMap dataSourceToQueryOptionsMap)
        {
            Contracts.AssertValue(callNode);
            Contracts.AssertValue(binding);

            // Ignore delegation warning
            if (!CheckArgsCount(callNode, binding, DocumentErrorSeverity.Moderate))
            {
                return(false);
            }

            TexlNode[] args = callNode.Args.Children.VerifyValue();

            DType dsType = binding.GetType(args[0]);

            if (dsType.AssociatedDataSources == null)
            {
                return(false);
            }

            DType      columnType = binding.GetType(args[1]);
            StrLitNode columnNode = args[1].AsStrLit();

            if (columnType.Kind != DKind.String || columnNode == null)
            {
                return(false);
            }
            string columnName = columnNode.Value;

            Contracts.Assert(dsType.Contains(new DName(columnName)));

            return(dsType.AssociateDataSourcesToSelect(dataSourceToQueryOptionsMap, columnName, columnType, true));
        }
コード例 #2
0
        public override bool UpdateDataQuerySelects(CallNode callNode, TexlBinding binding, DataSourceToQueryOptionsMap dataSourceToQueryOptionsMap)
        {
            Contracts.AssertValue(callNode);
            Contracts.AssertValue(binding);

            if (!CheckArgsCount(callNode, binding))
            {
                return(false);
            }

            TexlNode[] args = callNode.Args.Children.VerifyValue();

            DType dsType = binding.GetType(args[0]);

            if (dsType.AssociatedDataSources == null)
            {
                return(false);
            }

            var resultType = binding.GetType(callNode).VerifyValue();

            bool retval = false;

            foreach (var typedName in resultType.GetNames(DPath.Root))
            {
                DType  columnType = typedName.Type;
                string columnName = typedName.Name.Value;

                Contracts.Assert(dsType.Contains(new DName(columnName)));

                retval |= dsType.AssociateDataSourcesToSelect(dataSourceToQueryOptionsMap, columnName, columnType, true);
            }
            return(retval);
        }
コード例 #3
0
        public override bool UpdateDataQuerySelects(CallNode callNode, TexlBinding binding, DataSourceToQueryOptionsMap dataSourceToQueryOptionsMap)
        {
            Contracts.AssertValue(callNode);
            Contracts.AssertValue(binding);

            if (!CheckArgsCount(callNode, binding, DocumentErrorSeverity.Moderate))
            {
                return(false);
            }

            TexlNode[] args = callNode.Args.Children.VerifyValue();

            DType dsType = binding.GetType(args[0]);

            if (dsType.AssociatedDataSources == null)
            {
                return(false);
            }

            bool retval = false;

            for (int i = 1; i < args.Length; i += 2)
            {
                DType      columnType = binding.GetType(args[i]);
                StrLitNode columnNode = args[i].AsStrLit();
                if (columnType.Kind != DKind.String || columnNode == null)
                {
                    continue;
                }
                string columnName = columnNode.Value;

                Contracts.Assert(dsType.Contains(new DName(columnName)));

                retval |= dsType.AssociateDataSourcesToSelect(dataSourceToQueryOptionsMap, columnName, columnType, true);
            }
            return(retval);
        }