X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=sync.pl;h=113df7d93ba04ae3b0cc07ce0696016c8e145bab;hb=fde909c294de9806dd6337f5acb0ed87c41557c6;hp=178866de7d438812b473d25c59ba5773c574b54a;hpb=beccc37c94398d34d002a6d9a8a2dde24e8b17f6;p=wloh diff --git a/sync.pl b/sync.pl index 178866d..113df7d 100755 --- a/sync.pl +++ b/sync.pl @@ -5,18 +5,15 @@ use warnings; no warnings qw(once); use Encode; use Time::HiRes; -require './config.pm'; +use lib qw( include ); +require 'config.pm'; sub copy_escape { my $x = shift; if (!defined($x)) { return '\N'; } - $x = Encode::decode('iso8859-1', $x); - $x =~ s/\\/\\\\/g; - $x =~ s/\r/\\r/g; - $x =~ s/\n/\\n/g; - $x =~ s/\t/\\t/g; + $x =~ s/([\\\r\n\t])/\\$1/g; return $x; } @@ -48,11 +45,13 @@ my $sdbh = DBI->connect($config::local_connstr, $config::local_username, $config or die "PostgreSQL connect: " . $DBI::errstr; $sdbh->{AutoCommit} = 0; $sdbh->{RaiseError} = 1; +$sdbh->do("SET client_encoding TO 'iso8859-1';"); # For our own enjoyment. sync_table($mdbh, $sdbh, "Fotballbrukere"); sync_table($mdbh, $sdbh, "Fotballdeltagere"); sync_table($mdbh, $sdbh, "Fotballresultater"); +sync_table($mdbh, $sdbh, "Fotballresultater_2123"); sync_table($mdbh, $sdbh, "Fotballserier"); # Just for backup.