use SL::Auth::LDAP;
use SL::User;
+ use SL::DBConnect;
use SL::DBUpgrade2;
use SL::DBUtils;
sub get_user_dbh {
my ($self, $login) = @_;
my %user = $self->read_user($login);
- my $dbh = DBI->connect(
+ my $dbh = SL::DBConnect->connect(
$user{dbconnect},
$user{dbuser},
$user{dbpasswd},
$main::lxdebug->message(LXDebug->DEBUG1, "Auth::dbconnect DSN: $dsn");
- $self->{dbh} = DBI->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 1 });
+ $self->{dbh} = SL::DBConnect->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 1 });
if (!$may_fail && !$self->{dbh}) {
$main::form->error($main::locale->text('The connection to the authentication database failed:') . "\n" . $DBI::errstr);
my $encoding = $Common::charset_to_db_encoding{$charset};
$encoding ||= 'UNICODE';
- my $dbh = DBI->connect($dsn, $params{superuser}, $params{superuser_password}, { pg_enable_utf8 => $charset =~ m/^utf-?8$/i });
+ my $dbh = SL::DBConnect->connect($dsn, $params{superuser}, $params{superuser_password}, { pg_enable_utf8 => $charset =~ m/^utf-?8$/i });
if (!$dbh) {
$main::form->error($main::locale->text('The connection to the template database failed:') . "\n" . $DBI::errstr);
my $self = shift;
my $id = shift;
- my $form = $main::from;
+ my $form = $main::form;
my $dbh = $self->dbconnect();
$dbh->begin_work;
use SL::Common;
use SL::CVar;
use SL::DB;
+ use SL::DBConnect;
use SL::DBUtils;
use SL::DO;
use SL::IC;
my $base_uri = $self->_get_request_uri;
my $new_uri = URI->new_abs($new_url, $base_uri);
- die "Headers already sent" if $::self->{header};
+ die "Headers already sent" if $self->{header};
$self->{header} = 1;
my $cgi = $main::cgi || CGI->new('');
my ($self, $myconfig) = @_;
# connect to database
- my $dbh = DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options)
+ my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options)
or $self->dberror;
# set db options
my ($self, $myconfig) = @_;
# connect to database
- my $dbh = DBI->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0))
+ my $dbh = SL::DBConnect->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0))
or $self->dberror;
# set db options