Admin: Teile von admin.pl in neuen Controller Admin verschoben; Mandanten anzeigen
[kivitendo-erp.git] / SL / DBConnect.pm
1 package SL::DBConnect;
2
3 use strict;
4
5 use DBI;
6
7 sub connect {
8   shift;
9
10   # print STDERR "Starting full caller dump:\n";
11   # my $level = 0;
12   # while (my ($dummy, $filename, $line, $subroutine) = caller $level) {
13   #   print STDERR "  ${subroutine} from ${filename}:${line}\n";
14   #   $level++;
15   # }
16
17   return DBI->connect(@_) unless $::lx_office_conf{debug} && $::lx_office_conf{debug}->{dbix_log4perl};
18
19   require Log::Log4perl;
20   require DBIx::Log4perl;
21
22   my $filename =  $::lxdebug->file;
23   my $config   =  $::lx_office_conf{debug}->{dbix_log4perl_config};
24   $config      =~ s/LXDEBUGFILE/${filename}/g;
25
26   Log::Log4perl->init(\$config);
27   return DBIx::Log4perl->connect(@_);
28 }
29
30 sub get_options {
31   my $self    = shift;
32   my $options = {
33     pg_enable_utf8 => $::locale->is_utf8,
34     @_
35   };
36
37   return $options;
38 }
39
40 1;