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

(-)a/Koha/Database.pm (-10 / +3 lines)
Lines 90-109 sub _new_schema { Link Here
90
        $tz_query = qq(SET TIME ZONE = "$tz") if $tz;
90
        $tz_query = qq(SET TIME ZONE = "$tz") if $tz;
91
    }
91
    }
92
92
93
    my $RaiseError = (
94
           $ENV{DEBUG}
95
        || $ENV{KOHA_TESTING}
96
        ||  exists $ENV{_} && $ENV{_} =~ m|prove|
97
    ) ? 1 : 0;
98
    my $schema = Koha::Schema->connect(
93
    my $schema = Koha::Schema->connect(
99
        {
94
        {
100
            dsn => "dbi:$db_driver:database=$db_name;host=$db_host;port=$db_port".($tls_options? $tls_options : ""),
95
            dsn => "dbi:$db_driver:database=$db_name;host=$db_host;port=$db_port".($tls_options? $tls_options : ""),
101
            user => $db_user,
96
            user => $db_user,
102
            password => $db_passwd,
97
            password => $db_passwd,
103
            %encoding_attr,
98
            %encoding_attr,
104
            RaiseError => $RaiseError,
99
            RaiseError => 1,
105
            PrintError => 1,
100
            PrintError => 1,
106
            unsafe => !$RaiseError,
107
            quote_names => 1,
101
            quote_names => 1,
108
            auto_savepoint => 1,
102
            auto_savepoint => 1,
109
            on_connect_do => [
103
            on_connect_do => [
Lines 116-122 sub _new_schema { Link Here
116
110
117
    my $dbh = $schema->storage->dbh;
111
    my $dbh = $schema->storage->dbh;
118
    eval {
112
    eval {
119
        $dbh->{RaiseError} = 1;
120
        if ( $ENV{KOHA_DB_DO_NOT_RAISE_OR_PRINT_ERROR} ) {
113
        if ( $ENV{KOHA_DB_DO_NOT_RAISE_OR_PRINT_ERROR} ) {
121
            $dbh->{RaiseError} = 0;
114
            $dbh->{RaiseError} = 0;
122
            $dbh->{PrintError} = 0;
115
            $dbh->{PrintError} = 0;
Lines 124-130 sub _new_schema { Link Here
124
        $dbh->do(q|
117
        $dbh->do(q|
125
            SELECT * FROM systempreferences WHERE 1 = 0 |
118
            SELECT * FROM systempreferences WHERE 1 = 0 |
126
        );
119
        );
127
        $dbh->{RaiseError} = $RaiseError
120
        $dbh->{RaiseError} = 1;
121
        $dbh->{PrintError} = 1;
128
    };
122
    };
129
    $dbh->{RaiseError} = 0 if $@;
123
    $dbh->{RaiseError} = 0 if $@;
130
124
131
- 

Return to bug 25026