|
Lines 787-794
sub _new_dbh
Link Here
|
| 787 |
my $db_user = $context->config("user"); |
787 |
my $db_user = $context->config("user"); |
| 788 |
my $db_passwd = $context->config("pass"); |
788 |
my $db_passwd = $context->config("pass"); |
| 789 |
# MJR added or die here, as we can't work without dbh |
789 |
# MJR added or die here, as we can't work without dbh |
| 790 |
my $dbh= DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", |
790 |
my $dbh = DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", |
| 791 |
$db_user, $db_passwd, {'RaiseError' => $ENV{DEBUG}?1:0 }) or die $DBI::errstr; |
791 |
$db_user, $db_passwd, {'RaiseError' => $ENV{DEBUG}?1:0 }) or die $DBI::errstr; |
|
|
792 |
|
| 793 |
# Check for the existence of a systempreference table; if we don't have this, we don't |
| 794 |
# have a valid database and should not set RaiseError in order to allow the installer |
| 795 |
# to run; installer will not run otherwise since we raise all db errors |
| 796 |
|
| 797 |
eval { |
| 798 |
local $dbh->{PrintError} = 0; |
| 799 |
local $dbh->{RaiseError} = 1; |
| 800 |
$dbh->do(qq{SELECT * FROM systempreferences WHERE 1 = 0 }); |
| 801 |
}; |
| 802 |
|
| 803 |
if ($@) { |
| 804 |
$dbh->{RaiseError} = 0; |
| 805 |
} |
| 806 |
|
| 792 |
my $tz = $ENV{TZ}; |
807 |
my $tz = $ENV{TZ}; |
| 793 |
if ( $db_driver eq 'mysql' ) { |
808 |
if ( $db_driver eq 'mysql' ) { |
| 794 |
# Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. |
809 |
# Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config. |
| 795 |
- |
|
|