Lines 789-804
sub _new_Zconn {
Link Here
|
789 |
# Internal helper function (not a method!). This creates a new |
789 |
# Internal helper function (not a method!). This creates a new |
790 |
# database connection from the data given in the current context, and |
790 |
# database connection from the data given in the current context, and |
791 |
# returns it. |
791 |
# returns it. |
|
|
792 |
our $db_driver = 'mysql'; |
792 |
sub _new_dbh |
793 |
sub _new_dbh |
793 |
{ |
794 |
{ |
794 |
|
795 |
|
795 |
## $context |
796 |
## $context |
796 |
## correct name for db_schme |
797 |
## correct name for db_schme |
797 |
my $db_driver; |
|
|
798 |
if ($context->config("db_scheme")){ |
798 |
if ($context->config("db_scheme")){ |
799 |
$db_driver=db_scheme2dbi($context->config("db_scheme")); |
799 |
$db_driver=db_scheme2dbi($context->config("db_scheme")); |
800 |
}else{ |
|
|
801 |
$db_driver="mysql"; |
802 |
} |
800 |
} |
803 |
|
801 |
|
804 |
my $db_name = $context->config("database"); |
802 |
my $db_name = $context->config("database"); |
Lines 824-829
sub _new_dbh
Link Here
|
824 |
$dbh->{RaiseError} = 0; |
822 |
$dbh->{RaiseError} = 0; |
825 |
} |
823 |
} |
826 |
|
824 |
|
|
|
825 |
if ( $db_driver eq 'mysql' ) { |
826 |
$dbh->{mysql_auto_reconnect} = 1; |
827 |
} |
828 |
|
827 |
my $tz = $ENV{TZ}; |
829 |
my $tz = $ENV{TZ}; |
828 |
if ( $db_driver eq 'mysql' ) { |
830 |
if ( $db_driver eq 'mysql' ) { |
829 |
# Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. |
831 |
# Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. |
Lines 860-867
sub dbh
Link Here
|
860 |
my $self = shift; |
862 |
my $self = shift; |
861 |
my $sth; |
863 |
my $sth; |
862 |
|
864 |
|
863 |
if (defined($context->{"dbh"}) && $context->{"dbh"}->ping()) { |
865 |
if ( defined $db_driver && $db_driver eq 'mysql' && $context->{"dbh"} ) { |
864 |
return $context->{"dbh"}; |
866 |
return $context->{"dbh"}; |
|
|
867 |
} elsif ( defined $db_driver && defined($context->{"dbh"}) && $context->{"dbh"}->ping()) { |
868 |
return $context->{"dbh"}; |
865 |
} |
869 |
} |
866 |
|
870 |
|
867 |
# No database handle or it died . Create one. |
871 |
# No database handle or it died . Create one. |
868 |
- |
|
|