Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d0fb3d4d

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID d0fb3d4d75994271fcfe764ad3f7d7c4d314a068
  • Vorgänger 0b6cb3b8
  • Nachfolger dbcd72ed

Suffix & Schema übergeben

Unterschiede anzeigen:

SL/DBUpgrade2.pm
16 16
sub init {
17 17
  my ($self, %params) = @_;
18 18

  
19
  if ($params{auth}) {
20
    $params{path_suffix} = "-auth";
21
    $params{schema}      = "auth.";
22
  }
23

  
24
  $params{path_suffix} ||= '';
25
  $params{schame}      ||= '';
26

  
19 27
  map { $self->{$_} = $params{$_} } keys %params;
20 28

  
21 29
  return $self;
......
32 40
  local *IN;
33 41
  my %all_controls;
34 42

  
35
  my $path = "sql/" . $self->{dbdriver} . "-upgrade2";
43
  my $path = "sql/" . $self->{dbdriver} . "-upgrade2" . $self->{path_suffix};
36 44

  
37 45
  foreach my $file_name (<$path/*.sql>, <$path/*.pl>) {
38 46
    next unless (open(IN, $file_name));
......
192 200
  }
193 201

  
194 202
  if (ref($version_or_control) eq "HASH") {
195
    $dbh->do("INSERT INTO schema_info (tag, login) VALUES (" .
196
             $dbh->quote($version_or_control->{"tag"}) . ", " .
197
             $dbh->quote($form->{"login"}) . ")");
203
    $dbh->do("INSERT INTO " . $self->{schema} . "schema_info (tag, login) VALUES (" . $dbh->quote($version_or_control->{"tag"}) . ", " . $dbh->quote($form->{"login"}) . ")");
198 204
  } elsif ($version_or_control) {
199
    $dbh->do("UPDATE defaults SET version = " .
200
             $dbh->quote($version_or_control));
205
    $dbh->do("UPDATE defaults SET version = " . $dbh->quote($version_or_control));
201 206
  }
202 207
  $dbh->commit();
203 208

  
......
266 271
  }
267 272

  
268 273
  if (ref($version_or_control) eq "HASH") {
269
    $dbh->do("INSERT INTO schema_info (tag, login) VALUES (" .
270
             $dbh->quote($version_or_control->{"tag"}) . ", " .
271
             $dbh->quote($form->{"login"}) . ")");
274
    $dbh->do("INSERT INTO schema_info (tag, login) VALUES (" . $dbh->quote($version_or_control->{"tag"}) . ", " . $dbh->quote($form->{"login"}) . ")");
272 275
  } elsif ($version_or_control) {
273
    $dbh->do("UPDATE defaults SET version = " .
274
             $dbh->quote($version_or_control));
276
    $dbh->do("UPDATE defaults SET version = " . $dbh->quote($version_or_control));
275 277
  }
276 278
  $dbh->commit();
277 279

  

Auch abrufbar als: Unified diff