Beispiel #1
0
 public DescribeResultSetContainer(DescribeResultSetRow describeResultSetRow, SqlSysType userDefinedType,
                                   SqlSysType systemType)
 {
     DescribeResultSetRow = describeResultSetRow;
     UserDefinedType      = userDefinedType;
     SystemType           = systemType;
 }
Beispiel #2
0
    public static List <DescribeResultSetContainer> GetDescribeResultSetContainers(ISqlConnectionProvider sqlConnectionProvider, string sqlQuery)
    {
        var resultColumns = GetQueryResultColumns(sqlConnectionProvider, sqlQuery);
        var sqlTypeList   = GetSysTypesFromDatabase(sqlConnectionProvider, resultColumns);


        var describeResultSetContainers = new List <DescribeResultSetContainer>();

        foreach (var describeResultSetRow in resultColumns)
        {
            SqlSysType userDefinedType = null;
            SqlSysType systemType      = null;
            if (describeResultSetRow.user_type_id.HasValue)
            {
                userDefinedType =
                    sqlTypeList.Single(x => x.user_type_id == describeResultSetRow.user_type_id);

                try
                {
                    if (SqlTypes.IsSpecialSystemType(describeResultSetRow.user_type_name))
                    {
                        systemType = sqlTypeList
                                     .Single(x => x.system_type_id == describeResultSetRow.system_type_id &&
                                             x.user_type_id == describeResultSetRow.user_type_id);
                    }
                    else
                    {
                        systemType = sqlTypeList
                                     .Single(x => x.system_type_id == describeResultSetRow.system_type_id &&
                                             x.user_type_id == describeResultSetRow.system_type_id);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            else
            {
                systemType = sqlTypeList
                             .Single(x => x.system_type_id == describeResultSetRow.system_type_id &&
                                     x.user_type_id == describeResultSetRow.system_type_id);
            }

            var describeResultSetContainer = new DescribeResultSetContainer(
                describeResultSetRow,
                userDefinedType,
                systemType);
            describeResultSetContainers.Add(describeResultSetContainer);
        }
        return(describeResultSetContainers);
    }
Beispiel #3
0
 public DescribeResultSetContainer(DescribeResultSetRow describeResultSetRow, SqlSysType systemType)
 {
     DescribeResultSetRow = describeResultSetRow;
     SystemType           = systemType;
 }