Esempio n. 1
0
        private IFunctionData UpdateToVersion3(IFunctionData data)
        {
            var resultTypeProperty = data.Properties[ExecuteSQLShared.ResultTypePropertyName];

            var resultTypeValue = resultTypeProperty.GetValue <ResultType>();
            var requireUpdate   = false;

            foreach (var field in resultTypeValue.Fields)
            {
                if (field.Type == typeof(Int32))
                {
                    field.Type    = typeof(Int64);
                    requireUpdate = true;
                }
            }

            if (requireUpdate)
            {
                data = data.UpdateProperty(resultTypeProperty, resultTypeProperty.Id, resultTypeProperty.Name, resultTypeProperty.TypeReference, resultTypeValue, resultTypeProperty.IsVisible, resultTypeProperty.ValueUsage);

                var returnTypeValue = resultTypeValue.BuildRowTypeFromFields();
                if (returnTypeValue != null)
                {
                    if (data.Output != null)
                    {
                        if (data.Output.IsList)
                        {
                            data = data.UpdateOutput(TypeReference.CreateList(returnTypeValue));
                        }
                        else
                        {
                            data = data.UpdateOutput(returnTypeValue);
                        }
                    }

                    IExecutionPathData executionPath;
                    if (data.TryFindExecutionPathByKey("ForEachRow", out executionPath) && executionPath.Output != null)
                    {
                        data = data.UpdateExecutionPath(executionPath, executionPath.Key, executionPath.Name, returnTypeValue, executionPath.IterationHint);
                    }
                }
            }

            return(data.UpdateVersion("3"));
        }