X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB.pm;h=67888ef5942f34174b5a7a45dc7986e40f4ed6a7;hb=d06d918a16ba787a440fa6c6f77af81855b6bf68;hp=b48a49e70bb4a708775a35487f4fe4da28ff42d3;hpb=f9c7abfae65b79945beb7e9260942bc94876248a;p=kivitendo-erp.git diff --git a/SL/DB.pm b/SL/DB.pm index b48a49e70..67888ef59 100644 --- a/SL/DB.pm +++ b/SL/DB.pm @@ -13,6 +13,22 @@ __PACKAGE__->use_private_registry; my (%_db_registered, %_initial_sql_executed); +sub dbi_connect { + shift; + + return DBI->connect(@_) unless $::lx_office_conf{debug} && $::lx_office_conf{debug}->{dbix_log4perl}; + + require Log::Log4perl; + require DBIx::Log4perl; + + my $filename = $LXDebug::file_name; + my $config = $::lx_office_conf{debug}->{dbix_log4perl_config}; + $config =~ s/LXDEBUGFILE/${filename}/g; + + Log::Log4perl->init(\$config); + return DBIx::Log4perl->connect(@_); +} + sub create { my $domain = shift || SL::DB->default_domain; my $type = shift || SL::DB->default_type; @@ -49,7 +65,7 @@ sub _register_db { } elsif ($type eq 'LXOFFICE_AUTH') { %connect_settings = ( driver => $::myconfig{dbdriver} || 'Pg', database => $::auth->{DB_config}->{db}, - host => $::auth->{DB_config}->{host}, + host => $::auth->{DB_config}->{host} || 'localhost', port => $::auth->{DB_config}->{port} || 5432, username => $::auth->{DB_config}->{user}, password => $::auth->{DB_config}->{password}, @@ -63,7 +79,7 @@ sub _register_db { %connect_settings = ( driver => $::myconfig{dbdriver} || 'Pg', database => $::myconfig{dbname}, - host => $::myconfig{dbhost}, + host => $::myconfig{dbhost} || 'localhost', port => $::myconfig{dbport} || 5432, username => $::myconfig{dbuser}, password => $::myconfig{dbpasswd},