diff --git a/helper/sync-db b/helper/sync-db index afed2387..912c44df 100755 --- a/helper/sync-db +++ b/helper/sync-db @@ -160,25 +160,41 @@ sub sync_smsc_peers { sub sync_general_timezone { my $dbh = shift; my $tz = shift; + my $ok = 1; + my $pe = $dbh->{PrintError}; + my ($sql_log_bin) = $dbh->selectrow_array('SELECT @@sql_log_bin'); - unless ($tz) { - print "Error: general.timezone value is not set\n"; - return; - } + eval { + die "Error: general.timezone value is not set\n" unless $tz; - my $pe = $dbh->{PrintError}; - $dbh->{PrintError} = 0; - $dbh->do(<do("SET sql_log_bin=0"); + $dbh->{PrintError} = 0; + + my ($current_tz) = $dbh->selectrow_array(<do(<{PrintError} = $pe; - if ($DBI::err) { - print "Error: Could not insert into ngcp.timezone: $DBI::errstr\n"; - return; + if ($DBI::err) { + die "Error: Could not insert into ngcp.timezone: $DBI::errstr\n"; + } + }; + if ($@) { + print $@; + $ok = 0; } + $dbh->{PrintError} = $pe; + $dbh->do("SET sql_log_bin=$sql_log_bin"); - return 1; + return $ok; } ## /usr/share/zoneinfo into MariaDB ##############################