Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make statistics_info use catalog arg #444

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions lib/DBD/mysql.pm
Original file line number Diff line number Diff line change
Expand Up @@ -738,12 +738,10 @@ EOF
my @where;
my @bind;

# catalogs are not yet supported by MySQL

# if (defined $catalog) {
# push @where, 'TABLE_CATALOG = ?';
# push @bind, $catalog;
# }
if (defined $catalog) {
push @where, 'TABLE_CATALOG = ?';
push @bind, $catalog;
}

if (defined $schema) {
push @where, 'TABLE_SCHEMA = ?';
Expand Down
5 changes: 5 additions & 0 deletions t/40keyinfo.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ is_deeply([ $dbh->primary_key(undef, undef, 'dbd_mysql_keyinfo') ], [ 'a', 'b' ]

$sth= $dbh->statistics_info(undef, undef, 'dbd_mysql_keyinfo', 0, 0);
my $stats_info = $sth->fetchall_arrayref;
my $n_catalogs = @$stats_info;
my $n_unique = grep $_->[3], @$stats_info;
$sth= $dbh->statistics_info(undef, undef, 'dbd_mysql_keyinfo', 1, 0);
$stats_info = $sth->fetchall_arrayref;
my $n_unique2 = grep $_->[3], @$stats_info;
isnt($n_unique2, $n_unique, "Check statistics_info unique_only flag has an effect");
$sth= $dbh->statistics_info('nonexist', undef, 'dbd_mysql_keyinfo', 0, 0);
$stats_info = $sth->fetchall_arrayref;
my $n_catalogs2 = @$stats_info;
isnt($n_catalogs2, $n_catalogs, "Check statistics_info catalog arg has an effect");

ok($dbh->do("DROP TABLE dbd_mysql_keyinfo"), "Dropped table");

Expand Down