本文整理汇总了C#中Microsoft.SqlServer.Server.SmiMetaData类的典型用法代码示例。如果您正苦于以下问题:C# SmiMetaData类的具体用法?C# SmiMetaData怎么用?C# SmiMetaData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SmiMetaData类属于Microsoft.SqlServer.Server命名空间,在下文中一共展示了SmiMetaData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBytesConversion
private static long GetBytesConversion(SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData, long fieldOffset, byte[] buffer, int bufferOffset, int length, bool throwOnNull) {
object obj = GetSqlValue( sink, getters, ordinal, metaData, null );
if (null == obj) {
throw ADP.InvalidCast();
}
SqlBinary value = (SqlBinary) obj;
if (value.IsNull) {
if (throwOnNull) {
throw SQL.SqlNullValue();
}
else {
// return zero length in any case
return 0;
}
}
if ( null == buffer ) {
return value.Length;
}
length = CheckXetParameters( metaData.SqlDbType, metaData.MaxLength * sizeof(char), value.Length,
fieldOffset, buffer.Length, bufferOffset, length );
Array.Copy( value.Value, checked((int)fieldOffset), buffer, bufferOffset, length );
return length;
}
示例2: TdsValueSetter
internal TdsValueSetter(TdsParserStateObject stateObj, SmiMetaData md)
{
this._stateObj = stateObj;
this._metaData = md;
this._isPlp = MetaDataUtilsSmi.IsPlpFormat(md);
this._plpUnknownSent = false;
this._encoder = null;
}
示例3: SmiSettersStream
internal SmiSettersStream(SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData)
{
this._sink = sink;
this._setters = setters;
this._ordinal = ordinal;
this._lengthWritten = 0L;
this._metaData = metaData;
}
示例4: SmiGettersStream
internal SmiGettersStream(SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData)
{
this._sink = sink;
this._getters = getters;
this._ordinal = ordinal;
this._readPosition = 0L;
this._metaData = metaData;
}
示例5: MemoryRecordBuffer
internal MemoryRecordBuffer(SmiMetaData[] metaData) {
Debug.Assert(null != metaData, "invalid attempt to instantiate MemoryRecordBuffer with null SmiMetaData[]");
_buffer = new SqlRecordBuffer[metaData.Length];
for (int i = 0; i < _buffer.Length; ++i) {
_buffer[i] = new SqlRecordBuffer(metaData[i]);
}
}
示例6: TdsRecordBufferSetter
internal TdsRecordBufferSetter(TdsParserStateObject stateObj, SmiMetaData md)
{
this._fieldSetters = new TdsValueSetter[md.FieldMetaData.Count];
for (int i = 0; i < md.FieldMetaData.Count; i++)
{
this._fieldSetters[i] = new TdsValueSetter(stateObj, md.FieldMetaData[i]);
}
this._stateObj = stateObj;
this._metaData = md;
}
示例7: TdsValueSetter
private int _currentOffset; // for chunking, verify that caller is using correct offsets
#endif
#endregion
#region Exposed Construct/factory methods
internal TdsValueSetter(TdsParserStateObject stateObj, SmiMetaData md) {
_stateObj = stateObj;
_metaData = md;
_isPlp = MetaDataUtilsSmi.IsPlpFormat(md);
_plpUnknownSent = false;
_encoder = null;
#if DEBUG
_currentOffset = 0;
#endif
}
示例8: GetByte
internal static byte GetByte( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
ThrowIfITypedGettersIsNull( sink, getters, ordinal );
if ( CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.Byte ) ) {
return GetByte_Unchecked( sink, getters, ordinal );
}
object result = GetValue( sink, getters, ordinal, metaData, null );
if (null == result) {
throw ADP.InvalidCast();
}
return (Byte)result;
}
示例9: SmiGettersStream
internal SmiGettersStream( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
Debug.Assert( null != sink );
Debug.Assert( null != getters );
Debug.Assert( 0 <= ordinal );
Debug.Assert( null != metaData );
_sink = sink;
_getters = getters;
_ordinal = ordinal;
_readPosition = 0;
_metaData = metaData;
}
示例10: TdsRecordBufferSetter
private int _currentField; // validate that caller sets columns in correct order.
#endif
#endregion
#region Exposed Construct and control methods/properties
internal TdsRecordBufferSetter(TdsParserStateObject stateObj, SmiMetaData md) {
Debug.Assert(SqlDbType.Structured == md.SqlDbType, "Unsupported SqlDbType: " + md.SqlDbType);
_fieldSetters = new TdsValueSetter[md.FieldMetaData.Count];
for(int i=0; i<md.FieldMetaData.Count; i++) {
_fieldSetters[i] = new TdsValueSetter(stateObj, md.FieldMetaData[i]);
}
_stateObj = stateObj;
_metaData = md;
#if DEBUG
_currentField = ReadyForToken;
#endif
}
示例11: SmiSettersStream
internal SmiSettersStream( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData ) {
Debug.Assert( null != sink );
Debug.Assert( null != setters );
Debug.Assert( 0 <= ordinal );
Debug.Assert( null != metaData );
_sink = sink;
_setters = setters;
_ordinal = ordinal;
_lengthWritten = 0;
_metaData = metaData;
}
示例12: GetSqlXml
internal static SqlXml GetSqlXml( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData, SmiContext context ) {
SqlXml result;
if ( CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.SqlXml ) ) {
if ( IsDBNull_Unchecked( sink, getters, ordinal ) ) {
result = SqlXml.Null;
}
else {
result = GetSqlXml_Unchecked( sink, getters, ordinal, context );
}
}
else {
object obj = GetSqlValue( sink, getters, ordinal, metaData, null );
if (null == obj) {
throw ADP.InvalidCast();
}
result = (SqlXml) obj;
}
return result;
}
示例13: GetSqlString
internal static SqlString GetSqlString( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
SqlString result;
if ( CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.SqlString ) ) {
if ( IsDBNull_Unchecked( sink, getters, ordinal ) ) {
result = SqlString.Null;
}
else {
String temp = GetString_Unchecked( sink, getters, ordinal );
result = new SqlString( temp );
}
}
else if (SqlDbType.Xml == metaData.SqlDbType) {
SqlXml xmlValue = GetSqlXml_Unchecked( sink, getters, ordinal, null );
if (xmlValue.IsNull) {
result = SqlString.Null;
}
else {
result = new SqlString( xmlValue.Value );
}
}
else {
object obj = GetSqlValue( sink, getters, ordinal, metaData, null );
if (null == obj) {
throw ADP.InvalidCast();
}
result = (SqlString) obj;
}
return result;
}
示例14: GetTimeSpan
// dealing with v200 SMI
internal static TimeSpan GetTimeSpan(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal, SmiMetaData metaData) {
ThrowIfITypedGettersIsNull(sink, getters, ordinal);
if (CanAccessGetterDirectly(metaData, ExtendedClrTypeCode.TimeSpan)) {
return GetTimeSpan_Unchecked(sink, getters, ordinal);
}
return (TimeSpan)GetValue200(sink, getters, ordinal, metaData, null);
}
示例15: GetTextReader
internal static TextReader GetTextReader( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
bool isDbNull = ValueUtilsSmi.IsDBNull_Unchecked(sink, getters, ordinal);
// If a sql_variant, get the internal type
if ((!isDbNull) && (metaData.SqlDbType == SqlDbType.Variant)) {
metaData = getters.GetVariantType(sink, ordinal);
}
// If the SqlDbType is still variant, then it must contain null, so don't throw InvalidCast
if ((metaData.SqlDbType != SqlDbType.Variant) && (!CanAccessGetterDirectly(metaData, ExtendedClrTypeCode.TextReader))) {
throw ADP.InvalidCast();
}
string data;
if (isDbNull) {
// "null" textreader
data = string.Empty;
}
else {
// Read all data
data = GetString_Unchecked(sink, getters, ordinal);
}
// Wrap in pre-built object
return new StringReader(data);
}