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