private bool TryReadTwoBinaryFields(SqlEnvChange env, TdsParserStateObject stateObj)
{
// Used by ProcessEnvChangeToken
byte byteLength;
if (!stateObj.TryReadByte(out byteLength))
{
return false;
}
env.newLength = byteLength;
env.newBinValue = new byte[env.newLength];
if (!stateObj.TryReadByteArray(env.newBinValue, 0, env.newLength))
{
return false;
}
if (!stateObj.TryReadByte(out byteLength))
{
return false;
}
env.oldLength = byteLength;
env.oldBinValue = new byte[env.oldLength];
if (!stateObj.TryReadByteArray(env.oldBinValue, 0, env.oldLength))
{
return false;
}
// env.length includes 1 byte type token
env.length = 3 + env.newLength + env.oldLength;
return true;
}