|
Lines 782-793
sub _new_Zconn {
Link Here
|
| 782 |
# Internal helper function (not a method!). This creates a new |
782 |
# Internal helper function (not a method!). This creates a new |
| 783 |
# database connection from the data given in the current context, and |
783 |
# database connection from the data given in the current context, and |
| 784 |
# returns it. |
784 |
# returns it. |
|
|
785 |
our $db_driver; |
| 785 |
sub _new_dbh |
786 |
sub _new_dbh |
| 786 |
{ |
787 |
{ |
| 787 |
|
788 |
|
| 788 |
## $context |
789 |
## $context |
| 789 |
## correct name for db_schme |
790 |
## correct name for db_schme |
| 790 |
my $db_driver; |
|
|
| 791 |
if ($context->config("db_scheme")){ |
791 |
if ($context->config("db_scheme")){ |
| 792 |
$db_driver=db_scheme2dbi($context->config("db_scheme")); |
792 |
$db_driver=db_scheme2dbi($context->config("db_scheme")); |
| 793 |
}else{ |
793 |
}else{ |
|
Lines 817-822
sub _new_dbh
Link Here
|
| 817 |
$dbh->{RaiseError} = 0; |
817 |
$dbh->{RaiseError} = 0; |
| 818 |
} |
818 |
} |
| 819 |
|
819 |
|
|
|
820 |
if ( $db_driver eq 'mysql' ) { |
| 821 |
$dbh->{mysql_auto_reconnect} = 1; |
| 822 |
} |
| 823 |
|
| 820 |
my $tz = $ENV{TZ}; |
824 |
my $tz = $ENV{TZ}; |
| 821 |
if ( $db_driver eq 'mysql' ) { |
825 |
if ( $db_driver eq 'mysql' ) { |
| 822 |
# Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. |
826 |
# Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. |
|
Lines 853-860
sub dbh
Link Here
|
| 853 |
my $self = shift; |
857 |
my $self = shift; |
| 854 |
my $sth; |
858 |
my $sth; |
| 855 |
|
859 |
|
| 856 |
if (defined($context->{"dbh"}) && $context->{"dbh"}->ping()) { |
860 |
if ( defined $db_driver && $db_driver eq 'mysql' && $context->{"dbh"} ) { |
| 857 |
return $context->{"dbh"}; |
861 |
return $context->{"dbh"}; |
|
|
862 |
} elsif ( defined $db_driver && defined($context->{"dbh"}) && $context->{"dbh"}->ping()) { |
| 863 |
return $context->{"dbh"}; |
| 858 |
} |
864 |
} |
| 859 |
|
865 |
|
| 860 |
# No database handle or it died . Create one. |
866 |
# No database handle or it died . Create one. |
| 861 |
- |
|
|