Revision 7535161d
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1547 | 1547 |
|
1548 | 1548 |
# Database routines used throughout |
1549 | 1549 |
|
1550 |
sub _dbconnect_options { |
|
1551 |
my $self = shift; |
|
1552 |
my $options = { pg_enable_utf8 => $::locale->is_utf8, |
|
1553 |
@_ }; |
|
1554 |
|
|
1555 |
return $options; |
|
1556 |
} |
|
1557 |
|
|
1550 | 1558 |
sub dbconnect { |
1551 | 1559 |
$main::lxdebug->enter_sub(2); |
1552 | 1560 |
|
1553 | 1561 |
my ($self, $myconfig) = @_; |
1554 | 1562 |
|
1555 | 1563 |
# connect to database |
1556 |
my $dbh = |
|
1557 |
DBI->connect($myconfig->{dbconnect}, |
|
1558 |
$myconfig->{dbuser}, $myconfig->{dbpasswd}) |
|
1564 |
my $dbh = DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options) |
|
1559 | 1565 |
or $self->dberror; |
1560 | 1566 |
|
1561 | 1567 |
# set db options |
... | ... | |
1574 | 1580 |
my ($self, $myconfig) = @_; |
1575 | 1581 |
|
1576 | 1582 |
# connect to database |
1577 |
my $dbh = |
|
1578 |
DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, |
|
1579 |
$myconfig->{dbpasswd}, { AutoCommit => 0 }) |
|
1583 |
my $dbh = DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0)) |
|
1580 | 1584 |
or $self->dberror; |
1581 | 1585 |
|
1582 | 1586 |
# set db options |
Auch abrufbar als: Unified diff
Bei Datenbankverbindungen Option pg_enable_utf8 setzen
Natürlich abhängig von $::dbcharset