From e1a174bdf5b6fbfa1e52d3ecd280b75d7c048b03 Mon Sep 17 00:00:00 2001 From: Dave Cross Date: Sat, 16 Aug 2014 21:38:36 +0100 Subject: [PATCH] Make all DB utils utf8-clean --- bin/dump_cand | 3 ++- bin/listname | 1 + bin/load_cand | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/dump_cand b/bin/dump_cand index 81f6f5f6a1..fb803273fa 100755 --- a/bin/dump_cand +++ b/bin/dump_cand @@ -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'); @@ -19,4 +20,4 @@ open my $fh, '>', $file or die "$!: $file"; while (my $cand = $cand_rs->next) { say $fh $cand->dump; -} \ No newline at end of file +} diff --git a/bin/listname b/bin/listname index ad37bf3e58..89d5abfbc5 100755 --- a/bin/listname +++ b/bin/listname @@ -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) { diff --git a/bin/load_cand b/bin/load_cand index de543a48d7..0ebdf282e6 100755 --- a/bin/load_cand +++ b/bin/load_cand @@ -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'); @@ -43,4 +44,4 @@ while (<$fh>) { twitter => $twitter, party_id => $par->id, }); -} \ No newline at end of file +}