]> git.sesse.net Git - wloh/blobdiff - sync.pl
Small optimization to copy_escape.
[wloh] / sync.pl
diff --git a/sync.pl b/sync.pl
index 965b6e83a606cf8d3daeeca54de7ed9816aeb7d5..c57325965d93c9e4acf381bc057aff128f7ecbe9 100755 (executable)
--- a/sync.pl
+++ b/sync.pl
@@ -5,7 +5,8 @@ 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;
@@ -13,10 +14,7 @@ sub copy_escape {
                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;
 }
 
@@ -53,6 +51,7 @@ $sdbh->{RaiseError} = 1;
 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.
@@ -65,5 +64,8 @@ sync_table($mdbh, $sdbh, 'Fotballspraak');
 sync_table($mdbh, $sdbh, 'Fotballtoppti');
 sync_table($mdbh, $sdbh, 'Fotballvariabler');
 
+$sdbh->do('DELETE FROM last_sync');
+$sdbh->do('INSERT INTO last_sync VALUES ( CURRENT_TIMESTAMP );');
+
 $mdbh->rollback();
 $sdbh->commit();