MySQL::Binlog_RBR_Data - extract changed rows from RBR binlogs
use MySQL::Binlog_RBR_Data; open my $binlog, "mysqlbinlog --base64-output=DECODE-ROWS --verbose binlog.000999|"; my $parser = MySQL::Binlog_RBR_Data->parse( $binlog, 0, qw( accounts.User visits.Pageviews ), ); while ( my $trans = $parser->() ) { # do stuff }
my $parser = MySQL::Binlog_RBR_Data->parse( $file_handle ); my $parser = MySQL::Binlog_RBR_Data->parse( $file_handle, $start_position ); my $parser = MySQL::Binlog_RBR_Data->parse( $file_handle, $start_position, @tables_interested_in )
Returns a closure that will itself return the data for the next transaction, or undef if no more data is available.
$parser->()
Returned by parse, it will return an hashref with the data for the next transaction, or false if no more data is available.
The returned hash has the structure:
{ end_position => <number>, start_position => <number>, <table> => [ # changed rows [ # updated row: [ new row values ], [ old row values ], ], [ # inserted row: [ new row values ], ] [ # deleted row: undef, [ old row values ], ] ], ... }
Luciano Rocha <luciano.rocha@booking.com>
Copyright (C) 2012 by Booking.com.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.
To install MySQL::Binlog_RBR_Data, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MySQL::Binlog_RBR_Data
CPAN shell
perl -MCPAN -e shell install MySQL::Binlog_RBR_Data
For more information on module installation, please visit the detailed CPAN module installation guide.