本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}