Skip to content

Commit

Permalink
it seems catalogs *are* now supported - make statistics_info use them
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 authored and dveeden committed Oct 28, 2024
1 parent 0f3a8ba commit 0c8c2d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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

0 comments on commit 0c8c2d3

Please sign in to comment.