From d0fb3d4d75994271fcfe764ad3f7d7c4d314a068 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 29 Nov 2010 18:09:14 +0100 Subject: [PATCH] =?utf8?q?Suffix=20&=20Schema=20=C3=BCbergeben?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DBUpgrade2.pm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index 3d5d0de5c..ede7ef3ea 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -16,6 +16,14 @@ sub new { sub init { my ($self, %params) = @_; + if ($params{auth}) { + $params{path_suffix} = "-auth"; + $params{schema} = "auth."; + } + + $params{path_suffix} ||= ''; + $params{schame} ||= ''; + map { $self->{$_} = $params{$_} } keys %params; return $self; @@ -32,7 +40,7 @@ sub parse_dbupdate_controls { local *IN; my %all_controls; - my $path = "sql/" . $self->{dbdriver} . "-upgrade2"; + my $path = "sql/" . $self->{dbdriver} . "-upgrade2" . $self->{path_suffix}; foreach my $file_name (<$path/*.sql>, <$path/*.pl>) { next unless (open(IN, $file_name)); @@ -192,12 +200,9 @@ sub process_query { } if (ref($version_or_control) eq "HASH") { - $dbh->do("INSERT INTO schema_info (tag, login) VALUES (" . - $dbh->quote($version_or_control->{"tag"}) . ", " . - $dbh->quote($form->{"login"}) . ")"); + $dbh->do("INSERT INTO " . $self->{schema} . "schema_info (tag, login) VALUES (" . $dbh->quote($version_or_control->{"tag"}) . ", " . $dbh->quote($form->{"login"}) . ")"); } elsif ($version_or_control) { - $dbh->do("UPDATE defaults SET version = " . - $dbh->quote($version_or_control)); + $dbh->do("UPDATE defaults SET version = " . $dbh->quote($version_or_control)); } $dbh->commit(); @@ -266,12 +271,9 @@ sub process_perl_script { } if (ref($version_or_control) eq "HASH") { - $dbh->do("INSERT INTO schema_info (tag, login) VALUES (" . - $dbh->quote($version_or_control->{"tag"}) . ", " . - $dbh->quote($form->{"login"}) . ")"); + $dbh->do("INSERT INTO schema_info (tag, login) VALUES (" . $dbh->quote($version_or_control->{"tag"}) . ", " . $dbh->quote($form->{"login"}) . ")"); } elsif ($version_or_control) { - $dbh->do("UPDATE defaults SET version = " . - $dbh->quote($version_or_control)); + $dbh->do("UPDATE defaults SET version = " . $dbh->quote($version_or_control)); } $dbh->commit(); -- 2.20.1