本文整理汇总了C#中System.Data.SqlClient.TdsParserStateObject.ReadString方法的典型用法代码示例。如果您正苦于以下问题:C# TdsParserStateObject.ReadString方法的具体用法?C# TdsParserStateObject.ReadString怎么用?C# TdsParserStateObject.ReadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.TdsParserStateObject
的用法示例。
在下文中一共展示了TdsParserStateObject.ReadString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadTwoStringFields
private void ReadTwoStringFields(SqlEnvChange env, TdsParserStateObject stateObj)
{
env.newLength = stateObj.ReadByte();
env.newValue = stateObj.ReadString(env.newLength);
env.oldLength = stateObj.ReadByte();
env.oldValue = stateObj.ReadString(env.oldLength);
env.length = (3 + (env.newLength * 2)) + (env.oldLength * 2);
}
示例2: ProcessUDTMetaData
private void ProcessUDTMetaData(SqlMetaDataPriv metaData, TdsParserStateObject stateObj)
{
metaData.length = stateObj.ReadUInt16();
int length = stateObj.ReadByte();
if (length != 0)
{
metaData.udtDatabaseName = stateObj.ReadString(length);
}
length = stateObj.ReadByte();
if (length != 0)
{
metaData.udtSchemaName = stateObj.ReadString(length);
}
length = stateObj.ReadByte();
if (length != 0)
{
metaData.udtTypeName = stateObj.ReadString(length);
}
length = stateObj.ReadUInt16();
if (length != 0)
{
metaData.udtAssemblyQualifiedName = stateObj.ReadString(length);
}
}
示例3: ReadSqlStringValue
private void ReadSqlStringValue(SqlBuffer value, byte type, int length, Encoding encoding, bool isPlp, TdsParserStateObject stateObj)
{
string strEmpty;
byte num = type;
if (num <= 0x63)
{
if (num > 0x27)
{
switch (num)
{
case 0x2f:
goto Label_004C;
case 0x63:
goto Label_006B;
}
return;
}
if ((num != 0x23) && (num != 0x27))
{
return;
}
}
else if (num <= 0xaf)
{
if ((num != 0xa7) && (num != 0xaf))
{
return;
}
}
else
{
switch (num)
{
case 0xe7:
case 0xef:
goto Label_006B;
}
return;
}
Label_004C:
if (encoding == null)
{
encoding = this._defaultEncoding;
}
value.SetToString(stateObj.ReadStringWithEncoding(length, encoding, isPlp));
return;
Label_006B:
strEmpty = null;
if (isPlp)
{
char[] buff = null;
length = this.ReadPlpUnicodeChars(ref buff, 0, length >> 1, stateObj);
if (length > 0)
{
strEmpty = new string(buff, 0, length);
}
else
{
strEmpty = ADP.StrEmpty;
}
}
else
{
strEmpty = stateObj.ReadString(length >> 1);
}
value.SetToString(strEmpty);
}
示例4: ProcessReturnValue
internal SqlReturnValue ProcessReturnValue(int length, TdsParserStateObject stateObj)
{
int tokenLength;
uint num8;
SqlReturnValue metaData = new SqlReturnValue {
length = length
};
if (this._isYukon)
{
metaData.parmIndex = stateObj.ReadUInt16();
}
byte num2 = stateObj.ReadByte();
if (num2 > 0)
{
metaData.parameter = stateObj.ReadString(num2);
}
stateObj.ReadByte();
if (this.IsYukonOrNewer)
{
num8 = stateObj.ReadUInt32();
}
else
{
num8 = stateObj.ReadUInt16();
}
stateObj.ReadUInt16();
byte tdsType = stateObj.ReadByte();
if (tdsType == 0xf1)
{
tokenLength = 0xffff;
}
else if (this.IsVarTimeTds(tdsType))
{
tokenLength = 0;
}
else if (tdsType == 40)
{
tokenLength = 3;
}
else
{
tokenLength = this.GetTokenLength(tdsType, stateObj);
}
metaData.metaType = MetaType.GetSqlDataType(tdsType, num8, tokenLength);
metaData.type = metaData.metaType.SqlDbType;
if (this._isShiloh)
{
metaData.tdsType = metaData.metaType.NullableType;
metaData.isNullable = true;
if (tokenLength == 0xffff)
{
metaData.metaType = MetaType.GetMaxMetaTypeFromMetaType(metaData.metaType);
}
}
else
{
if (metaData.metaType.NullableType == tdsType)
{
metaData.isNullable = true;
}
metaData.tdsType = tdsType;
}
if (metaData.type == SqlDbType.Decimal)
{
metaData.precision = stateObj.ReadByte();
metaData.scale = stateObj.ReadByte();
}
if (metaData.metaType.IsVarTime)
{
metaData.scale = stateObj.ReadByte();
}
if (tdsType == 240)
{
this.ProcessUDTMetaData(metaData, stateObj);
}
if (metaData.type == SqlDbType.Xml)
{
if ((stateObj.ReadByte() & 1) != 0)
{
num2 = stateObj.ReadByte();
if (num2 != 0)
{
metaData.xmlSchemaCollectionDatabase = stateObj.ReadString(num2);
}
num2 = stateObj.ReadByte();
if (num2 != 0)
{
metaData.xmlSchemaCollectionOwningSchema = stateObj.ReadString(num2);
}
short num7 = stateObj.ReadInt16();
if (num7 != 0)
{
metaData.xmlSchemaCollectionName = stateObj.ReadString(num7);
}
}
}
else if (this._isShiloh && metaData.metaType.IsCharType)
{
metaData.collation = this.ProcessCollation(stateObj);
int codePage = this.GetCodePage(metaData.collation, stateObj);
//.........这里部分代码省略.........
示例5: CommonProcessMetaData
private void CommonProcessMetaData(TdsParserStateObject stateObj, _SqlMetaData col)
{
uint num5;
int length = 0;
if (this.IsYukonOrNewer)
{
num5 = stateObj.ReadUInt32();
}
else
{
num5 = stateObj.ReadUInt16();
}
byte num3 = stateObj.ReadByte();
col.updatability = (byte) ((num3 & 11) >> 2);
col.isNullable = 1 == (num3 & 1);
col.isIdentity = 0x10 == (num3 & 0x10);
stateObj.ReadByte();
col.isColumnSet = 4 == (num3 & 4);
byte tdsType = stateObj.ReadByte();
if (tdsType == 0xf1)
{
col.length = 0xffff;
}
else if (this.IsVarTimeTds(tdsType))
{
col.length = 0;
}
else if (tdsType == 40)
{
col.length = 3;
}
else
{
col.length = this.GetTokenLength(tdsType, stateObj);
}
col.metaType = MetaType.GetSqlDataType(tdsType, num5, col.length);
col.type = col.metaType.SqlDbType;
if (this._isShiloh)
{
col.tdsType = col.isNullable ? col.metaType.NullableType : col.metaType.TDSType;
}
else
{
col.tdsType = tdsType;
}
if (this._isYukon)
{
if (240 == tdsType)
{
this.ProcessUDTMetaData(col, stateObj);
}
if (col.length == 0xffff)
{
col.metaType = MetaType.GetMaxMetaTypeFromMetaType(col.metaType);
col.length = 0x7fffffff;
if ((tdsType == 0xf1) && ((stateObj.ReadByte() & 1) != 0))
{
length = stateObj.ReadByte();
if (length != 0)
{
col.xmlSchemaCollectionDatabase = stateObj.ReadString(length);
}
length = stateObj.ReadByte();
if (length != 0)
{
col.xmlSchemaCollectionOwningSchema = stateObj.ReadString(length);
}
length = stateObj.ReadInt16();
if (length != 0)
{
col.xmlSchemaCollectionName = stateObj.ReadString(length);
}
}
}
}
if (col.type == SqlDbType.Decimal)
{
col.precision = stateObj.ReadByte();
col.scale = stateObj.ReadByte();
}
if (col.metaType.IsVarTime)
{
col.scale = stateObj.ReadByte();
switch (col.metaType.SqlDbType)
{
case SqlDbType.Time:
col.length = MetaType.GetTimeSizeFromScale(col.scale);
break;
case SqlDbType.DateTime2:
col.length = 3 + MetaType.GetTimeSizeFromScale(col.scale);
break;
case SqlDbType.DateTimeOffset:
col.length = 5 + MetaType.GetTimeSizeFromScale(col.scale);
break;
}
}
if ((this._isShiloh && col.metaType.IsCharType) && (tdsType != 0xf1))
{
//.........这里部分代码省略.........
示例6: ProcessOneTable
private MultiPartTableName ProcessOneTable(TdsParserStateObject stateObj, ref int length)
{
ushort num;
if (this._isShilohSP1)
{
MultiPartTableName name = new MultiPartTableName();
byte num2 = stateObj.ReadByte();
length--;
switch (num2)
{
case 4:
num = stateObj.ReadUInt16();
length -= 2;
name.ServerName = stateObj.ReadString(num);
num2 = (byte) (num2 - 1);
length -= num * 2;
break;
case 3:
num = stateObj.ReadUInt16();
length -= 2;
name.CatalogName = stateObj.ReadString(num);
length -= num * 2;
num2 = (byte) (num2 - 1);
break;
case 2:
num = stateObj.ReadUInt16();
length -= 2;
name.SchemaName = stateObj.ReadString(num);
length -= num * 2;
num2 = (byte) (num2 - 1);
break;
case 1:
num = stateObj.ReadUInt16();
length -= 2;
name.TableName = stateObj.ReadString(num);
length -= num * 2;
num2 = (byte) (num2 - 1);
break;
}
return name;
}
num = stateObj.ReadUInt16();
length -= 2;
string str = stateObj.ReadString(num);
length -= num * 2;
return new MultiPartTableName(MultipartIdentifier.ParseMultipartIdentifier(str, "[\"", "]\"", "SQL_TDSParserTableName", false));
}
示例7: ProcessLoginAck
private SqlLoginAck ProcessLoginAck(TdsParserStateObject stateObj)
{
SqlLoginAck ack = new SqlLoginAck();
this.SkipBytes(1, stateObj);
byte[] buff = new byte[4];
stateObj.ReadByteArray(buff, 0, buff.Length);
uint num3 = (uint) ((((((buff[0] << 8) | buff[1]) << 8) | buff[2]) << 8) | buff[3]);
uint num6 = num3 & 0xff00ffff;
uint num2 = (num3 >> 0x10) & 0xff;
switch (num6)
{
case 0x72000002:
if (num2 != 9)
{
throw SQL.InvalidTDSVersion();
}
this._isYukon = true;
break;
case 0x73000003:
if (num2 != 10)
{
throw SQL.InvalidTDSVersion();
}
this._isKatmai = true;
break;
case 0x7000000:
switch (num2)
{
case 1:
this._isShiloh = true;
goto Label_00DF;
}
throw SQL.InvalidTDSVersion();
case 0x71000001:
if (num2 != 0)
{
throw SQL.InvalidTDSVersion();
}
this._isShilohSP1 = true;
break;
default:
throw SQL.InvalidTDSVersion();
}
Label_00DF:
this._isYukon |= this._isKatmai;
this._isShilohSP1 |= this._isYukon;
this._isShiloh |= this._isShilohSP1;
ack.isVersion8 = this._isShiloh;
stateObj._outBytesUsed = stateObj._outputHeaderLen;
byte length = stateObj.ReadByte();
ack.programName = stateObj.ReadString(length);
ack.majorVersion = stateObj.ReadByte();
ack.minorVersion = stateObj.ReadByte();
ack.buildNum = (short) ((stateObj.ReadByte() << 8) + stateObj.ReadByte());
this._state = TdsParserState.OpenLoggedIn;
if ((this._isYukon && this._fAsync) && this._fMARS)
{
this._resetConnectionEvent = new AutoResetEvent(true);
}
if (this._connHandler.ConnectionOptions.UserInstance && ADP.IsEmpty(this._connHandler.InstanceName))
{
this.Errors.Add(new SqlError(0, 0, 20, this.Server, SQLMessage.UserInstanceFailure(), "", 0));
this.ThrowExceptionAndWarning();
}
return ack;
}
示例8: ProcessError
internal SqlError ProcessError(byte token, TdsParserStateObject stateObj)
{
int num2;
int infoNumber = stateObj.ReadInt32();
byte errorState = stateObj.ReadByte();
byte errorClass = stateObj.ReadByte();
int length = stateObj.ReadUInt16();
string errorMessage = stateObj.ReadString(length);
length = stateObj.ReadByte();
if (length != 0)
{
stateObj.ReadString(length);
}
length = stateObj.ReadByte();
string procedure = stateObj.ReadString(length);
if (this._isYukon)
{
num2 = stateObj.ReadInt32();
}
else
{
num2 = stateObj.ReadUInt16();
if ((this._state == TdsParserState.OpenNotLoggedIn) && (stateObj.PeekByte() == 0))
{
num2 = (num2 << 0x10) + stateObj.ReadUInt16();
}
}
return new SqlError(infoNumber, errorState, errorClass, this._server, errorMessage, procedure, num2);
}
示例9: ProcessEnvChange
//.........这里部分代码省略.........
env.newCollation = this.ProcessCollation(stateObj);
this._defaultCollation = env.newCollation;
int codePage = this.GetCodePage(env.newCollation, stateObj);
if (codePage != this._defaultCodePage)
{
this._defaultCodePage = codePage;
this._defaultEncoding = Encoding.GetEncoding(this._defaultCodePage);
}
this._defaultLCID = env.newCollation.LCID;
}
env.oldLength = stateObj.ReadByte();
if (env.oldLength == 5)
{
env.oldCollation = this.ProcessCollation(stateObj);
}
env.length = (3 + env.newLength) + env.oldLength;
goto Label_03E0;
case 8:
case 9:
case 10:
case 11:
case 12:
case 0x11:
env.newLength = stateObj.ReadByte();
if (env.newLength <= 0)
{
goto Label_02B0;
}
env.newLongValue = stateObj.ReadInt64();
goto Label_02B8;
case 13:
this.ReadTwoStringFields(env, stateObj);
goto Label_03E0;
case 15:
env.newLength = stateObj.ReadInt32();
env.newBinValue = new byte[env.newLength];
stateObj.ReadByteArray(env.newBinValue, 0, env.newLength);
env.oldLength = stateObj.ReadByte();
env.length = 5 + env.newLength;
goto Label_03E0;
case 0x10:
case 0x12:
this.ReadTwoBinaryFields(env, stateObj);
goto Label_03E0;
case 0x13:
this.ReadTwoStringFields(env, stateObj);
goto Label_03E0;
case 20:
{
env.newLength = stateObj.ReadUInt16();
byte protocol = stateObj.ReadByte();
ushort port = stateObj.ReadUInt16();
ushort length = stateObj.ReadUInt16();
string servername = stateObj.ReadString(length);
env.newRoutingInfo = new RoutingInfo(protocol, port, servername);
num5 = stateObj.ReadUInt16();
num3 = 0;
goto Label_03C9;
}
default:
goto Label_03E0;
}
string s = env.newValue.Substring(2);
this._defaultCodePage = int.Parse(s, NumberStyles.Integer, CultureInfo.InvariantCulture);
this._defaultEncoding = Encoding.GetEncoding(this._defaultCodePage);
goto Label_03E0;
Label_02B0:
env.newLongValue = 0L;
Label_02B8:
env.oldLength = stateObj.ReadByte();
if (env.oldLength > 0)
{
env.oldLongValue = stateObj.ReadInt64();
}
else
{
env.oldLongValue = 0L;
}
env.length = (3 + env.newLength) + env.oldLength;
goto Label_03E0;
Label_03BC:
stateObj.ReadByte();
num3++;
Label_03C9:
if (num3 < num5)
{
goto Label_03BC;
}
env.length = (env.newLength + num5) + 5;
Label_03E0:
num4 += env.length;
}
return changeArray;
}
示例10: ProcessColInfo
private _SqlMetaDataSet ProcessColInfo(_SqlMetaDataSet columns, SqlDataReader reader, TdsParserStateObject stateObj)
{
for (int i = 0; i < columns.Length; i++)
{
_SqlMetaData data = columns[i];
stateObj.ReadByte();
data.tableNum = stateObj.ReadByte();
byte num = stateObj.ReadByte();
data.isDifferentName = 0x20 == (num & 0x20);
data.isExpression = 4 == (num & 4);
data.isKey = 8 == (num & 8);
data.isHidden = 0x10 == (num & 0x10);
if (data.isDifferentName)
{
byte length = stateObj.ReadByte();
data.baseColumn = stateObj.ReadString(length);
}
if ((reader.TableNames != null) && (data.tableNum > 0))
{
data.multiPartTableName = reader.TableNames[data.tableNum - 1];
}
if (data.isExpression)
{
data.updatability = 0;
}
}
return columns;
}