Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7edc2444

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 7edc24445cf7d204f1a4693daed38d866ee9f422
  • Vorgänger f964437c
  • Nachfolger c2230797

DBI::connect-Options für UTF-8-Encoding auch beim Einspielen von Datenbankupgrades verwenden

Ansonsten werden von Perl-Upgradescripten ausgegebene Daten falsch
encodiert angezeigt.

Unterschiede anzeigen:

SL/User.pm
105 105
    my %myconfig = $main::auth->read_user(login => $self->{login});
106 106

  
107 107
    # check if database is down
108
    my $dbh = SL::DBConnect->connect($myconfig{dbconnect}, $myconfig{dbuser}, $myconfig{dbpasswd})
108
    my $dbh = SL::DBConnect->connect($myconfig{dbconnect}, $myconfig{dbuser}, $myconfig{dbpasswd}, SL::DBConnect->get_options)
109 109
      or $self->error($DBI::errstr);
110 110

  
111 111
    # we got a connection, check the version
......
245 245
  $form->{sid} = $form->{dbdefault};
246 246
  &dbconnect_vars($form, $form->{dbdefault});
247 247

  
248
  my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
248
  my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
249 249
    or $form->dberror;
250 250

  
251 251
  if ($form->{dbdriver} eq 'Pg') {
......
262 262
        next if ($db =~ /^template/);
263 263

  
264 264
        &dbconnect_vars($form, $db);
265
        my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
265
        my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
266 266
          or $form->dberror;
267 267

  
268 268
        $query =
......
317 317

  
318 318
  dbconnect_vars($form, $form->{dbdefault});
319 319

  
320
  my $dbh                = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) || $form->dberror();
320
  my $dbh                = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options) || $form->dberror();
321 321
  my $query              = qq|SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'template0'|;
322 322
  my ($cluster_encoding) = $dbh->selectrow_array($query);
323 323
  $dbh->disconnect();
......
335 335
  $form->{sid} = $form->{dbdefault};
336 336
  &dbconnect_vars($form, $form->{dbdefault});
337 337
  my $dbh =
338
    SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
338
    SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
339 339
    or $form->dberror;
340 340
  $form->{db} =~ s/\"//g;
341 341
  my %dbcreate = (
......
377 377

  
378 378
  &dbconnect_vars($form, $form->{db});
379 379

  
380
  $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
380
  $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
381 381
    or $form->dberror;
382 382

  
383 383
  my $db_charset = $Common::db_encoding_to_charset{$form->{encoding}};
......
414 414

  
415 415
  $form->{sid} = $form->{dbdefault};
416 416
  &dbconnect_vars($form, $form->{dbdefault});
417
  my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
417
  my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
418 418
    or $form->dberror;
419 419
  my $query = $dbdelete{$form->{dbdriver}};
420 420
  do_query($form, $dbh, $query);
......
460 460
    map { $form->{$_} = $member->{$_} } qw(dbname dbuser dbpasswd dbhost dbport);
461 461
    dbconnect_vars($form, $form->{dbname});
462 462

  
463
    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd});
463
    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options);
464 464

  
465 465
    next unless $dbh;
466 466

  
......
590 590
    $db =~ s/^db//;
591 591
    &dbconnect_vars($form, $db);
592 592

  
593
    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
593
    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options)
594 594
      or $form->dberror;
595 595

  
596 596
    $dbh->do($form->{dboptions}) if ($form->{dboptions});
......
654 654
    $db =~ s/^db//;
655 655
    &dbconnect_vars($form, $db);
656 656

  
657
    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror;
657
    my $dbh = SL::DBConnect->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}, SL::DBConnect->get_options) or $form->dberror;
658 658

  
659 659
    $dbh->do($form->{dboptions}) if ($form->{dboptions});
660 660

  
......
694 694

  
695 695
  $main::auth->save_user($self->{login}, map { $_, $self->{$_} } config_vars());
696 696

  
697
  my $dbh = SL::DBConnect->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd});
697
  my $dbh = SL::DBConnect->connect($self->{dbconnect}, $self->{dbuser}, $self->{dbpasswd}, SL::DBConnect->get_options);
698 698
  if ($dbh) {
699 699
    $self->create_employee_entry($::form, $dbh, $self, 1);
700 700
    $dbh->disconnect();

Auch abrufbar als: Unified diff