Example #1
0
        /// <summary>
        /// Parses a row in a rows event.
        /// </summary>
        protected ColumnData ParseRow(ref PacketReader reader, TableMapEvent tableMap, bool[] columnsPresent, int cellsIncluded)
        {
            var row        = new object[tableMap.ColumnTypes.Length];
            var nullBitmap = reader.ReadBitmapLittleEndian(cellsIncluded);

            for (int i = 0, skippedColumns = 0; i < tableMap.ColumnTypes.Length; i++)
            {
                // Data is missing if binlog_row_image != full
                if (!columnsPresent[i])
                {
                    skippedColumns++;
                    continue;
                }

                int nullBitmapIndex = i - skippedColumns;
                if (!nullBitmap[nullBitmapIndex])
                {
                    int columnType = tableMap.ColumnTypes[i];
                    int metadata   = tableMap.ColumnMetadata[i];

                    if (columnType == (int)ColumnType.STRING)
                    {
                        GetActualStringType(ref columnType, ref metadata);
                    }
                    row[i] = ParseCell(ref reader, columnType, metadata);
                }
            }
            return(new ColumnData(row));
        }
Example #2
0
 private static async Task HandleTableMapEvent(TableMapEvent tableMap)
 {
     Console.WriteLine($"Processing {tableMap.DatabaseName}.{tableMap.TableName}");
     await PrintEventAsync(tableMap);
 }