Example #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"));
        }
Example #2
0
        private IFunctionData UpdateToVersion2(IFunctionData data)
        {
            IPropertyData parametersProperty;

            if (data.TryFindPropertyById(ExecuteStoredProcedureShared.ParametersPropertyName, out parametersProperty))
            {
                DatabaseModel.ProcedureParameters parameterValues = parametersProperty.Value as DatabaseModel.ProcedureParameters;
                if (parameterValues != null)
                {
                    foreach (DatabaseModel.ProcedureParameter parameter in parameterValues)
                    {
                        IPropertyData parameterProperty;
                        if (data.TryFindPropertyById(parameter.Name, out parameterProperty))
                        {
                            data = data.UpdateProperty(parameterProperty,
                                                       parameter.DisplayPropertyId, parameter.DisplayPropertyName, parameterProperty.TypeReference, parameterProperty.Value, parameterProperty.IsVisible, parameterProperty.ValueUsage);
                        }
                    }
                }
            }

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