Bugzilla – Attachment 6238 Details for
Bug 7184
have mysql returning errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7184 raise mySQL error if debug is set
Bug-7184-raise-mySQL-error-if-debug-is-set.patch (text/plain), 1.67 KB, created by
Paul Poulain
on 2011-11-06 08:37:32 UTC
(
hide
)
Description:
Bug 7184 raise mySQL error if debug is set
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2011-11-06 08:37:32 UTC
Size:
1.67 KB
patch
obsolete
>From 7adbcfef6718c173022c1d151a3ef9d463eff548 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Sun, 6 Nov 2011 09:36:52 +0100 >Subject: [PATCH] Bug 7184 raise mySQL error if debug is set > >Before this patch, if a mySQL occured in Koha (any error), then the user was seeing nothing. >With this patch, if DEBUG is set in Koha VirtualHost, any mySQL error will make Koha die and display the SQL error > >Step to test: >=== BEFORE PATCH === >go anywhere, and change a mySQL statement to make it invalid. >Launch a page using the SQL you've made wrong, you'll see nothing, except you won't see the expected results > >=== AFTER PATCH === >Modify koha-httpd.conf, and add the following line, in the virtualhost (if it does not already exist) >SetEnv DEBUG 1 >restart/reload Apache >Launch the same page, you'll get a Perl statement saying something like: > >DBD::mysql::st execute failed: <<blablabla SQL error>> at <<where the error was raised line <<error line>> >--- > C4/Context.pm | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 85d1c18..c63641c 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -690,7 +690,7 @@ sub _new_dbh > my $db_passwd = $context->config("pass"); > # MJR added or die here, as we can't work without dbh > my $dbh= DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", >- $db_user, $db_passwd) or die $DBI::errstr; >+ $db_user, $db_passwd, {'RaiseError' => $ENV{DEBUG}?1:0 }) or die $DBI::errstr; > my $tz = $ENV{TZ}; > if ( $db_driver eq 'mysql' ) { > # Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. >-- >1.7.5.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7184
: 6238