private void SelectFunction(IFunctionReference function)
        {
            //Ditch the parameters
            _parameters.Clear();

            Function = function;

            if (function != null)
            {
                _model.FunctionId = function.Id;

                if (function.Arguments != null)
                {
                    int parameterIndex = 0;

                    foreach (var argument in function.Arguments)
                    {
                        //Create the parameter
                        var parameter = _owner.CreateParameter(
                            parameterIndex.ToString(),
                            _owner.GetVplTypeOrThrow(argument.TypeId),
                            argument.Name);

                        _parameters.Add(parameter);

                        parameterIndex++;
                    }
                }
            }
        }
示例#2
0
        protected void ResolveFunctionReference(IFunctionReference node)
        {
            // *** TODO: handle sys function here
            if (!node.FunctionReference.IsUdf)
            {
                if (!IsSystemFunctionName(node.FunctionReference.SystemFunctionName))
                {
                    throw CreateException(ExceptionMessages.UnknownFunctionName, null, node.FunctionReference.SystemFunctionName, (Node)node);
                }
            }
            else
            {
                // Check if dataset specified and make sure it's valid
                if (node.FunctionReference.DatasetName != null)
                {
                    if (!schemaManager.Datasets.ContainsKey(node.FunctionReference.DatasetName))
                    {
                        throw CreateException(ExceptionMessages.UnresolvableDatasetReference, null, node.FunctionReference.DatasetName, (Node)node);
                    }
                }

                var ds = schemaManager.Datasets[node.FunctionReference.DatasetName];

                var dbo = ds.GetObject(node.FunctionReference.DatabaseName, node.FunctionReference.SchemaName, node.FunctionReference.DatabaseObjectName);

                if (dbo == null)
                {
                    throw CreateException(ExceptionMessages.UnresolvableTableReference, null, node.FunctionReference.DatabaseObjectName, (Node)node);
                }

                node.FunctionReference.DatabaseObject = dbo;
            }
        }
示例#3
0
        protected void ResolveFunctionReference(IFunctionReference node)
        {
            // *** TODO: handle sys function here
            if (!node.FunctionReference.IsUdf)
            {
                if (!IsSystemFunctionName(node.FunctionReference.SystemFunctionName))
                {
                    throw CreateException(ExceptionMessages.UnknownFunctionName, null, node.FunctionReference.SystemFunctionName, (Node)node);
                }
            }
            else
            {
                // Check if dataset specified and make sure it's valid
                if (node.FunctionReference.DatasetName != null)
                {
                    if (!schemaManager.Datasets.ContainsKey(node.FunctionReference.DatasetName))
                    {
                        throw CreateException(ExceptionMessages.UnresolvableDatasetReference, null, node.FunctionReference.DatasetName, (Node)node);
                    }
                }

                var ds = schemaManager.Datasets[node.FunctionReference.DatasetName];

                node.FunctionReference.DatabaseObject = ds.GetObject(node.FunctionReference.DatabaseName, node.FunctionReference.SchemaName, node.FunctionReference.DatabaseObjectName);
            }
        }
示例#4
0
        private void SelectFunction(IFunctionReference function)
        {
            //Ditch the parameters
            _parameters.Clear();

            Function = function;

            if (function != null)
            {
                _model.FunctionId = function.Id;

                if (function.Arguments != null)
                {
                    int parameterIndex = 0;

                    foreach (var argument in function.Arguments)
                    {
                        //Create the parameter
                        var parameter = _owner.CreateParameter(
                            parameterIndex.ToString(),
                            _owner.GetVplTypeOrThrow(argument.TypeId), 
                            argument.Name);

                        _parameters.Add(parameter);

                        parameterIndex++;
                    }
                }
            }
        }