|
6 | 6 |
|
7 | 7 | namespace SciSharp.MySQL.Replication |
8 | 8 | { |
| 9 | + /// <summary> |
| 10 | + /// Represents a MySQL binary log event that contains rows updated in a table. |
| 11 | + /// This event is generated for an update operation on rows in a MySQL table and |
| 12 | + /// contains both the before and after values of the affected rows. |
| 13 | + /// </summary> |
9 | 14 | public sealed class UpdateRowsEvent : RowsEvent |
10 | 15 | { |
| 16 | + /// <summary> |
| 17 | + /// Gets the bitmap indicating which columns are included in the before-update image. |
| 18 | + /// </summary> |
11 | 19 | public BitArray IncludedColumnsBeforeUpdate { get; private set; } |
12 | 20 |
|
| 21 | + /// <summary> |
| 22 | + /// Reads the included columns bitmaps from the binary representation. |
| 23 | + /// For update events, this includes both the before and after update column bitmaps. |
| 24 | + /// </summary> |
| 25 | + /// <param name="reader">The sequence reader containing the binary data.</param> |
13 | 26 | protected override void ReadIncludedColumns(ref SequenceReader<byte> reader) |
14 | 27 | { |
15 | 28 | var columnCount = (int)reader.ReadLengthEncodedInteger(); |
16 | 29 | IncludedColumnsBeforeUpdate = reader.ReadBitArray(columnCount); |
17 | 30 | IncludedColumns = reader.ReadBitArray(columnCount); |
18 | 31 | } |
19 | 32 |
|
| 33 | + /// <summary> |
| 34 | + /// Reads the row data from the binary representation, including both |
| 35 | + /// before and after values for updated rows. |
| 36 | + /// </summary> |
| 37 | + /// <param name="reader">The sequence reader containing the binary data.</param> |
| 38 | + /// <param name="includedColumns">The bitmap of columns present in the row data.</param> |
| 39 | + /// <param name="tableMap">The table mapping information.</param> |
| 40 | + /// <param name="columnCount">The number of columns.</param> |
20 | 41 | protected override void ReadData(ref SequenceReader<byte> reader, BitArray includedColumns, TableMapEvent tableMap, int columnCount) |
21 | 42 | { |
22 | 43 | RowSet = ReadUpdatedRows(ref reader, tableMap, IncludedColumnsBeforeUpdate, includedColumns, columnCount); |
23 | 44 | } |
24 | 45 |
|
| 46 | + /// <summary> |
| 47 | + /// Reads the updated rows data from the binary representation. |
| 48 | + /// </summary> |
| 49 | + /// <param name="reader">The sequence reader containing the binary data.</param> |
| 50 | + /// <param name="tableMap">The table mapping information.</param> |
| 51 | + /// <param name="includedColumnsBeforeUpdate">The bitmap of columns included in the before-update image.</param> |
| 52 | + /// <param name="includedColumns">The bitmap of columns included in the after-update image.</param> |
| 53 | + /// <param name="columnCount">The number of columns.</param> |
| 54 | + /// <returns>A RowSet containing the updated rows data with both before and after values.</returns> |
25 | 55 | private RowSet ReadUpdatedRows(ref SequenceReader<byte> reader, TableMapEvent tableMap, BitArray includedColumnsBeforeUpdate, BitArray includedColumns, int columnCount) |
26 | 56 | { |
27 | 57 | var columnCountBeforeUpdate = GetIncludedColumnCount(IncludedColumnsBeforeUpdate); |
@@ -56,6 +86,10 @@ private RowSet ReadUpdatedRows(ref SequenceReader<byte> reader, TableMapEvent ta |
56 | 86 | }; |
57 | 87 | } |
58 | 88 |
|
| 89 | + /// <summary> |
| 90 | + /// Returns a string representation of the UpdateRowsEvent. |
| 91 | + /// </summary> |
| 92 | + /// <returns>A string containing the event type, table ID, and before/after row values.</returns> |
59 | 93 | public override string ToString() |
60 | 94 | { |
61 | 95 | var sb = new StringBuilder(); |
|
0 commit comments