示例#1
0
        private async Task <TItem> CreatePlanItem(OracleDataReader reader, ICollection <int> inactiveMap, CancellationToken cancellationToken)
        {
            var time       = OracleReaderValueConvert.ToDouble(reader["TIME"]);
            var otherData  = OracleReaderValueConvert.ToString(await reader.GetValueAsynchronous(reader.GetOrdinal("OTHER_XML"), cancellationToken));
            var objectName = OracleReaderValueConvert.ToString(reader["OBJECT_NAME"]);

            var item =
                new TItem
            {
                Id          = Convert.ToInt32(reader["ID"]),
                ParentId    = OracleReaderValueConvert.ToInt32(reader["PARENT_ID"]),
                Depth       = Convert.ToInt32(reader["DEPTH"]),
                Operation   = (string)reader["OPERATION"],
                Options     = OracleReaderValueConvert.ToString(reader["OPTIONS"]),
                Optimizer   = OracleReaderValueConvert.ToString(reader["OPTIMIZER"]),
                ObjectOwner =
                    objectName.StartsWith(":TQ")
                                                        ? String.Empty
                                                        : OracleReaderValueConvert.ToString(reader["OBJECT_OWNER"]),
                ObjectName       = objectName,
                ObjectAlias      = OracleReaderValueConvert.ToString(reader["OBJECT_ALIAS"]),
                ObjectType       = OracleReaderValueConvert.ToString(reader["OBJECT_TYPE"]),
                Cost             = OracleReaderValueConvert.ToDecimal(reader["COST"]),
                Cardinality      = OracleReaderValueConvert.ToDecimal(reader["CARDINALITY"]),
                Bytes            = OracleReaderValueConvert.ToDecimal(reader["BYTES"]),
                PartitionStart   = OracleReaderValueConvert.ToString(reader["PARTITION_START"]),
                PartitionStop    = OracleReaderValueConvert.ToString(reader["PARTITION_STOP"]),
                Distribution     = OracleReaderValueConvert.ToString(reader["DISTRIBUTION"]),
                CpuCost          = OracleReaderValueConvert.ToDecimal(reader["CPU_COST"]),
                IoCost           = OracleReaderValueConvert.ToDecimal(reader["IO_COST"]),
                TempSpace        = OracleReaderValueConvert.ToDecimal(reader["TEMP_SPACE"]),
                AccessPredicates = OracleReaderValueConvert.ToString(reader["ACCESS_PREDICATES"]),
                FilterPredicates = OracleReaderValueConvert.ToString(reader["FILTER_PREDICATES"]),
                Time             =
                    time.HasValue
                                                        ? time.Value > TimeSpan.MaxValue.TotalSeconds
                                                                ? TimeSpan.MaxValue
                                                                : TimeSpan.FromSeconds(time.Value)
                                                        : (TimeSpan?)null,
                QueryBlockName = OracleReaderValueConvert.ToString(reader["QBLOCK_NAME"]),
                Other          = String.IsNullOrEmpty(otherData) ? null : XElement.Parse(otherData)
            };

            ResolveInactiveNodes(item, inactiveMap);

            FillData(reader, item);

            return(item);
        }