Skip to content

Commit

Permalink
Make all DB utils utf8-clean
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Aug 16, 2014
1 parent 6c293ec commit e1a174b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bin/dump_cand
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ my $file = shift || 'db/candidate.csv';

my $sch = TwittElection::Schema->connect(
"dbi:mysql:database=$ENV{TE_DB}", $ENV{TE_USER}, $ENV{TE_PASS},
{ mysql_enable_utf8 => 1 },
) or die;

my $cand_rs = $sch->resultset('Candidate');
Expand All @@ -19,4 +20,4 @@ open my $fh, '>', $file or die "$!: $file";

while (my $cand = $cand_rs->next) {
say $fh $cand->dump;
}
}
1 change: 1 addition & 0 deletions bin/listname
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ my %compass = (

my $sch = TwittElection::Schema->connect(
"dbi:mysql:database=$ENV{TE_DB}", $ENV{TE_USER}, $ENV{TE_PASS},
{ mysql_enable_utf8 => 1 },
) or die;

foreach my $con ($sch->resultset('Constituency')->all) {
Expand Down
3 changes: 2 additions & 1 deletion bin/load_cand
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ my $file = shift || 'db/candidate.csv';

my $sch = TwittElection::Schema->connect(
"dbi:mysql:database=$ENV{TE_DB}", $ENV{TE_USER}, $ENV{TE_PASS},
{ mysql_enable_utf8 => 1 },
) or die;

my $con_rs = $sch->resultset('Constituency');
Expand Down Expand Up @@ -43,4 +44,4 @@ while (<$fh>) {
twitter => $twitter,
party_id => $par->id,
});
}
}

0 comments on commit e1a174b

Please sign in to comment.