Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Data / Microsoft / SqlServer / Server / SmiTypedGetterSetter.cs / 1 / SmiTypedGetterSetter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace Microsoft.SqlServer.Server { using System; using System.Data; using System.Data.SqlTypes; // Central interface for getting/setting data values from/to a set of values indexed by ordinal // (record, row, array, etc) // Which methods are allowed to be called depends on SmiMetaData type of data offset. internal abstract class SmiTypedGetterSetter : ITypedGettersV3, ITypedSettersV3 { #region Read/Write // Are calls to Get methods allowed? internal abstract bool CanGet { get; } // Are calls to Set methods allowed? internal abstract bool CanSet { get; } #endregion #region Getters // Null test // valid for all types public virtual bool IsDBNull(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // Check what type current sql_variant value is // valid for SqlDbType.Variant public virtual SmiMetaData GetVariantType(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Bit public virtual Boolean GetBoolean(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.TinyInt public virtual Byte GetByte(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbTypes: Binary, VarBinary, Image, Udt, Xml, Char, VarChar, Text, NChar, NVarChar, NText // (Character type support needed for ExecuteXmlReader handling) public virtual Int64 GetBytesLength(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual int GetBytes(SmiEventSink sink, int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText public virtual Int64 GetCharsLength(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual int GetChars(SmiEventSink sink, int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual String GetString(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.SmallInt public virtual Int16 GetInt16(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Int public virtual Int32 GetInt32(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.BigInt, SqlDbType.Money, SqlDbType.SmallMoney public virtual Int64 GetInt64(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Real public virtual Single GetSingle(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Float public virtual Double GetDouble(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Numeric (uses SqlDecimal since Decimal cannot hold full range) public virtual SqlDecimal GetSqlDecimal(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for DateTime, SmallDateTime, Date, and DateTime2 public virtual DateTime GetDateTime(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for UniqueIdentifier public virtual Guid GetGuid(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Time public virtual TimeSpan GetTimeSpan(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for DateTimeOffset public virtual DateTimeOffset GetDateTimeOffset(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for structured types // This method called for both get and set. internal virtual SmiTypedGetterSetter GetTypedGetterSetter(SmiEventSink sink, int ordinal) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } // valid for multi-valued types only internal virtual bool NextElement(SmiEventSink sink) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } #endregion #region Setters // Set value to null // valid for all types public virtual void SetDBNull(SmiEventSink sink, int ordinal) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Bit public virtual void SetBoolean(SmiEventSink sink, int ordinal, Boolean value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.TinyInt public virtual void SetByte(SmiEventSink sink, int ordinal, Byte value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // Semantics for SetBytes are to modify existing value, not overwrite // Use in combination with SetLength to ensure overwriting when necessary // valid for SqlDbTypes: Binary, VarBinary, Image, Udt, Xml // (VarBinary assumed for variants) public virtual int SetBytes(SmiEventSink sink, int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual void SetBytesLength(SmiEventSink sink, int ordinal, long length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // Semantics for SetChars are to modify existing value, not overwrite // Use in combination with SetLength to ensure overwriting when necessary // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText // (NVarChar and global clr collation assumed for variants) public virtual int SetChars(SmiEventSink sink, int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual void SetCharsLength(SmiEventSink sink, int ordinal, long length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText public virtual void SetString(SmiEventSink sink, int ordinal, string value, int offset, int length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.SmallInt public virtual void SetInt16(SmiEventSink sink, int ordinal, Int16 value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Int public virtual void SetInt32(SmiEventSink sink, int ordinal, Int32 value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.BigInt, SqlDbType.Money, SqlDbType.SmallMoney public virtual void SetInt64(SmiEventSink sink, int ordinal, Int64 value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Real public virtual void SetSingle(SmiEventSink sink, int ordinal, Single value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Float public virtual void SetDouble(SmiEventSink sink, int ordinal, Double value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Numeric (uses SqlDecimal since Decimal cannot hold full range) public virtual void SetSqlDecimal(SmiEventSink sink, int ordinal, SqlDecimal value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for DateTime, SmallDateTime, Date, and DateTime2 public virtual void SetDateTime(SmiEventSink sink, int ordinal, DateTime value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for UniqueIdentifier public virtual void SetGuid(SmiEventSink sink, int ordinal, Guid value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Time public virtual void SetTimeSpan(SmiEventSink sink, int ordinal, TimeSpan value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for DateTimeOffset public virtual void SetDateTimeOffset(SmiEventSink sink, int ordinal, DateTimeOffset value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual void SetVariantMetaData( SmiEventSink sink, int ordinal, SmiMetaData metaData ) { // ******** OBSOLETING from SMI -- this should have been removed from ITypedSettersV3 // Intended to be removed prior to RTM. Sub-classes need not implement // Implement body with throw because there are only a couple of ways to get to this code: // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. // 2) Server didn't implement V2- on some interface and negotiated V2-. throw System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod ); } // valid for multi-valued types only internal virtual void NewElement(SmiEventSink sink) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } internal virtual void EndElements(SmiEventSink sink) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace Microsoft.SqlServer.Server { using System; using System.Data; using System.Data.SqlTypes; // Central interface for getting/setting data values from/to a set of values indexed by ordinal // (record, row, array, etc) // Which methods are allowed to be called depends on SmiMetaData type of data offset. internal abstract class SmiTypedGetterSetter : ITypedGettersV3, ITypedSettersV3 { #region Read/Write // Are calls to Get methods allowed? internal abstract bool CanGet { get; } // Are calls to Set methods allowed? internal abstract bool CanSet { get; } #endregion #region Getters // Null test // valid for all types public virtual bool IsDBNull(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // Check what type current sql_variant value is // valid for SqlDbType.Variant public virtual SmiMetaData GetVariantType(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Bit public virtual Boolean GetBoolean(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.TinyInt public virtual Byte GetByte(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbTypes: Binary, VarBinary, Image, Udt, Xml, Char, VarChar, Text, NChar, NVarChar, NText // (Character type support needed for ExecuteXmlReader handling) public virtual Int64 GetBytesLength(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual int GetBytes(SmiEventSink sink, int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText public virtual Int64 GetCharsLength(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual int GetChars(SmiEventSink sink, int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual String GetString(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.SmallInt public virtual Int16 GetInt16(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Int public virtual Int32 GetInt32(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.BigInt, SqlDbType.Money, SqlDbType.SmallMoney public virtual Int64 GetInt64(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Real public virtual Single GetSingle(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Float public virtual Double GetDouble(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Numeric (uses SqlDecimal since Decimal cannot hold full range) public virtual SqlDecimal GetSqlDecimal(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for DateTime, SmallDateTime, Date, and DateTime2 public virtual DateTime GetDateTime(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for UniqueIdentifier public virtual Guid GetGuid(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Time public virtual TimeSpan GetTimeSpan(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for DateTimeOffset public virtual DateTimeOffset GetDateTimeOffset(SmiEventSink sink, int ordinal) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for structured types // This method called for both get and set. internal virtual SmiTypedGetterSetter GetTypedGetterSetter(SmiEventSink sink, int ordinal) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } // valid for multi-valued types only internal virtual bool NextElement(SmiEventSink sink) { if (!CanGet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } #endregion #region Setters // Set value to null // valid for all types public virtual void SetDBNull(SmiEventSink sink, int ordinal) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Bit public virtual void SetBoolean(SmiEventSink sink, int ordinal, Boolean value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.TinyInt public virtual void SetByte(SmiEventSink sink, int ordinal, Byte value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // Semantics for SetBytes are to modify existing value, not overwrite // Use in combination with SetLength to ensure overwriting when necessary // valid for SqlDbTypes: Binary, VarBinary, Image, Udt, Xml // (VarBinary assumed for variants) public virtual int SetBytes(SmiEventSink sink, int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual void SetBytesLength(SmiEventSink sink, int ordinal, long length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // Semantics for SetChars are to modify existing value, not overwrite // Use in combination with SetLength to ensure overwriting when necessary // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText // (NVarChar and global clr collation assumed for variants) public virtual int SetChars(SmiEventSink sink, int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual void SetCharsLength(SmiEventSink sink, int ordinal, long length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for character types: Char, VarChar, Text, NChar, NVarChar, NText public virtual void SetString(SmiEventSink sink, int ordinal, string value, int offset, int length) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.SmallInt public virtual void SetInt16(SmiEventSink sink, int ordinal, Int16 value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Int public virtual void SetInt32(SmiEventSink sink, int ordinal, Int32 value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.BigInt, SqlDbType.Money, SqlDbType.SmallMoney public virtual void SetInt64(SmiEventSink sink, int ordinal, Int64 value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Real public virtual void SetSingle(SmiEventSink sink, int ordinal, Single value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Float public virtual void SetDouble(SmiEventSink sink, int ordinal, Double value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Numeric (uses SqlDecimal since Decimal cannot hold full range) public virtual void SetSqlDecimal(SmiEventSink sink, int ordinal, SqlDecimal value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for DateTime, SmallDateTime, Date, and DateTime2 public virtual void SetDateTime(SmiEventSink sink, int ordinal, DateTime value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for UniqueIdentifier public virtual void SetGuid(SmiEventSink sink, int ordinal, Guid value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for SqlDbType.Time public virtual void SetTimeSpan(SmiEventSink sink, int ordinal, TimeSpan value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } // valid for DateTimeOffset public virtual void SetDateTimeOffset(SmiEventSink sink, int ordinal, DateTimeOffset value) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } public virtual void SetVariantMetaData( SmiEventSink sink, int ordinal, SmiMetaData metaData ) { // ******** OBSOLETING from SMI -- this should have been removed from ITypedSettersV3 // Intended to be removed prior to RTM. Sub-classes need not implement // Implement body with throw because there are only a couple of ways to get to this code: // 1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-. // 2) Server didn't implement V2- on some interface and negotiated V2-. throw System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod ); } // valid for multi-valued types only internal virtual void NewElement(SmiEventSink sink) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } internal virtual void EndElements(SmiEventSink sink) { if (!CanSet) { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.InvalidSmiCall); } else { throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod); } } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Calendar.cs
- ZipIOExtraField.cs
- TypeInitializationException.cs
- UseAttributeSetsAction.cs
- TextTreeTextBlock.cs
- StringFreezingAttribute.cs
- LightweightEntityWrapper.cs
- ListSortDescription.cs
- DBSchemaTable.cs
- XslNumber.cs
- Sql8ExpressionRewriter.cs
- UxThemeWrapper.cs
- Help.cs
- WebPartAddingEventArgs.cs
- ListViewInsertedEventArgs.cs
- StringConverter.cs
- ObjectItemCachedAssemblyLoader.cs
- sqlstateclientmanager.cs
- NetworkCredential.cs
- BaseCollection.cs
- ConfigurationSectionGroup.cs
- Decoder.cs
- Context.cs
- CompressedStack.cs
- Type.cs
- Types.cs
- RegexCompilationInfo.cs
- StreamUpgradeInitiator.cs
- BuildProviderCollection.cs
- LinqDataSourceView.cs
- StringExpressionSet.cs
- SingleKeyFrameCollection.cs
- DeflateStream.cs
- ErrorTableItemStyle.cs
- XPathNodeList.cs
- CreationContext.cs
- DocumentCollection.cs
- View.cs
- SctClaimSerializer.cs
- ActivationArguments.cs
- SoapIgnoreAttribute.cs
- DictionaryItemsCollection.cs
- CalendarButtonAutomationPeer.cs
- SqlIdentifier.cs
- ConcurrencyMode.cs
- RectangleF.cs
- SmiEventStream.cs
- XhtmlTextWriter.cs
- Wildcard.cs
- SQLInt64.cs
- FixedPosition.cs
- _UriTypeConverter.cs
- EventQueueState.cs
- PropertyValueUIItem.cs
- EnumerableValidator.cs
- MarkupCompilePass2.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- BindableAttribute.cs
- NonParentingControl.cs
- BinaryCommonClasses.cs
- PluralizationServiceUtil.cs
- QuerySettings.cs
- AutomationProperty.cs
- ToolStripItemEventArgs.cs
- XPathSelectionIterator.cs
- SqlDataSourceSelectingEventArgs.cs
- OutOfProcStateClientManager.cs
- XmlAttributeCollection.cs
- FrameSecurityDescriptor.cs
- Documentation.cs
- ResourceCollectionInfo.cs
- FontStretch.cs
- ToolStripCollectionEditor.cs
- URLBuilder.cs
- WaitHandleCannotBeOpenedException.cs
- SamlAttribute.cs
- HybridDictionary.cs
- ConfigurationStrings.cs
- TreeBuilder.cs
- ProtocolElement.cs
- HyperLinkField.cs
- WebPartDisplayModeCancelEventArgs.cs
- WebServiceData.cs
- NullReferenceException.cs
- ExpressionBuilder.cs
- SystemBrushes.cs
- XmlArrayItemAttribute.cs
- DrawingContextWalker.cs
- DrawingServices.cs
- XmlSchemaAppInfo.cs
- ColumnResult.cs
- sortedlist.cs
- LinkConverter.cs
- TreeViewDesigner.cs
- LOSFormatter.cs
- Classification.cs
- embossbitmapeffect.cs
- WindowsListViewSubItem.cs
- HwndSubclass.cs
- SHA256.cs