From 525a788603387bcc8bf8b5d868d00ffbb153c492 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 30 Apr 2007 21:30:09 +0000 Subject: * improved error handling during installation and execution in case the DB-module can't be loaded (because of missing DBD::-modules). Closes ticket #118 git-svn-id: http://svn.openslx.org/svn/openslx/trunk@971 95ad53e4-c205-0410-b2fa-d234c58c8868 --- config-db/OpenSLX/ConfigDB.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'config-db') diff --git a/config-db/OpenSLX/ConfigDB.pm b/config-db/OpenSLX/ConfigDB.pm index 8023cd2a..78a13e05 100644 --- a/config-db/OpenSLX/ConfigDB.pm +++ b/config-db/OpenSLX/ConfigDB.pm @@ -168,7 +168,17 @@ sub connect $dbModule, $VERSION, $modVersion); } my $metaDB = $dbModule->new(); - $metaDB->connect($dbParams); + if (!eval '$metaDB->connect($dbParams);1') { + warn _tr("Unable to connect to DB-module <%s>\n%s", $dbModule, $@); + warn _tr("These DB-modules seem to work ok:"); + foreach my $dbMod ('CSV', 'mysql', 'SQLite') { + if (eval "require DBD::$dbMod;") { + vlog 0, "\t$dbMod\n"; + } + } + die _tr('Please use slxsettings to switch to another db-type.'); + } + $self->{'db-type'} = $dbType; $self->{'meta-db'} = $metaDB; foreach my $tk (keys %{$DbSchema->{tables}}) { -- cgit v1.2.3-55-g7522