summaryrefslogtreecommitdiff
path: root/debian/additions
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2022-05-24 10:56:25 +1000
committerDaniel Black <daniel@mariadb.org>2022-05-24 10:56:25 +1000
commita2bdd528358418608e5bacf17a0d70da83b763d5 (patch)
tree9fd30c8b627c5630c3a83b98dcbd8d3209d2c188 /debian/additions
parent0d9aba05ec6dd87fadbbca31aa1c0f3f4ee2b468 (diff)
parent443590406caf2b547e5697708c216ee52011b890 (diff)
downloadmariadb-git-a2bdd528358418608e5bacf17a0d70da83b763d5.tar.gz
Merge branch 10.5 into 10.6
Diffstat (limited to 'debian/additions')
-rwxr-xr-xdebian/additions/mariadb-report70
1 files changed, 50 insertions, 20 deletions
diff --git a/debian/additions/mariadb-report b/debian/additions/mariadb-report
index 5c9761e0710..ff73bb0e17e 100755
--- a/debian/additions/mariadb-report
+++ b/debian/additions/mariadb-report
@@ -239,26 +239,56 @@ sub get_user_mycnf
sub connect_to_MySQL
{
- print "connect_to_MySQL\n" if $op{debug};
-
- my $dsn;
-
- if($mycnf{'socket'} && -S $mycnf{'socket'})
- {
- $dsn = "DBI:MariaDB:mariadb_socket=$mycnf{socket}";
- }
- elsif($mycnf{'host'})
- {
- $dsn = "DBI:MariaDB:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : "");
- }
- else
- {
- $dsn = "DBI:MariaDB:host=localhost";
- }
-
- print "connect_to_MySQL: DBI DSN: $dsn\n" if $op{debug};
-
- $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die;
+ print "connect_to_MySQL\n" if $op{debug};
+
+ if(my @driverList = grep {/mariadb|mysql/i} DBI->available_drivers()) {
+ my $dsn;
+ my $driver = undef;
+
+ if(grep {/mariadb/i} @driverList)
+ {
+ $driver = "DBI:MariaDB";
+ }
+ elsif(grep {/mysql/i} @driverList)
+ {
+ $driver = "DBI:mysql";
+ }
+
+ if($mycnf{'socket'} && -S $mycnf{'socket'})
+ {
+ if(grep {/mariadb/i} @driverList)
+ {
+ $dsn = $driver . ":mariadb_socket=$mycnf{socket}";
+ }
+ elsif(grep {/mysql/i} @driverList)
+ {
+ $dsn = $driver . ":mysql_socket=$mycnf{socket}";
+ }
+ }
+ elsif($mycnf{'host'})
+ {
+ $dsn = $driver . ":host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : "");
+ }
+ else
+ {
+ $dsn = $driver . ":host=localhost";
+ }
+
+ print "connect_to_MySQL: DBI DSN: " . $dsn . "\n" if $op{debug};
+
+ $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die;
+ }
+ else
+ {
+ print STDERR "Install Perl 5.x driver: DBD:mysql or DBD:MariaDB\n";
+ print STDERR "currently installed Perl DBD drivers:\n";
+ foreach my $driver (DBI->available_drivers())
+ {
+ print STDERR " * " . $driver . "\n";
+ }
+ print STDERR "\n";
+ die("Exit as no MariaDB DBI driver found!\n");
+ }
}
sub collect_reports