4
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
5
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
6
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
10
use warnings FATAL => 'all';
11
use English qw(-no_match_vars);
12
use Test::More tests => 5;
22
my $tbl_struct = { is_col => {} }; # fake tbl_struct
26
sub { new TableSyncGroupBy() },
30
my $t = new TableSyncGroupBy(
34
my $ch = new ChangeHandler(
41
actions => [ sub { push @rows, $_[0] }, ],
48
tbl_struct => $tbl_struct,
57
'SELECT SQL_BUFFER_RESULT `a`, `b`, `c`, COUNT(*) AS __maatkit_count FROM `test`.`foo` '
58
. 'WHERE foo=1 GROUP BY `a`, `b`, `c` ORDER BY `a`, `b`, `c`',
59
'Got SQL with SQL_BUFFER_RESULT',
65
tbl_struct => $tbl_struct,
73
'SELECT `a`, `b`, `c`, COUNT(*) AS __maatkit_count FROM `test`.`foo` '
74
. 'WHERE foo=1 GROUP BY `a`, `b`, `c` ORDER BY `a`, `b`, `c`',
78
# Changed from undef to 0 due to r4802.
79
is( $t->done, 0, 'Not done yet' );
81
my $d = new RowDiff( dbh => 1 );
83
left_sth => new MockSth(
84
{ a => 1, b => 2, c => 3, __maatkit_count => 4 },
85
{ a => 2, b => 2, c => 3, __maatkit_count => 4 },
86
{ a => 3, b => 2, c => 3, __maatkit_count => 2 },
87
# { a => 4, b => 2, c => 3, __maatkit_count => 2 },
89
right_sth => new MockSth(
90
{ a => 1, b => 2, c => 3, __maatkit_count => 3 },
91
{ a => 2, b => 2, c => 3, __maatkit_count => 6 },
92
# { a => 3, b => 2, c => 3, __maatkit_count => 2 },
93
{ a => 4, b => 2, c => 3, __maatkit_count => 1 },
102
"INSERT INTO `test`.`foo`(`a`, `b`, `c`) VALUES ('1', '2', '3')",
103
"DELETE FROM `test`.`foo` WHERE `a`='2' AND `b`='2' AND `c`='3' LIMIT 1",
104
"DELETE FROM `test`.`foo` WHERE `a`='2' AND `b`='2' AND `c`='3' LIMIT 1",
105
"INSERT INTO `test`.`foo`(`a`, `b`, `c`) VALUES ('3', '2', '3')",
106
"INSERT INTO `test`.`foo`(`a`, `b`, `c`) VALUES ('3', '2', '3')",
107
"DELETE FROM `test`.`foo` WHERE `a`='4' AND `b`='2' AND `c`='3' LIMIT 1",