summaryrefslogtreecommitdiffstats
path: root/config-db/OpenSLX/MetaDB
diff options
context:
space:
mode:
authorOliver Tappe2007-07-01 22:28:50 +0200
committerOliver Tappe2007-07-01 22:28:50 +0200
commit6974fa8b0419bbd0711f79c8b78e07a9543810dd (patch)
tree25141f0f4d20ca8fdb1c845edf5b9ce4b24a6e98 /config-db/OpenSLX/MetaDB
parentTried to add Ubuntu 7.04 to the list of cloneable systems. (diff)
downloadcore-6974fa8b0419bbd0711f79c8b78e07a9543810dd.tar.gz
core-6974fa8b0419bbd0711f79c8b78e07a9543810dd.tar.xz
core-6974fa8b0419bbd0711f79c8b78e07a9543810dd.zip
* activated 'use warnings' to all modules and adjusted all occurences of
'use of uninitialized values', a couple of which might still show up * adjusted all code with respect to passing perlcritic level 4 and 5 git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1207 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/OpenSLX/MetaDB')
-rw-r--r--config-db/OpenSLX/MetaDB/Base.pm6
-rw-r--r--config-db/OpenSLX/MetaDB/CSV.pm7
-rw-r--r--config-db/OpenSLX/MetaDB/DBI.pm8
-rw-r--r--config-db/OpenSLX/MetaDB/SQLite.pm20
-rw-r--r--config-db/OpenSLX/MetaDB/mysql.pm7
5 files changed, 16 insertions, 32 deletions
diff --git a/config-db/OpenSLX/MetaDB/Base.pm b/config-db/OpenSLX/MetaDB/Base.pm
index 2738cb16..2aa1c3f2 100644
--- a/config-db/OpenSLX/MetaDB/Base.pm
+++ b/config-db/OpenSLX/MetaDB/Base.pm
@@ -14,11 +14,11 @@
package OpenSLX::MetaDB::Base;
use strict;
+use warnings;
-use vars qw($VERSION);
-$VERSION = 1.01; # API-version . implementation-version
+our $VERSION = 1.01; # API-version . implementation-version
-use Carp;
+use OpenSLX::Basics;
################################################################################
### basic functions
diff --git a/config-db/OpenSLX/MetaDB/CSV.pm b/config-db/OpenSLX/MetaDB/CSV.pm
index 104a4d98..ef96833a 100644
--- a/config-db/OpenSLX/MetaDB/CSV.pm
+++ b/config-db/OpenSLX/MetaDB/CSV.pm
@@ -14,8 +14,8 @@
package OpenSLX::MetaDB::CSV;
use strict;
-use vars qw($VERSION);
-$VERSION = 1.01; # API-version . implementation-version
+use warnings;
+
use base qw(OpenSLX::MetaDB::DBI);
################################################################################
@@ -24,12 +24,9 @@ use base qw(OpenSLX::MetaDB::DBI);
### - each table will be stored into a CSV file.
### - by default all files will be created inside a 'openslxdata-csv' directory.
################################################################################
-use strict;
-use Carp;
use Fcntl qw(:DEFAULT :flock);
use DBD::CSV 0.22;
use OpenSLX::Basics;
-use OpenSLX::MetaDB::DBI 1;
################################################################################
### implementation
diff --git a/config-db/OpenSLX/MetaDB/DBI.pm b/config-db/OpenSLX/MetaDB/DBI.pm
index ea0b66f1..91d774c7 100644
--- a/config-db/OpenSLX/MetaDB/DBI.pm
+++ b/config-db/OpenSLX/MetaDB/DBI.pm
@@ -14,14 +14,12 @@
package OpenSLX::MetaDB::DBI;
use strict;
-use vars qw($VERSION);
-$VERSION = 1.01; # API-version . implementation-version
+use warnings;
+
use base qw(OpenSLX::MetaDB::Base);
-use Carp;
use DBI;
use OpenSLX::Basics;
-use OpenSLX::MetaDB::Base 1;
################################################################################
### basics
@@ -783,7 +781,7 @@ sub schemaFetchDBVersion
eval { $dbh->selectrow_hashref('SELECT schema_version FROM meta'); };
return 0 if $@;
# no database access possible
- return undef unless defined $row;
+ return unless defined $row;
# no entry in meta-table
return $row->{schema_version};
}
diff --git a/config-db/OpenSLX/MetaDB/SQLite.pm b/config-db/OpenSLX/MetaDB/SQLite.pm
index 65e1668c..d6681ce6 100644
--- a/config-db/OpenSLX/MetaDB/SQLite.pm
+++ b/config-db/OpenSLX/MetaDB/SQLite.pm
@@ -14,19 +14,16 @@
package OpenSLX::MetaDB::SQLite;
use strict;
-use vars qw($VERSION);
-$VERSION = 1.01; # API-version . implementation-version
+use warnings;
+
use base qw(OpenSLX::MetaDB::DBI);
################################################################################
### This class provides a MetaDB backend for SQLite databases.
### - by default the db will be created inside a 'openslxdata-sqlite' directory.
################################################################################
-use strict;
-use Carp;
use DBD::SQLite;
use OpenSLX::Basics;
-use OpenSLX::MetaDB::DBI 1;
################################################################################
### implementation
@@ -52,16 +49,11 @@ sub connect
$dbSpec = "dbname=$dbPath/$openslxConfig{'db-name'}";
}
vlog(1, "trying to connect to SQLite-database <$dbSpec>");
- eval('require DBD::SQLite; 1;')
- or die _tr(
- qq[%s doesn't seem to be installed,
-so there is no support for %s available, sorry!\n%s], 'DBD::SQLite', 'SQLite',
- $@
- );
$self->{'dbh'} =
DBI->connect("dbi:SQLite:$dbSpec", undef, undef,
{PrintError => 0, AutoCommit => 1})
or die _tr("Cannot connect to database <%s> (%s)", $dbSpec, $DBI::errstr);
+ return 1;
}
sub schemaRenameTable
@@ -77,7 +69,7 @@ sub schemaRenameTable
my $sql = "ALTER TABLE $oldTable RENAME TO $newTable";
vlog(3, $sql);
$dbh->do($sql)
- or confess _tr(q[Can't rename table <%s> (%s)], $oldTable, $dbh->errstr);
+ or croak(_tr(q[Can't rename table <%s> (%s)], $oldTable, $dbh->errstr));
}
sub schemaAddColumns
@@ -99,8 +91,8 @@ sub schemaAddColumns
my $sql = "ALTER TABLE $table ADD COLUMN $colDescrString";
vlog(3, $sql);
$dbh->do($sql)
- or confess _tr(q[Can't add column to table <%s> (%s)], $table,
- $dbh->errstr);
+ or croak(_tr(q[Can't add column to table <%s> (%s)], $table,
+ $dbh->errstr));
}
# if default values have been provided, we apply them now:
if (defined $newColDefaultVals) {
diff --git a/config-db/OpenSLX/MetaDB/mysql.pm b/config-db/OpenSLX/MetaDB/mysql.pm
index 195f9870..769506d1 100644
--- a/config-db/OpenSLX/MetaDB/mysql.pm
+++ b/config-db/OpenSLX/MetaDB/mysql.pm
@@ -14,19 +14,16 @@
package OpenSLX::MetaDB::mysql;
use strict;
-use vars qw($VERSION);
-$VERSION = 1.01; # API-version . implementation-version
+use warnings;
+
use base qw(OpenSLX::MetaDB::DBI);
################################################################################
### This class provides a MetaDB backend for mysql databases.
### - by default the db will be created inside a 'openslxdata-mysql' directory.
################################################################################
-use strict;
-use Carp;
use DBD::mysql;
use OpenSLX::Basics;
-use OpenSLX::MetaDB::DBI 1;
################################################################################
### implementation