diff --git a/contrib/DS_Starter/93_DbRep.pm b/contrib/DS_Starter/93_DbRep.pm index 7b4959b9c..4d4d268a2 100644 --- a/contrib/DS_Starter/93_DbRep.pm +++ b/contrib/DS_Starter/93_DbRep.pm @@ -538,6 +538,7 @@ sub DbRep_Set { if (AttrVal($name, "sqlCmdHistoryLength", 0)) { $hl .= "___purge_sqlhistory___"; $hl .= ",___list_sqlhistory___"; + $hl .= ",___save_sqlhistory___"; $hl .= ",___restore_sqlhistory___"; } @@ -1040,6 +1041,12 @@ sub DbRep_Set { return $cache; } + if($sqlcmd eq "___save_sqlhistory___") { + my $err = DbRep_writeSQLcmdCache ($hash); # SQL Cache File schreiben + $err //= "SQL history entries of $name successfully saved"; + return $err; + } + if($sqlcmd eq "___restore_sqlhistory___") { my $count = DbRep_initSQLcmdCache ($name); return $count ? "SQL history entries of $name restored: $count" : undef; @@ -1800,6 +1807,7 @@ sub DbRep_Shutdown { DbRep_delread ($hash,1); RemoveInternalTimer ($hash); + DbRep_writeSQLcmdCache ($hash); # SQL Cache File schreiben return; } @@ -11416,8 +11424,10 @@ sub DbRep_setCmdFile { } push @new, "$key:$value" if(!$fnd && defined($value)); + + my $err = FileWrite($param, @new); -return FileWrite($param, @new); +return $err; } #################################################################################################### @@ -11539,7 +11549,6 @@ sub DbRep_addSQLcmdCache { if($doIns) { _DbRep_insertSQLtoCache ($name, $tmpsql); - DbRep_writeSQLcmdCache ($hash); # SQL Cache File schreiben } return; @@ -11615,9 +11624,9 @@ sub DbRep_writeSQLcmdCache { my $name = $hash->{NAME}; my (undef, $cstr) = DbRep_listSQLcmdCache ($name, 1); - DbRep_setCmdFile($name."_sqlCmdList", $cstr, $hash); + my $err = DbRep_setCmdFile($name."_sqlCmdList", $cstr, $hash); -return; +return $err; } #################################################################################################### @@ -14485,6 +14494,7 @@ return;