View | Details | Raw Unified | Return to bug 10611
Collapse All | Expand All

(-)a/C4/Context.pm (-7 / +10 lines)
Lines 782-797 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 = 'mysql';
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{
794
        $db_driver="mysql";
795
    }
793
    }
796
794
797
    my $db_name   = $context->config("database");
795
    my $db_name   = $context->config("database");
Lines 817-822 sub _new_dbh Link Here
817
        $dbh->{RaiseError} = 0;
815
        $dbh->{RaiseError} = 0;
818
    }
816
    }
819
817
818
    if ( $db_driver eq 'mysql' ) {
819
        $dbh->{mysql_auto_reconnect} = 1;
820
    }
821
820
	my $tz = $ENV{TZ};
822
	my $tz = $ENV{TZ};
821
    if ( $db_driver eq 'mysql' ) { 
823
    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.
824
        # 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;
855
    my $self = shift;
854
    my $sth;
856
    my $sth;
855
857
856
    if (defined($context->{"dbh"}) && $context->{"dbh"}->ping()) {
858
    if ( defined $db_driver && $db_driver eq 'mysql' && $context->{"dbh"} ) {
857
	return $context->{"dbh"};
859
        return $context->{"dbh"};
860
    } elsif ( defined $db_driver && defined($context->{"dbh"}) && $context->{"dbh"}->ping()) {
861
        return $context->{"dbh"};
858
    }
862
    }
859
863
860
    # No database handle or it died . Create one.
864
    # No database handle or it died . Create one.
861
- 

Return to bug 10611