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;
20
my $rd = new RowDiff( dbh => 1 );
27
push @rows, 'not in left';
30
push @rows, 'not in right';
33
my $mss = new MockSyncStream(
34
query => 'SELECT a, b, c FROM foo WHERE id = 1',
36
same_row => \&same_row,
37
not_in_left => \¬_in_left,
38
not_in_right => \¬_in_right,
43
'SELECT a, b, c FROM foo WHERE id = 1',
47
is( $mss->done(), undef, 'Not done yet' );
51
left_sth => new MockSth(
52
{ a => 1, b => 2, c => 3 },
53
{ a => 2, b => 2, c => 3 },
54
{ a => 3, b => 2, c => 3 },
55
# { a => 4, b => 2, c => 3 },
57
right_sth => new MockSth(
58
# { a => 1, b => 2, c => 3 },
59
{ a => 2, b => 2, c => 3 },
60
{ a => 3, b => 2, c => 3 },
61
{ a => 4, b => 2, c => 3 },
77
# #############################################################################
78
# Test online stuff, e.g. get_cols_and_struct().
79
# #############################################################################
82
my $dp = new DSNParser(opts=>$dsn_opts);
83
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
84
my $dbh = $sb->get_dbh_for('master');
87
skip 'Cannot connect to sandbox mater', 2 unless $dbh;
89
diag(`/tmp/12345/use -e 'CREATE DATABASE test' 2>/dev/null`);
90
diag(`/tmp/12345/use < $trunk/t/lib/samples/col_types.sql`);
92
my $sth = $dbh->prepare('SELECT * FROM test.col_types_1');
95
MockSyncStream::get_result_set_struct($dbh, $sth),
165
c2 => 1, # it's really not but this is a sth limitation
182
'Gets result set struct from sth attribs'
185
$sth = $dbh->prepare('SELECT v, c, t, id, i, f, d FROM test.col_types_1');
187
my $row = $sth->fetchrow_hashref();
189
MockSyncStream::as_arrayref($sth, $row),
190
['hello world','c','this is text',1,1,3.14,5.08,],
195
$sb->wipe_clean($dbh);
199
# #############################################################################
201
# #############################################################################