summaryrefslogtreecommitdiffstats
path: root/config-db/OpenSLX/MetaDB
diff options
context:
space:
mode:
authorOliver Tappe2007-06-20 20:04:19 +0200
committerOliver Tappe2007-06-20 20:04:19 +0200
commit898eca2232289d3f64431bc3763da4b65bb3ae61 (patch)
tree2a213ff0429b76037a6cc0f2fbf9f99ec025ed2a /config-db/OpenSLX/MetaDB
parent* added support for invoking a chrooted shell for any installed vendor-OS, (diff)
downloadcore-898eca2232289d3f64431bc3763da4b65bb3ae61.tar.gz
core-898eca2232289d3f64431bc3763da4b65bb3ae61.tar.xz
core-898eca2232289d3f64431bc3763da4b65bb3ae61.zip
* split export type into filesystem and (optional) blockdevice, closing
ticket#139 * code-reformatting with perltidy git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1176 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/OpenSLX/MetaDB')
-rw-r--r--config-db/OpenSLX/MetaDB/Base.pm2
-rw-r--r--config-db/OpenSLX/MetaDB/CSV.pm2
-rw-r--r--config-db/OpenSLX/MetaDB/DBI.pm36
-rw-r--r--config-db/OpenSLX/MetaDB/SQLite.pm10
-rw-r--r--config-db/OpenSLX/MetaDB/mysql.pm22
5 files changed, 36 insertions, 36 deletions
diff --git a/config-db/OpenSLX/MetaDB/Base.pm b/config-db/OpenSLX/MetaDB/Base.pm
index 74daf5f1..2738cb16 100644
--- a/config-db/OpenSLX/MetaDB/Base.pm
+++ b/config-db/OpenSLX/MetaDB/Base.pm
@@ -287,7 +287,7 @@ OpenSLX::MetaDB::Base - the base class for all MetaDB drivers
my $self = shift;
my $dbName = $openslxConfig{'db-name'};
- vlog 1, "trying to connect to coolnewDB-database <$dbName>";
+ vlog(1, "trying to connect to coolnewDB-database <$dbName>");
$self->{'dbh'} = ... # get connection handle from coolnewDB
}
diff --git a/config-db/OpenSLX/MetaDB/CSV.pm b/config-db/OpenSLX/MetaDB/CSV.pm
index cd2a7da4..bee5ca80 100644
--- a/config-db/OpenSLX/MetaDB/CSV.pm
+++ b/config-db/OpenSLX/MetaDB/CSV.pm
@@ -54,7 +54,7 @@ sub connect
system("mkdir -p $dbPath") unless -e $dbPath;
$dbSpec = "f_dir=$dbPath;csv_eol=\n;";
}
- vlog 1, "trying to connect to CSV-database <$dbSpec>";
+ vlog(1, "trying to connect to CSV-database <$dbSpec>");
$self->{'dbh'} = DBI->connect("dbi:CSV:$dbSpec", undef, undef,
{PrintError => 0})
or die _tr("Cannot connect to database '%s' (%s)",
diff --git a/config-db/OpenSLX/MetaDB/DBI.pm b/config-db/OpenSLX/MetaDB/DBI.pm
index e59c9996..54d567cf 100644
--- a/config-db/OpenSLX/MetaDB/DBI.pm
+++ b/config-db/OpenSLX/MetaDB/DBI.pm
@@ -85,7 +85,7 @@ sub _doSelect
my $dbh = $self->{'dbh'};
- vlog 3, _trim($sql);
+ vlog(3, _trim($sql));
my $sth = $dbh->prepare($sql)
or confess _tr(q[Can't prepare SQL-statement <%s> (%s)], $sql,
$dbh->errstr);
@@ -377,12 +377,12 @@ sub _doInsert
if (!defined $valRow->{id} && !$ignoreIDs && $needToGenerateIDs) {
# let DB-backend pre-specify ID, as current DB can't generate IDs:
$valRow->{id} = $self->generateNextIdForTable($table);
- vlog 3, "generated id for <$table> is <$valRow->{id}>";
+ vlog(3, "generated id for <$table> is <$valRow->{id}>");
}
my $cols = join ', ', keys %$valRow;
my $values = join ', ', map { $self->quote($valRow->{$_}) } keys %$valRow;
my $sql = "INSERT INTO $table ( $cols ) VALUES ( $values )";
- vlog 3, $sql;
+ vlog(3, $sql);
my $sth = $dbh->prepare($sql)
or confess _tr(q[Can't insert into table <%s> (%s)], $table,
$dbh->errstr);
@@ -392,7 +392,7 @@ sub _doInsert
if (!$ignoreIDs && !defined $valRow->{id}) {
# id has not been pre-specified, we need to fetch it from DB:
$valRow->{'id'} = $dbh->last_insert_id(undef, undef, $table, 'id');
- vlog 3, "DB-generated id for <$table> is <$valRow->{id}>";
+ vlog(3, "DB-generated id for <$table> is <$valRow->{id}>");
}
push @ids, $valRow->{'id'};
}
@@ -419,7 +419,7 @@ sub _doDelete
$sql .= $additionalWhereClause;
}
}
- vlog 3, $sql;
+ vlog(3, $sql);
my $sth = $dbh->prepare($sql)
or confess _tr(q[Can't delete from table <%s> (%s)], $table,
$dbh->errstr);
@@ -457,7 +457,7 @@ sub _doUpdate
if (defined $id) {
$sql .= " WHERE id = ".$self->quote($id);
}
- vlog 3, $sql;
+ vlog(3, $sql);
my $sth = $dbh->prepare($sql)
or confess _tr(q[Can't update table <%s> (%s)], $table, $dbh->errstr);
$sth->execute()
@@ -823,10 +823,10 @@ sub schemaAddTable
my $isSubCmd = shift;
my $dbh = $self->{'dbh'};
- vlog 1, "adding table <$table> to schema..." unless $isSubCmd;
+ vlog(1, "adding table <$table> to schema..." unless $isSubCmd);
my $colDescrString = $self->_convertColDescrsToDBNativeString($colDescrs);
my $sql = "CREATE TABLE $table ($colDescrString)";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't create table <%s> (%s)], $table, $dbh->errstr);
if (defined $initialVals) {
@@ -843,9 +843,9 @@ sub schemaDropTable
my $isSubCmd = shift;
my $dbh = $self->{'dbh'};
- vlog 1, "dropping table <$table> from schema..." unless $isSubCmd;
+ vlog(1, "dropping table <$table> from schema..." unless $isSubCmd);
my $sql = "DROP TABLE $table";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't drop table <%s> (%s)], $table, $dbh->errstr);
}
@@ -866,17 +866,17 @@ sub schemaRenameTable
my $isSubCmd = shift;
my $dbh = $self->{'dbh'};
- vlog 1, "renaming table <$oldTable> to <$newTable>..." unless $isSubCmd;
+ vlog(1, "renaming table <$oldTable> to <$newTable>..." unless $isSubCmd);
my $colDescrString = $self->_convertColDescrsToDBNativeString($colDescrs);
my $sql = "CREATE TABLE $newTable ($colDescrString)";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't create table <%s> (%s)], $oldTable, $dbh->errstr);
my $colNamesString = $self->_convertColDescrsToColNamesString($colDescrs);
my @dataRows = $self->_doSelect("SELECT $colNamesString FROM $oldTable");
$self->_doInsert($newTable, \@dataRows);
$sql = "DROP TABLE $oldTable";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't drop table <%s> (%s)], $oldTable, $dbh->errstr);
}
@@ -902,7 +902,7 @@ sub schemaAddColumns
my $tempTable = "${table}_temp";
my @newColNames = $self->_convertColDescrsToColNames($newColDescrs);
my $newColStr = join ', ', @newColNames;
- vlog 1, "adding columns <$newColStr> to table <$table>..." unless $isSubCmd;
+ vlog(1, "adding columns <$newColStr> to table <$table>..." unless $isSubCmd);
$self->schemaAddTable($tempTable, $colDescrs, undef, 1);
# copy the data from the old table to the new:
@@ -940,8 +940,8 @@ sub schemaDropColumns
my $dbh = $self->{'dbh'};
my $tempTable = "${table}_temp";
my $dropColStr = join ', ', @$dropColNames;
- vlog 1, "dropping columns <$dropColStr> from table <$table>..."
- unless $isSubCmd;
+ vlog(1, "dropping columns <$dropColStr> from table <$table>..."
+ unless $isSubCmd);
$self->schemaAddTable($tempTable, $colDescrs, undef, 1);
# copy the data from the old table to the new:
@@ -972,8 +972,8 @@ sub schemaChangeColumns
my $dbh = $self->{'dbh'};
my $tempTable = "${table}_temp";
my $changeColStr = join ', ', keys %$colChanges;
- vlog 1, "changing columns <$changeColStr> of table <$table>..."
- unless $isSubCmd;
+ vlog(1, "changing columns <$changeColStr> of table <$table>..."
+ unless $isSubCmd);
$self->schemaAddTable($tempTable, $colDescrs, undef, 1);
# copy the data from the old table to the new:
diff --git a/config-db/OpenSLX/MetaDB/SQLite.pm b/config-db/OpenSLX/MetaDB/SQLite.pm
index d2b91a03..d073f305 100644
--- a/config-db/OpenSLX/MetaDB/SQLite.pm
+++ b/config-db/OpenSLX/MetaDB/SQLite.pm
@@ -51,7 +51,7 @@ sub connect
system("mkdir -p $dbPath") unless -e $dbPath;
$dbSpec = "dbname=$dbPath/$openslxConfig{'db-name'}";
}
- vlog 1, "trying to connect to SQLite-database <$dbSpec>";
+ 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', $@);
@@ -70,9 +70,9 @@ sub schemaRenameTable
my $isSubCmd = shift;
my $dbh = $self->{'dbh'};
- vlog 1, "renaming table <$oldTable> to <$newTable>..." unless $isSubCmd;
+ vlog(1, "renaming table <$oldTable> to <$newTable>..." unless $isSubCmd);
my $sql = "ALTER TABLE $oldTable RENAME TO $newTable";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't rename table <%s> (%s)], $oldTable, $dbh->errstr);
}
@@ -88,12 +88,12 @@ sub schemaAddColumns
my $dbh = $self->{'dbh'};
my $newColNames = $self->_convertColDescrsToColNamesString($newColDescrs);
- vlog 1, "adding columns <$newColNames> to table <$table>" unless $isSubCmd;
+ vlog(1, "adding columns <$newColNames> to table <$table>" unless $isSubCmd);
foreach my $colDescr (@$newColDescrs) {
my $colDescrString
= $self->_convertColDescrsToDBNativeString([$colDescr]);
my $sql = "ALTER TABLE $table ADD COLUMN $colDescrString";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't add column to table <%s> (%s)], $table,
$dbh->errstr);
diff --git a/config-db/OpenSLX/MetaDB/mysql.pm b/config-db/OpenSLX/MetaDB/mysql.pm
index 25cc93a8..eb6f9551 100644
--- a/config-db/OpenSLX/MetaDB/mysql.pm
+++ b/config-db/OpenSLX/MetaDB/mysql.pm
@@ -48,7 +48,7 @@ sub connect
$dbSpec = "database=$openslxConfig{'db-name'}";
}
my $user = (getpwuid($>))[0];
- vlog 1, "trying to connect user <$user> to mysql-database <$dbSpec>";
+ vlog(1, "trying to connect user <$user> to mysql-database <$dbSpec>");
$self->{'dbh'} = DBI->connect("dbi:mysql:$dbSpec", $user, '',
{PrintError => 0})
or die _tr("Cannot connect to database <%s> (%s)",
@@ -84,9 +84,9 @@ sub schemaRenameTable
my $isSubCmd = shift;
my $dbh = $self->{'dbh'};
- vlog 1, "renaming table <$oldTable> to <$newTable>..." unless $isSubCmd;
+ vlog(1, "renaming table <$oldTable> to <$newTable>..." unless $isSubCmd);
my $sql = "ALTER TABLE $oldTable RENAME TO $newTable";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't rename table <%s> (%s)], $oldTable, $dbh->errstr);
}
@@ -102,7 +102,7 @@ sub schemaAddColumns
my $dbh = $self->{'dbh'};
my $newColNames = $self->_convertColDescrsToColNamesString($newColDescrs);
- vlog 1, "adding columns <$newColNames> to table <$table>" unless $isSubCmd;
+ vlog(1, "adding columns <$newColNames> to table <$table>" unless $isSubCmd);
my $addClause
= join ', ',
map {
@@ -111,7 +111,7 @@ sub schemaAddColumns
}
@$newColDescrs;
my $sql = "ALTER TABLE $table $addClause";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't add columns to table <%s> (%s)], $table,
$dbh->errstr);
@@ -131,11 +131,11 @@ sub schemaDropColumns
my $dbh = $self->{'dbh'};
my $dropColStr = join ', ', @$dropColNames;
- vlog 1, "dropping columns <$dropColStr> from table <$table>..."
- unless $isSubCmd;
+ vlog(1, "dropping columns <$dropColStr> from table <$table>..."
+ unless $isSubCmd);
my $dropClause = join ', ', map { "DROP COLUMN $_" } @$dropColNames;
my $sql = "ALTER TABLE $table $dropClause";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't drop columns from table <%s> (%s)], $table,
$dbh->errstr);
@@ -151,8 +151,8 @@ sub schemaChangeColumns
my $dbh = $self->{'dbh'};
my $changeColStr = join ', ', keys %$colChanges;
- vlog 1, "changing columns <$changeColStr> in table <$table>..."
- unless $isSubCmd;
+ vlog(1, "changing columns <$changeColStr> in table <$table>..."
+ unless $isSubCmd);
my $changeClause
= join ', ',
map {
@@ -161,7 +161,7 @@ sub schemaChangeColumns
}
keys %$colChanges;
my $sql = "ALTER TABLE $table $changeClause";
- vlog 3, $sql;
+ vlog(3, $sql);
$dbh->do($sql)
or confess _tr(q[Can't change columns in table <%s> (%s)], $table,
$dbh->errstr);