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


C# TdsParserStateObject.TryProcessHeader方法代码示例

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


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

示例1: DrainData

        internal void DrainData(TdsParserStateObject stateObj)
        {
            try
            {
                SqlDataReader.SharedState sharedState = stateObj._readerState;
                if (sharedState != null && sharedState._dataReady)
                {
                    var metadata = stateObj._cleanupMetaData;
                    if (stateObj._partialHeaderBytesRead > 0)
                    {
                        if (!stateObj.TryProcessHeader())
                        {
                            throw SQL.SynchronousCallMayNotPend();
                        }
                    }
                    if (0 == sharedState._nextColumnHeaderToRead)
                    {
                        // i. user called read but didn't fetch anything
                        if (!stateObj.Parser.TrySkipRow(stateObj._cleanupMetaData, stateObj))
                        {
                            throw SQL.SynchronousCallMayNotPend();
                        }
                    }
                    else
                    {
                        // iia.  if we still have bytes left from a partially read column, skip
                        if (sharedState._nextColumnDataToRead < sharedState._nextColumnHeaderToRead)
                        {
                            if ((sharedState._nextColumnHeaderToRead > 0) && (metadata[sharedState._nextColumnHeaderToRead - 1].metaType.IsPlp))
                            {
                                if (stateObj._longlen != 0)
                                {
                                    ulong ignored;
                                    if (!TrySkipPlpValue(UInt64.MaxValue, stateObj, out ignored))
                                    {
                                        throw SQL.SynchronousCallMayNotPend();
                                    }
                                }
                            }

                            else if (0 < sharedState._columnDataBytesRemaining)
                            {
                                if (!stateObj.TrySkipLongBytes(sharedState._columnDataBytesRemaining))
                                {
                                    throw SQL.SynchronousCallMayNotPend();
                                }
                            }
                        }


                        // Read the remaining values off the wire for this row
                        if (!stateObj.Parser.TrySkipRow(metadata, sharedState._nextColumnHeaderToRead, stateObj))
                        {
                            throw SQL.SynchronousCallMayNotPend();
                        }
                    }
                }
                Run(RunBehavior.Clean, null, null, null, stateObj);
            }
            catch
            {
                _connHandler.DoomThisConnection();
                throw;
            }
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:65,代码来源:TdsParser.cs

示例2: DrainData

        internal void DrainData(TdsParserStateObject stateObj) {
            RuntimeHelpers.PrepareConstrainedRegions();
            try {
#if DEBUG
                TdsParser.ReliabilitySection tdsReliabilitySection = new TdsParser.ReliabilitySection();

                RuntimeHelpers.PrepareConstrainedRegions();
                try {
                    tdsReliabilitySection.Start();
#else
                  {
#endif //DEBUG
                    try {
                        SqlDataReader.SharedState sharedState = stateObj._readerState;
                        if (sharedState != null && sharedState._dataReady) {
                            var metadata = stateObj._cleanupMetaData;
                            if (stateObj._partialHeaderBytesRead > 0) {
                                if (!stateObj.TryProcessHeader()) {
                                    throw SQL.SynchronousCallMayNotPend();
                                }
                            }
                            if (0 == sharedState._nextColumnHeaderToRead) {
                                // i. user called read but didn't fetch anything
                                if (!stateObj.Parser.TrySkipRow(stateObj._cleanupMetaData, stateObj)) {
                                    throw SQL.SynchronousCallMayNotPend();
                                }
                            }
                            else {
                                // iia.  if we still have bytes left from a partially read column, skip
                                if (sharedState._nextColumnDataToRead < sharedState._nextColumnHeaderToRead) {
                                    if ((sharedState._nextColumnHeaderToRead > 0) && (metadata[sharedState._nextColumnHeaderToRead - 1].metaType.IsPlp)) {
                                        if (stateObj._longlen != 0) {
                                            ulong ignored;
                                            if (!TrySkipPlpValue(UInt64.MaxValue, stateObj, out ignored)) {
                                                throw SQL.SynchronousCallMayNotPend();
                                            }
                                        }
                                    }

                                    else if (0 < sharedState._columnDataBytesRemaining) {
                                        if (!stateObj.TrySkipLongBytes(sharedState._columnDataBytesRemaining)) {
                                            throw SQL.SynchronousCallMayNotPend();
                                        }
                                    }

                                }


                                // iib.
                                // now read the remaining values off the wire for this row
                                if (!stateObj.Parser.TrySkipRow(metadata, sharedState._nextColumnHeaderToRead, stateObj)) {
                                    throw SQL.SynchronousCallMayNotPend();
                                }

                            }
                        }
                        Run(RunBehavior.Clean, null, null, null, stateObj);
                    }
                    catch {
                        _connHandler.DoomThisConnection();
                        throw;
                    }
                }
#if DEBUG
                finally {
                    tdsReliabilitySection.Stop();
                }
#endif //DEBUG
            }
            catch (System.OutOfMemoryException) {
                _connHandler.DoomThisConnection();
                throw;
            }
            catch (System.StackOverflowException) {
                _connHandler.DoomThisConnection();
                throw;
            }
            catch (System.Threading.ThreadAbortException) {
                _connHandler.DoomThisConnection();
                throw;
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:82,代码来源:TdsParser.cs


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