Skip to content

Commit

Permalink
Be explicit about enabling utf8 in db connection; reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Aug 1, 2011
1 parent 7be63c9 commit e69bf66
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions lib/CPANRatings/Schema.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,27 @@ has '+dbic' => (handles => [qw(txn_do txn_scope_guard txn_begin txn_commit txn_r
my $config = Combust::Config->new;

sub connect_args {
( sub { DBI->connect($config->database->{data_source},
$config->database->{user},
$config->database->{password},
{
AutoCommit => 1,
RaiseError => 1,
mysql_enable_utf8 => 1,
},
) },
{ quote_char => q{`},
name_sep => q{.},
on_connect_do => [ "SET sql_mode = 'STRICT_TRANS_TABLES'",
"SET time_zone = 'UTC'",
],
}
);
return (
sub {
DBI->connect(
$config->database->{data_source},
$config->database->{user},
$config->database->{password},
{ AutoCommit => 1,
RaiseError => 1,
mysql_enable_utf8 => 1,
},
);

},
{ on_connect_do => [
"SET sql_mode = 'STRICT_TRANS_TABLES'",
"SET time_zone = 'UTC'",
"SET names utf8",
"SET character set utf8",
],
}
);
}

sub dbh {
Expand Down

0 comments on commit e69bf66

Please sign in to comment.