Revision 7b13e2ea
Von Moritz Bunkus vor etwa 14 Jahren hinzugefügt
SL/Auth.pm | ||
---|---|---|
139 | 139 |
|
140 | 140 |
$main::lxdebug->message(LXDebug->DEBUG1, "Auth::dbconnect DSN: $dsn"); |
141 | 141 |
|
142 |
$self->{dbh} = DBI->connect($dsn, $cfg->{user}, $cfg->{password}, { 'AutoCommit' => 0 });
|
|
142 |
$self->{dbh} = DBI->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 0 });
|
|
143 | 143 |
|
144 | 144 |
if (!$may_fail && !$self->{dbh}) { |
145 | 145 |
$main::form->error($main::locale->text('The connection to the authentication database failed:') . "\n" . $DBI::errstr); |
... | ... | |
214 | 214 |
|
215 | 215 |
$main::lxdebug->message(LXDebug->DEBUG1(), "Auth::create_database DSN: $dsn"); |
216 | 216 |
|
217 |
my $dbh = DBI->connect($dsn, $params{superuser}, $params{superuser_password}); |
|
218 |
|
|
219 |
if (!$dbh) { |
|
220 |
$main::form->error($main::locale->text('The connection to the template database failed:') . "\n" . $DBI::errstr); |
|
221 |
} |
|
222 |
|
|
223 | 217 |
my $charset = $main::dbcharset; |
224 | 218 |
$charset ||= Common::DEFAULT_CHARSET; |
225 | 219 |
my $encoding = $Common::charset_to_db_encoding{$charset}; |
226 | 220 |
$encoding ||= 'UNICODE'; |
227 | 221 |
|
222 |
my $dbh = DBI->connect($dsn, $params{superuser}, $params{superuser_password}, { pg_enable_utf8 => $charset =~ m/^utf-?8$/i }); |
|
223 |
|
|
224 |
if (!$dbh) { |
|
225 |
$main::form->error($main::locale->text('The connection to the template database failed:') . "\n" . $DBI::errstr); |
|
226 |
} |
|
227 |
|
|
228 | 228 |
my $query = qq|CREATE DATABASE "$cfg->{db}" OWNER "$cfg->{user}" TEMPLATE "$params{template}" ENCODING '$encoding'|; |
229 | 229 |
|
230 | 230 |
$main::lxdebug->message(LXDebug->DEBUG1(), "Auth::create_database query: $query"); |
Auch abrufbar als: Unified diff
Bei Datenbankverbindung pg_enable_utf8 je nach Charset setzen