本文整理汇总了C#中System.Data.SqlClient.TdsParserStateObject.TryReadChar方法的典型用法代码示例。如果您正苦于以下问题:C# TdsParserStateObject.TryReadChar方法的具体用法?C# TdsParserStateObject.TryReadChar怎么用?C# TdsParserStateObject.TryReadChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.TdsParserStateObject
的用法示例。
在下文中一共展示了TdsParserStateObject.TryReadChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryReadPlpUnicodeCharsChunk
// Reads the next chunk in a nvarchar(max) data stream.
// This call must be preceeded by a call to ReadPlpLength or ReadDataLength.
// Will not start reading into the next chunk if bytes requested is larger than
// the current chunk length. Do another ReadPlpLength, ReadPlpUnicodeChars in that case.
// Returns the actual chars read
private bool TryReadPlpUnicodeCharsChunk(char[] buff, int offst, int len, TdsParserStateObject stateObj, out int charsRead)
{
Debug.Assert((buff == null && len == 0) || (buff.Length >= offst + len), "Invalid length sent to ReadPlpUnicodeChars()!");
Debug.Assert((stateObj._longlen != 0) && (stateObj._longlen != TdsEnums.SQL_PLP_NULL),
"Out of sync plp read request");
if (stateObj._longlenleft == 0)
{
Debug.Assert(false, "Out of sync read request");
charsRead = 0;
return true;
}
charsRead = len;
// stateObj._longlenleft is in bytes
if ((stateObj._longlenleft >> 1) < (ulong)len)
charsRead = (int)(stateObj._longlenleft >> 1);
for (int ii = 0; ii < charsRead; ii++)
{
if (!stateObj.TryReadChar(out buff[offst + ii]))
{
return false;
}
}
stateObj._longlenleft -= ((ulong)charsRead << 1);
return true;
}