diff options
author | Oliver Tappe | 2006-10-06 14:20:21 +0200 |
---|---|---|
committer | Oliver Tappe | 2006-10-06 14:20:21 +0200 |
commit | f4a1ab3c8bf782d14e7da07f1ed186a0755a6384 (patch) | |
tree | ee4678efc066ac86e14f35f71df8415da6a23d31 /config-db | |
parent | * minor formatting corrections (diff) | |
download | core-f4a1ab3c8bf782d14e7da07f1ed186a0755a6384.tar.gz core-f4a1ab3c8bf782d14e7da07f1ed186a0755a6384.tar.xz core-f4a1ab3c8bf782d14e7da07f1ed186a0755a6384.zip |
* added explicit check for required DBD-module in order to give a precise error-message
if the respective db-module is not installed.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@443 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db')
-rw-r--r-- | config-db/OpenSLX/MetaDB/CSV.pm | 7 | ||||
-rw-r--r-- | config-db/OpenSLX/MetaDB/SQLite.pm | 9 | ||||
-rw-r--r-- | config-db/OpenSLX/MetaDB/mysql.pm | 7 |
3 files changed, 16 insertions, 7 deletions
diff --git a/config-db/OpenSLX/MetaDB/CSV.pm b/config-db/OpenSLX/MetaDB/CSV.pm index bfcac9d8..081b70d9 100644 --- a/config-db/OpenSLX/MetaDB/CSV.pm +++ b/config-db/OpenSLX/MetaDB/CSV.pm @@ -52,10 +52,13 @@ sub connectConfigDB $dbSpec = "f_dir=$dbPath"; } vlog 1, "trying to connect to CSV-database <$dbSpec>"; + eval ('require DBD::CSV; 1;') + or die _tr("DBD::CSV doesn't seem to be installed, " + ."so there is no support for CSV available, sorry!\n"); $self->{'dbh'} = DBI->connect("dbi:CSV:$dbSpec", undef, undef, {PrintError => 0}) - or confess _tr("Cannot connect to database <%s> (%s)"), - $dbSpec, $DBI::errstr; + or confess _tr("Cannot connect to database <%s> (%s)", + $dbSpec, $DBI::errstr); } sub quote diff --git a/config-db/OpenSLX/MetaDB/SQLite.pm b/config-db/OpenSLX/MetaDB/SQLite.pm index 5f8afe15..09641c46 100644 --- a/config-db/OpenSLX/MetaDB/SQLite.pm +++ b/config-db/OpenSLX/MetaDB/SQLite.pm @@ -49,10 +49,13 @@ sub connectConfigDB $dbSpec = "dbname=$dbPath/$openslxConfig{'db-name'}"; } vlog 1, "trying to connect to SQLite-database <$dbSpec>"; + eval ('require DBD::SQLite; 1;') + or die _tr("DBD::SQLite doesn't seem to be installed, " + ."so there is no support for SQLite available, sorry!\n"); $self->{'dbh'} = DBI->connect("dbi:SQLite:$dbSpec", undef, undef, - {PrintError => 0}) - or confess _tr("Cannot connect to database <%s> (%s)"), - $dbSpec, $DBI::errstr; + {PrintError => 0, AutoCommit => 1}) + or confess _tr("Cannot connect to database <%s> (%s)", + $dbSpec, $DBI::errstr); } sub schemaRenameTable diff --git a/config-db/OpenSLX/MetaDB/mysql.pm b/config-db/OpenSLX/MetaDB/mysql.pm index 648fbd6b..1974a549 100644 --- a/config-db/OpenSLX/MetaDB/mysql.pm +++ b/config-db/OpenSLX/MetaDB/mysql.pm @@ -46,10 +46,13 @@ sub connectConfigDB } my $user = (getpwuid($>))[0]; vlog 1, "trying to connect user <$user> to mysql-database <$dbSpec>"; + eval ('require DBD::mysql; 1;') + or die _tr("DBD::mysql doesn't seem to be installed, " + ."so there is no support for mysql available, sorry!\n"); $self->{'dbh'} = DBI->connect("dbi:mysql:$dbSpec", $user, '', {PrintError => 0}) - or confess _tr("Cannot connect to database <%s> (%s)"), - $dbSpec, $DBI::errstr; + or confess _tr("Cannot connect to database <%s> (%s)", + $dbSpec, $DBI::errstr); } sub schemaConvertTypeDescrToNative |