[Koha-bugs] [Bug 7184] New: have mysql returning errors

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sun Nov 6 07:44:14 CET 2011


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7184

             Bug #: 7184
           Summary: have mysql returning errors
    Classification: Unclassified
 Change sponsored?: ---
           Product: Koha
           Version: master
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
        AssignedTo: paul.poulain at biblibre.com
        ReportedBy: paul.poulain at biblibre.com
         QAContact: ian.walls at bywatersolutions.com
            Blocks: 7119


Koha staff interface doesn't complain when there is an SQL error, except in the
logs. That can result in strange situations, where the user don't see there is
a problem, even if there is.

There is an easy solution to this problem : RaiseError

in C4/Context.pm, the line 
    my $dbh=
DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
    $db_user, $db_passwd) or die $DBI::errstr;

just has to be replaced by
    my $dbh=
DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
    $db_user, $db_passwd, {RaiseError => 1}) or die $DBI::errstr;

We also could deal with the DebugLevel systempreference to raise the error only
if the library has set it.
Something like: {'RaiseError' => C4::Context->preference("DebugLevel")?1:0}

My preference goes to the 2nd option = raise error only if DebugLevel is set

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the Koha-bugs mailing list