Skip to content

Commit 0c8c2d3

Browse files
mohawk2dveeden
authored andcommitted
it seems catalogs *are* now supported - make statistics_info use them
1 parent 0f3a8ba commit 0c8c2d3

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/DBD/mysql.pm

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -738,12 +738,10 @@ EOF
738738
my @where;
739739
my @bind;
740740

741-
# catalogs are not yet supported by MySQL
742-
743-
# if (defined $catalog) {
744-
# push @where, 'TABLE_CATALOG = ?';
745-
# push @bind, $catalog;
746-
# }
741+
if (defined $catalog) {
742+
push @where, 'TABLE_CATALOG = ?';
743+
push @bind, $catalog;
744+
}
747745

748746
if (defined $schema) {
749747
push @where, 'TABLE_SCHEMA = ?';

t/40keyinfo.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,16 @@ is_deeply([ $dbh->primary_key(undef, undef, 'dbd_mysql_keyinfo') ], [ 'a', 'b' ]
4343

4444
$sth= $dbh->statistics_info(undef, undef, 'dbd_mysql_keyinfo', 0, 0);
4545
my $stats_info = $sth->fetchall_arrayref;
46+
my $n_catalogs = @$stats_info;
4647
my $n_unique = grep $_->[3], @$stats_info;
4748
$sth= $dbh->statistics_info(undef, undef, 'dbd_mysql_keyinfo', 1, 0);
4849
$stats_info = $sth->fetchall_arrayref;
4950
my $n_unique2 = grep $_->[3], @$stats_info;
5051
isnt($n_unique2, $n_unique, "Check statistics_info unique_only flag has an effect");
52+
$sth= $dbh->statistics_info('nonexist', undef, 'dbd_mysql_keyinfo', 0, 0);
53+
$stats_info = $sth->fetchall_arrayref;
54+
my $n_catalogs2 = @$stats_info;
55+
isnt($n_catalogs2, $n_catalogs, "Check statistics_info catalog arg has an effect");
5156

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

0 commit comments

Comments
 (0)