DataType() public static method

public static DataType ( DataTypeReference dtype ) : string
dtype DataTypeReference
return string
Exemplo n.º 1
0
        protected string ParameterListToString(string indent)
        {
            if (Parameters == null || Parameters.Count == 0)
            {
                return("");
            }

            var sb = new StringBuilder(1024);

            var i = 0;

            while (Parameters != null && i < Parameters.Count)
            {
                sb.AppendFormat("{0}{1} {2}", indent, Parameters[i].VariableName.Value,
                                TsqlFragmentToString.DataType(Parameters[i].DataType));

                if (i < Parameters.Count - 1)
                {
                    sb.Append(",\r\n");
                }

                i++;
            }

            return(sb.ToString());
        }
Exemplo n.º 2
0
        protected string FunctionBodyToString(string indent)
        {
            var sb = new StringBuilder();

            switch (ReturnType.GetType().Name)
            {
            case "WScalarFunctionReturnType":
            {
                var sftype = ReturnType as WScalarFunctionReturnType;

                sb.AppendFormat("{0}RETURNS {1}\r\n", indent, TsqlFragmentToString.DataType(sftype.DataType));
                sb.AppendFormat("{0}AS\r\n", indent);
                sb.Append(StatementListToString(StatementList, indent));

                break;
            }

            case "WSelectFunctionReturnType":
            {
                sb.AppendFormat("{0}RETURNS TABLE\r\n", indent);
                sb.AppendFormat("{0}RETURN (\r\n", indent);
                sb.AppendFormat(CultureInfo.CurrentCulture, StatementListToString(StatementList, indent));
                sb.Append("\r\n");
                sb.AppendFormat("{0});", indent);

                break;
            }

            case "WTableValuedFunctionReturnType":
            {
                break;
            }

            default:
                break;
            }

            return(sb.ToString());
        }