Luciano Miguel Ferreira Rocha > MySQL-Binlog_RBR_Data-1.02 > MySQL::Binlog_RBR_Data

Download:
MySQL-Binlog_RBR_Data-1.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.02   Source  

NAME ^

MySQL::Binlog_RBR_Data - extract changed rows from RBR binlogs

SYNOPSIS ^

  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
  }

FUNCTIONS ^

parse

  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

  $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 ],
        ]
    ],
    ...
  }

AUTHOR ^

Luciano Rocha <luciano.rocha@booking.com>

COPYRIGHT ^

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.

syntax highlighting: