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


C# Server.SmiTypedGetterSetter类代码示例

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


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

示例1: RowAvailable

        internal virtual void RowAvailable(SmiTypedGetterSetter rowData) {
            // Adding as of V200

            // 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 hasn't implemented V200 yet.
            //  2) Server didn't implement V200 on some interface, but negotiated V200+.
            System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod );
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:8,代码来源:SmiEventSink.cs

示例2: GetTimeSpan_Unchecked

 private static TimeSpan GetTimeSpan_Unchecked(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal)
 {
     TimeSpan timeSpan = getters.GetTimeSpan(sink, ordinal);
     sink.ProcessMessagesAndThrow();
     return timeSpan;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:ValueUtilsSmi.cs

示例3: 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

示例4: SetIEnumerableOfSqlDataRecord_Unchecked

        private static void SetIEnumerableOfSqlDataRecord_Unchecked(
            SmiEventSink_Default        sink,
            SmiTypedGetterSetter        setters,
            int                         ordinal,
            SmiMetaData                 metaData,
            IEnumerable<SqlDataRecord>  value,
            ParameterPeekAheadValue     peekAhead
            ) {
            // Get target gettersetter
            setters = setters.GetTypedGetterSetter(sink, ordinal);
            sink.ProcessMessagesAndThrow();

            IEnumerator<SqlDataRecord> enumerator = null;
            try {
                // Need to copy field metadata to an array to call FillCompatibleITypeSettersFromRecord
                SmiExtendedMetaData[] mdFields = new SmiExtendedMetaData[metaData.FieldMetaData.Count];
                metaData.FieldMetaData.CopyTo(mdFields, 0);

                SmiDefaultFieldsProperty defaults = (SmiDefaultFieldsProperty) metaData.ExtendedProperties[SmiPropertySelector.DefaultFields];

                int recordNumber = 1;   // used only for reporting position when there are errors.

                // obtain enumerator and handle any peekahead values
                if (null != peekAhead && null != peekAhead.FirstRecord) {
                    // hook up to enumerator
                    enumerator = peekAhead.Enumerator;

                    // send the first record that was obtained earlier
                    setters.NewElement(sink);
                    sink.ProcessMessagesAndThrow();
                    FillCompatibleSettersFromRecord(sink, setters, mdFields, peekAhead.FirstRecord, defaults);
                    recordNumber++;
                }
                else {
                    enumerator = value.GetEnumerator();
                }

                using (enumerator) {
                    while(enumerator.MoveNext()) {
                        setters.NewElement(sink);
                        sink.ProcessMessagesAndThrow();

                        SqlDataRecord record = enumerator.Current;

                        if (record.FieldCount != mdFields.Length) {
                            throw SQL.EnumeratedRecordFieldCountChanged(recordNumber);
                        }

                        for(int i=0; i<record.FieldCount; i++) {
                            if (!MetaDataUtilsSmi.IsCompatible(metaData.FieldMetaData[i], record.GetSqlMetaData(i))) {
                                throw SQL.EnumeratedRecordMetaDataChanged(record.GetName(i), recordNumber);
                            }
                        }

                        FillCompatibleSettersFromRecord(sink, setters, mdFields, record, defaults);
                        recordNumber++;
                    }

                    setters.EndElements(sink);
                    sink.ProcessMessagesAndThrow();
                }
            }
            finally {
                // Clean up!
                IDisposable disposable = enumerator as IDisposable;
                if (null != disposable) {
                    disposable.Dispose();
                }
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:70,代码来源:ValueUtilsSmi.cs

示例5: SetDataTable_Unchecked

        private static void SetDataTable_Unchecked(
                SmiEventSink_Default    sink,
                SmiTypedGetterSetter    setters,
                int                     ordinal,
                SmiMetaData             metaData,
                DataTable               value
            ) {
            // Get the target gettersetter
            setters = setters.GetTypedGetterSetter(sink, ordinal);
            sink.ProcessMessagesAndThrow();

            // iterate over all records
            //  if first record was obtained earlier, use it prior to pulling more
            ExtendedClrTypeCode[] cellTypes = new ExtendedClrTypeCode[metaData.FieldMetaData.Count];
            for(int i=0; i<metaData.FieldMetaData.Count; i++) {
                cellTypes[i] = ExtendedClrTypeCode.Invalid;
            }
            foreach(DataRow row in value.Rows) {
                setters.NewElement(sink);
                sink.ProcessMessagesAndThrow();

                // Set all columns in the record
                for(int i=0; i<metaData.FieldMetaData.Count; i++) {
                    SmiMetaData fieldMetaData = metaData.FieldMetaData[i];
                    if (row.IsNull(i)) {
                        SetDBNull_Unchecked(sink, setters, i);
                    }
                    else {
                        object cellValue = row[i];

                        // Only determine cell types for first row, to save expensive 
                        if (ExtendedClrTypeCode.Invalid == cellTypes[i]) {
                            cellTypes[i] = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType(
                                    fieldMetaData.SqlDbType, fieldMetaData.IsMultiValued, cellValue, fieldMetaData.Type, 
                                    // 

                                    SmiContextFactory.KatmaiVersion 
                                    );
                        }
                        SetCompatibleValueV200(sink, setters, i, fieldMetaData, cellValue, cellTypes[i], 0, NoLengthLimit, null);
                    }
                }
            }

            setters.EndElements(sink);
            sink.ProcessMessagesAndThrow();
        }
开发者ID:uQr,项目名称:referencesource,代码行数:47,代码来源:ValueUtilsSmi.cs

示例6: GetTimeSpan_Unchecked

        private static TimeSpan GetTimeSpan_Unchecked(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal) {
            Debug.Assert(!IsDBNull_Unchecked(sink, getters, ordinal));

            TimeSpan result = getters.GetTimeSpan(sink, ordinal);
            sink.ProcessMessagesAndThrow();
            return result;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:7,代码来源:ValueUtilsSmi.cs

示例7: SetChars_FromReader

        // Use chunking via SetChars to transfer a value from a reader to a gettersetter
        private static void SetChars_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) {
            int length = 0;

            // Deal with large values by sending bufferLength of NoLengthLimit (== assume 
            //  CheckXetParameters will ignore requested-length checks in this case)
            length = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, NoLengthLimit /* actual */, 0, NoLengthLimit /* buffer length */, offset, NoLengthLimit /* requested length */ );

            // Use fixed chunk size for all cases to avoid inquiring from reader.
            int chunkSize;
            if (MetaDataUtilsSmi.IsAnsiType(metaData.SqlDbType)) {
                chunkSize = __maxByteChunkSize;
            } else {
                chunkSize = __maxCharChunkSize;
            }

            char[] buffer = new char[ chunkSize ];
            long charsRead;
            long charsWritten = 1;  // prime value to get into write loop
            long currentOffset = offset;
            long lengthWritten = 0;

            while ((length < 0  || lengthWritten < length) &&
                    0 != (charsRead = reader.GetChars(ordinal, currentOffset, buffer, 0, chunkSize)) &&
                    0 != charsWritten) {
                charsWritten = setters.SetChars(sink, ordinal, currentOffset, buffer, 0, checked((int) charsRead));
                sink.ProcessMessagesAndThrow();
                checked{ currentOffset += charsWritten; }
                checked{ lengthWritten += charsWritten; }
            }

            // Make sure to trim any left-over data (remember to trim at end of offset, not just the amount written
            setters.SetCharsLength(sink, ordinal, currentOffset);
            sink.ProcessMessagesAndThrow();
        }
开发者ID:uQr,项目名称:referencesource,代码行数:35,代码来源:ValueUtilsSmi.cs

示例8: SetTimeSpan_Checked

 private static void SetTimeSpan_Checked(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, TimeSpan value) {
     VerifyTimeRange(metaData.SqlDbType, value);
     SetTimeSpan_Unchecked(sink, setters, ordinal, value);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:4,代码来源:ValueUtilsSmi.cs

示例9: SetString_FromReader

 private static void SetString_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset)
 {
     string str = reader.GetString(ordinal);
     int length = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, (long) str.Length, 0L, -1, offset, -1);
     setters.SetString(sink, ordinal, str, offset, length);
     sink.ProcessMessagesAndThrow();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ValueUtilsSmi.cs

示例10: SetIEnumerableOfSqlDataRecord_Unchecked

 private static void SetIEnumerableOfSqlDataRecord_Unchecked(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, IEnumerable<SqlDataRecord> value, ParameterPeekAheadValue peekAhead)
 {
     setters = setters.GetTypedGetterSetter(sink, ordinal);
     sink.ProcessMessagesAndThrow();
     IEnumerator<SqlDataRecord> enumerator = null;
     try
     {
         SmiExtendedMetaData[] array = new SmiExtendedMetaData[metaData.FieldMetaData.Count];
         metaData.FieldMetaData.CopyTo(array, 0);
         SmiDefaultFieldsProperty useDefaultValues = (SmiDefaultFieldsProperty) metaData.ExtendedProperties[SmiPropertySelector.DefaultFields];
         int recordNumber = 1;
         if ((peekAhead != null) && (peekAhead.FirstRecord != null))
         {
             enumerator = peekAhead.Enumerator;
             setters.NewElement(sink);
             sink.ProcessMessagesAndThrow();
             FillCompatibleSettersFromRecord(sink, setters, array, peekAhead.FirstRecord, useDefaultValues);
             recordNumber++;
         }
         else
         {
             enumerator = value.GetEnumerator();
         }
         using (enumerator)
         {
             while (enumerator.MoveNext())
             {
                 setters.NewElement(sink);
                 sink.ProcessMessagesAndThrow();
                 SqlDataRecord current = enumerator.Current;
                 if (current.FieldCount != array.Length)
                 {
                     throw SQL.EnumeratedRecordFieldCountChanged(recordNumber);
                 }
                 for (int i = 0; i < current.FieldCount; i++)
                 {
                     if (!MetaDataUtilsSmi.IsCompatible(metaData.FieldMetaData[i], current.GetSqlMetaData(i)))
                     {
                         throw SQL.EnumeratedRecordMetaDataChanged(current.GetName(i), recordNumber);
                     }
                 }
                 FillCompatibleSettersFromRecord(sink, setters, array, current, useDefaultValues);
                 recordNumber++;
             }
             setters.EndElements(sink);
             sink.ProcessMessagesAndThrow();
         }
     }
     finally
     {
         IDisposable disposable = enumerator;
         if (disposable != null)
         {
             disposable.Dispose();
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:57,代码来源:ValueUtilsSmi.cs

示例11: SetDataTable_Unchecked

 private static void SetDataTable_Unchecked(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DataTable value)
 {
     setters = setters.GetTypedGetterSetter(sink, ordinal);
     sink.ProcessMessagesAndThrow();
     ExtendedClrTypeCode[] codeArray = new ExtendedClrTypeCode[metaData.FieldMetaData.Count];
     for (int i = 0; i < metaData.FieldMetaData.Count; i++)
     {
         codeArray[i] = ExtendedClrTypeCode.Invalid;
     }
     foreach (DataRow row in value.Rows)
     {
         setters.NewElement(sink);
         sink.ProcessMessagesAndThrow();
         for (int j = 0; j < metaData.FieldMetaData.Count; j++)
         {
             SmiMetaData data = metaData.FieldMetaData[j];
             if (row.IsNull(j))
             {
                 SetDBNull_Unchecked(sink, setters, j);
             }
             else
             {
                 object obj2 = row[j];
                 if (ExtendedClrTypeCode.Invalid == codeArray[j])
                 {
                     codeArray[j] = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType(data.SqlDbType, data.IsMultiValued, obj2, data.Type, 210L);
                 }
                 SetCompatibleValueV200(sink, setters, j, data, obj2, codeArray[j], 0, -1, null);
             }
         }
     }
     setters.EndElements(sink);
     sink.ProcessMessagesAndThrow();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:ValueUtilsSmi.cs

示例12: SetCompatibleValueV200

        internal static void SetCompatibleValueV200(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, object value, ExtendedClrTypeCode typeCode, int offset, int length, ParameterPeekAheadValue peekAhead)
        {
            switch (typeCode)
            {
                case ExtendedClrTypeCode.DataTable:
                    SetDataTable_Unchecked(sink, setters, ordinal, metaData, (DataTable) value);
                    return;

                case ExtendedClrTypeCode.DbDataReader:
                    SetDbDataReader_Unchecked(sink, setters, ordinal, metaData, (DbDataReader) value);
                    return;

                case ExtendedClrTypeCode.IEnumerableOfSqlDataRecord:
                    SetIEnumerableOfSqlDataRecord_Unchecked(sink, setters, ordinal, metaData, (IEnumerable<SqlDataRecord>) value, peekAhead);
                    return;

                case ExtendedClrTypeCode.TimeSpan:
                    SetTimeSpan_Checked(sink, setters, ordinal, metaData, (TimeSpan) value);
                    return;

                case ExtendedClrTypeCode.DateTimeOffset:
                    SetDateTimeOffset_Unchecked(sink, setters, ordinal, (DateTimeOffset) value);
                    return;
            }
            SetCompatibleValue(sink, setters, ordinal, metaData, value, typeCode, offset);
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ValueUtilsSmi.cs

示例13: SetChars_FromReader

 private static void SetChars_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset)
 {
     int num4;
     long num6;
     int num5 = 0;
     num5 = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, -1L, 0L, -1, offset, -1);
     if (MetaDataUtilsSmi.IsAnsiType(metaData.SqlDbType))
     {
         num4 = 0x1f40;
     }
     else
     {
         num4 = 0xfa0;
     }
     char[] buffer = new char[num4];
     long num2 = 1L;
     long dataOffset = offset;
     for (long i = 0L; ((num5 < 0) || (i < num5)) && ((0L != (num6 = reader.GetChars(ordinal, dataOffset, buffer, 0, num4))) && (0L != num2)); i += num2)
     {
         num2 = setters.SetChars(sink, ordinal, dataOffset, buffer, 0, (int) num6);
         sink.ProcessMessagesAndThrow();
         dataOffset += num2;
     }
     setters.SetCharsLength(sink, ordinal, dataOffset);
     sink.ProcessMessagesAndThrow();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ValueUtilsSmi.cs

示例14: SetBytes_FromReader

 private static void SetBytes_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset)
 {
     long num6;
     int num4 = 0;
     num4 = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, -1L, 0L, -1, offset, -1);
     int length = 0x1f40;
     byte[] buffer = new byte[length];
     long num2 = 1L;
     long dataOffset = offset;
     for (long i = 0L; ((num4 < 0) || (i < num4)) && ((0L != (num6 = reader.GetBytes(ordinal, dataOffset, buffer, 0, length))) && (0L != num2)); i += num2)
     {
         num2 = setters.SetBytes(sink, ordinal, dataOffset, buffer, 0, (int) num6);
         sink.ProcessMessagesAndThrow();
         dataOffset += num2;
     }
     setters.SetBytesLength(sink, ordinal, dataOffset);
     sink.ProcessMessagesAndThrow();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:ValueUtilsSmi.cs

示例15: 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


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