1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-04 22:19:38 +00:00

93_DbRep: an invalid timestamp will put into state if found on startup

git-svn-id: https://svn.fhem.de/fhem/trunk@17377 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2018-09-20 19:25:56 +00:00
parent 0c37097a31
commit 25cda5f6d8
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- change: 93_DbRep: an invalid timestamp will put into state if found on
startup
- bugfix: 38_netatmo: fixed changed values and deprecated API calls - bugfix: 38_netatmo: fixed changed values and deprecated API calls
- bugfix: 93_DbLog: 3.12.1, crash if SVG called (forum:#91285) - bugfix: 93_DbLog: 3.12.1, crash if SVG called (forum:#91285)
- change: 32_withings: API endpoint changed back to Withings servers - change: 32_withings: API endpoint changed back to Withings servers

View File

@ -37,6 +37,7 @@
########################################################################################################################### ###########################################################################################################################
# Versions History: # Versions History:
# #
# 8.0.1 20.09.2018 DbRep_getMinTs improved
# 8.0.0 11.09.2018 get filesize in DbRep_WriteToDumpFile corrected, restoreMySQL for clientSide dumps # 8.0.0 11.09.2018 get filesize in DbRep_WriteToDumpFile corrected, restoreMySQL for clientSide dumps
# minor fixes # minor fixes
# 7.20.0 04.09.2018 deviceRename can operate a Device name with blank, e.g. 'current balance' as old device name # 7.20.0 04.09.2018 deviceRename can operate a Device name with blank, e.g. 'current balance' as old device name
@ -347,7 +348,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
sub DbRep_Main($$;$); sub DbRep_Main($$;$);
sub DbLog_cutCol($$$$$$$); # DbLog-Funktion nutzen um Daten auf maximale Länge beschneiden sub DbLog_cutCol($$$$$$$); # DbLog-Funktion nutzen um Daten auf maximale Länge beschneiden
my $DbRepVersion = "8.0.0"; my $DbRepVersion = "8.0.1";
my %dbrep_col = ("DEVICE" => 64, my %dbrep_col = ("DEVICE" => 64,
"TYPE" => 64, "TYPE" => 64,
@ -1378,7 +1379,8 @@ sub DbRep_getMinTs($) {
# SQL-Startzeit # SQL-Startzeit
my $st = [gettimeofday]; my $st = [gettimeofday];
eval { $mints = $dbh->selectrow_array("SELECT min(TIMESTAMP) FROM history;"); }; # eval { $mints = $dbh->selectrow_array("SELECT min(TIMESTAMP) FROM history;"); };
eval { $mints = $dbh->selectrow_array("select TIMESTAMP from history limit 1;"); };
$dbh->disconnect; $dbh->disconnect;
@ -1421,8 +1423,8 @@ sub DbRep_getMinTsDone($) {
return; return;
} }
$hash->{HELPER}{MINTS} = $mints;
my $state = ($hash->{LASTCMD} eq "minTimestamp")?"done":"connected"; my $state = ($hash->{LASTCMD} eq "minTimestamp")?"done":"connected";
$state = "invalid timestamp \"$mints\" found in database - please delete it" if($mints =~ /^0000-00-00.*$/);
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
ReadingsBulkUpdateValue ($hash, "timestamp_oldest_dataset", $mints) if($hash->{LASTCMD} eq "minTimestamp"); ReadingsBulkUpdateValue ($hash, "timestamp_oldest_dataset", $mints) if($hash->{LASTCMD} eq "minTimestamp");