Skip to content

Commit 3185ce2

Browse files
authored
move snapshot plpdata to shared (#2126)
1 parent 610a2c2 commit 3185ce2

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObject.netcore.cs

+1-13
Original file line numberDiff line numberDiff line change
@@ -3100,18 +3100,6 @@ internal void CloneCleanupAltMetaDataSetArray()
31003100

31013101
sealed partial class StateSnapshot
31023102
{
3103-
private sealed class PLPData
3104-
{
3105-
public readonly ulong SnapshotLongLen;
3106-
public readonly ulong SnapshotLongLenLeft;
3107-
3108-
public PLPData(ulong snapshotLongLen, ulong snapshotLongLenLeft)
3109-
{
3110-
SnapshotLongLen = snapshotLongLen;
3111-
SnapshotLongLenLeft = snapshotLongLenLeft;
3112-
}
3113-
}
3114-
31153103
private sealed partial class PacketData
31163104
{
31173105
public byte[] Buffer;
@@ -3150,7 +3138,7 @@ partial void SetStackInternal(string value)
31503138
private PacketData _sparePacket;
31513139

31523140
internal byte[] _plpBuffer;
3153-
private PLPData _plpData;
3141+
31543142

31553143
private int _snapshotInBuffCount;
31563144

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObject.netfx.cs

+6-7
Original file line numberDiff line numberDiff line change
@@ -3267,9 +3267,6 @@ sealed partial class StateSnapshot
32673267
private bool _snapshotReceivedColumnMetadata = false;
32683268
private bool _snapshotAttentionReceived;
32693269

3270-
private ulong _snapshotLongLen;
3271-
private ulong _snapshotLongLenLeft;
3272-
32733270
public StateSnapshot(TdsParserStateObject state)
32743271
{
32753272
_snapshotInBuffs = new List<PacketData>();
@@ -3347,8 +3344,10 @@ internal void Snap()
33473344
_snapshotMessageStatus = _stateObj._messageStatus;
33483345
// _nullBitmapInfo must be cloned before it is updated
33493346
_snapshotNullBitmapInfo = _stateObj._nullBitmapInfo;
3350-
_snapshotLongLen = _stateObj._longlen;
3351-
_snapshotLongLenLeft = _stateObj._longlenleft;
3347+
if (_stateObj._longlen != 0 || _stateObj._longlenleft != 0)
3348+
{
3349+
_plpData = new PLPData(_stateObj._longlen, _stateObj._longlenleft);
3350+
}
33523351
_snapshotCleanupMetaData = _stateObj._cleanupMetaData;
33533352
// _cleanupAltMetaDataSetArray must be cloned bofore it is updated
33543353
_snapshotCleanupAltMetaDataSetArray = _stateObj._cleanupAltMetaDataSetArray;
@@ -3401,8 +3400,8 @@ internal void ResetSnapshotState()
34013400
_stateObj._partialHeaderBytesRead = 0;
34023401

34033402
// reset plp state
3404-
_stateObj._longlen = _snapshotLongLen;
3405-
_stateObj._longlenleft = _snapshotLongLenLeft;
3403+
_stateObj._longlen = _plpData?.SnapshotLongLen ?? 0;
3404+
_stateObj._longlenleft = _plpData?.SnapshotLongLenLeft ?? 0;
34063405

34073406
_stateObj._snapshotReplay = true;
34083407

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1104,18 +1104,31 @@ private void DumpBuffer() {
11041104

11051105
sealed partial class StateSnapshot
11061106
{
1107+
private sealed class PLPData
1108+
{
1109+
public readonly ulong SnapshotLongLen;
1110+
public readonly ulong SnapshotLongLenLeft;
1111+
1112+
public PLPData(ulong snapshotLongLen, ulong snapshotLongLenLeft)
1113+
{
1114+
SnapshotLongLen = snapshotLongLen;
1115+
SnapshotLongLenLeft = snapshotLongLenLeft;
1116+
}
1117+
}
1118+
11071119
private int _snapshotInBuffCurrent;
11081120
private int _snapshotInBytesUsed;
11091121
private int _snapshotInBytesPacket;
11101122

1123+
private PLPData _plpData;
1124+
11111125
private byte _snapshotMessageStatus;
11121126

11131127
private NullBitmap _snapshotNullBitmapInfo;
11141128
private _SqlMetaDataSet _snapshotCleanupMetaData;
11151129
private _SqlMetaDataSetCollection _snapshotCleanupAltMetaDataSetArray;
11161130

11171131
private TdsParserStateObject _stateObj;
1118-
11191132
#if DEBUG
11201133
private int _rollingPend = 0;
11211134
private int _rollingPendCount = 0;

0 commit comments

Comments
 (0)