当前位置: 首页>>代码示例>>C#>>正文


C# SmiTypedGetterSetter.GetVariantType方法代码示例

本文整理汇总了C#中Microsoft.SqlServer.Server.SmiTypedGetterSetter.GetVariantType方法的典型用法代码示例。如果您正苦于以下问题:C# SmiTypedGetterSetter.GetVariantType方法的具体用法?C# SmiTypedGetterSetter.GetVariantType怎么用?C# SmiTypedGetterSetter.GetVariantType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.SqlServer.Server.SmiTypedGetterSetter的用法示例。


在下文中一共展示了SmiTypedGetterSetter.GetVariantType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSqlValue200

        // dealing with v200 SMI
        internal static object GetSqlValue200(
            SmiEventSink_Default sink,
            SmiTypedGetterSetter getters,
            int ordinal,
            SmiMetaData metaData,
            SmiContext context
            ) {
            object result = null;
            if (IsDBNull_Unchecked(sink, getters, ordinal)) {
                if (SqlDbType.Udt == metaData.SqlDbType) {
                    result = NullUdtInstance(metaData);
                } else {
                    result = __typeSpecificNullForSqlValue[(int)metaData.SqlDbType];
                }
            } else {
                switch (metaData.SqlDbType) {
                    case SqlDbType.Variant: // Handle variants specifically for v200, since they could contain v200 types
                        metaData = getters.GetVariantType(sink, ordinal);
                        sink.ProcessMessagesAndThrow();
                        Debug.Assert(SqlDbType.Variant != metaData.SqlDbType, "Variant-within-variant causes endless recursion!");
                        result = GetSqlValue200(sink, getters, ordinal, metaData, context);
                        break;
                    case SqlDbType.Date:
                    case SqlDbType.DateTime2:
                        result = GetDateTime_Unchecked(sink, getters, ordinal);
                        break;
                    case SqlDbType.Time:
                        result = GetTimeSpan_Unchecked(sink, getters, ordinal);
                        break;
                    case SqlDbType.DateTimeOffset:
                        result = GetDateTimeOffset_Unchecked(sink, getters, ordinal);
                        break;
                    default:
                        result = GetSqlValue(sink, getters, ordinal, metaData, context);
                        break;
                }
            }

            return result;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:41,代码来源:ValueUtilsSmi.cs

示例2: GetValue200

        internal static object GetValue200(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal, SmiMetaData metaData, SmiContext context)
        {
            if (IsDBNull_Unchecked(sink, getters, ordinal))
            {
                return DBNull.Value;
            }
            switch (metaData.SqlDbType)
            {
                case SqlDbType.Date:
                case SqlDbType.DateTime2:
                    return GetDateTime_Unchecked(sink, getters, ordinal);

                case SqlDbType.Time:
                    return GetTimeSpan_Unchecked(sink, getters, ordinal);

                case SqlDbType.DateTimeOffset:
                    return GetDateTimeOffset_Unchecked(sink, getters, ordinal);

                case SqlDbType.Variant:
                    metaData = getters.GetVariantType(sink, ordinal);
                    sink.ProcessMessagesAndThrow();
                    return GetValue200(sink, getters, ordinal, metaData, context);
            }
            return GetValue(sink, getters, ordinal, metaData, context);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:ValueUtilsSmi.cs

示例3: GetOutputParameterV200Smi

        // UDTs and null variants come back via return value, all else is via targetBuffer.
        //  implements SqlClient 1.1-compatible output parameter semantics
        internal static object GetOutputParameterV200Smi(
            SmiEventSink_Default    sink,                   // event sink for errors
            SmiTypedGetterSetter    getters,                // getters interface to grab value from
            int                     ordinal,                // parameter within getters
            SmiMetaData             metaData,               // Getter's type for this ordinal
            SmiContext              context,                // used to obtain scratch streams
            SqlBuffer               targetBuffer            // destination
            ) {
            object result = null;   // Workaround for UDT hack in non-Smi code paths.
            if ( IsDBNull_Unchecked( sink, getters, ordinal ) ) {
                GetNullOutputParameterSmi(metaData, targetBuffer, ref result);
            }
            else {
                switch(metaData.SqlDbType) {
                    // new types go here
                    case SqlDbType.Variant: // Handle variants specifically for v200, since they could contain v200 types
                        // For variants, recur using the current value's sqldbtype
                        metaData = getters.GetVariantType( sink, ordinal );
                        sink.ProcessMessagesAndThrow();
                        Debug.Assert( SqlDbType.Variant != metaData.SqlDbType, "Variant-within-variant not supposed to be possible!" );
                        GetOutputParameterV200Smi( sink, getters, ordinal, metaData, context, targetBuffer );
                        break;
                    case SqlDbType.Date:
                        targetBuffer.SetToDate(GetDateTime_Unchecked(sink, getters, ordinal));
                        break;
                    case SqlDbType.DateTime2:
                        targetBuffer.SetToDateTime2(GetDateTime_Unchecked(sink, getters, ordinal), metaData.Scale);
                        break;
                    case SqlDbType.Time:
                        targetBuffer.SetToTime(GetTimeSpan_Unchecked(sink, getters, ordinal), metaData.Scale);
                        break;
                    case SqlDbType.DateTimeOffset:
                        targetBuffer.SetToDateTimeOffset(GetDateTimeOffset_Unchecked(sink, getters, ordinal), metaData.Scale);
                        break;
                    default:
                        result = GetOutputParameterV3Smi(sink, getters, ordinal, metaData, context, targetBuffer);
                        break;
                }
            }

            return result;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:44,代码来源:ValueUtilsSmi.cs

示例4: GetOutputParameterV200Smi

        internal static object GetOutputParameterV200Smi(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal, SmiMetaData metaData, SmiContext context, SqlBuffer targetBuffer)
        {
            object result = null;
            if (IsDBNull_Unchecked(sink, getters, ordinal))
            {
                GetNullOutputParameterSmi(metaData, targetBuffer, ref result);
                return result;
            }
            switch (metaData.SqlDbType)
            {
                case SqlDbType.Date:
                    targetBuffer.SetToDate(GetDateTime_Unchecked(sink, getters, ordinal));
                    return result;

                case SqlDbType.Time:
                    targetBuffer.SetToTime(GetTimeSpan_Unchecked(sink, getters, ordinal), metaData.Scale);
                    return result;

                case SqlDbType.DateTime2:
                    targetBuffer.SetToDateTime2(GetDateTime_Unchecked(sink, getters, ordinal), metaData.Scale);
                    return result;

                case SqlDbType.DateTimeOffset:
                    targetBuffer.SetToDateTimeOffset(GetDateTimeOffset_Unchecked(sink, getters, ordinal), metaData.Scale);
                    return result;

                case SqlDbType.Variant:
                    metaData = getters.GetVariantType(sink, ordinal);
                    sink.ProcessMessagesAndThrow();
                    GetOutputParameterV200Smi(sink, getters, ordinal, metaData, context, targetBuffer);
                    return result;
            }
            return GetOutputParameterV3Smi(sink, getters, ordinal, metaData, context, targetBuffer);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:ValueUtilsSmi.cs


注:本文中的Microsoft.SqlServer.Server.SmiTypedGetterSetter.GetVariantType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。