mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
93_DbRep: contrib v 8.42.9
git-svn-id: https://svn.fhem.de/fhem/trunk@24926 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a03762bbfe
commit
2853980609
@ -1,5 +1,5 @@
|
||||
##########################################################################################################
|
||||
# $Id: 93_DbRep.pm 23888 2021-03-04 19:58:00Z DS_Starter $
|
||||
# $Id: 93_DbRep.pm 24770 2021-07-18 14:28:08Z DS_Starter $
|
||||
##########################################################################################################
|
||||
# 93_DbRep.pm
|
||||
#
|
||||
@ -57,6 +57,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
|
||||
|
||||
# Version History intern
|
||||
my %DbRep_vNotesIntern = (
|
||||
"8.42.9" => "05.09.2021 minor fixes ",
|
||||
"8.42.8" => "17.07.2021 more log data verbose 5, delete whitespaces in sub getInitData ",
|
||||
"8.42.7" => "27.02.2021 fix attribute sqlCmdVars is not working in sqlCmdBlocking Forum: /topic,53584.msg1135528.html#msg1135528",
|
||||
"8.42.6" => "25.02.2021 fix commandref ",
|
||||
@ -5564,7 +5565,7 @@ sub deldoublets_DoParse {
|
||||
|
||||
no warnings 'uninitialized';
|
||||
|
||||
foreach my $row (@ts) {
|
||||
for my $row (@ts) {
|
||||
my @a = split("#", $row);
|
||||
my $runtime_string = $a[0];
|
||||
my $runtime_string_first = $a[1];
|
||||
@ -5593,13 +5594,15 @@ sub deldoublets_DoParse {
|
||||
# Array @warp -> die zu löschenden Datensätze
|
||||
my (@warp);
|
||||
my $i = 0;
|
||||
foreach my $nr (map { $_->[1]."_ESC_".$_->[2]."_ESC_".($_->[0] =~ s/ /_ESC_/r)."_ESC_".$_->[3]."_|_".($_->[4]-1) } @{$sth->fetchall_arrayref()}) {
|
||||
for my $nr (map { $_->[1]."_ESC_".$_->[2]."_ESC_".($_->[0] =~ s/ /_ESC_/r)."_ESC_".$_->[3]."_|_".($_->[4]-1) } @{$sth->fetchall_arrayref()}) {
|
||||
# Reihenfolge geändert in: DEVICE,READING,DATE,TIME,VALUE,count(*)
|
||||
if($opt =~ /adviceDelete/) {
|
||||
push(@warp,$i."_".$nr) if($#todel+1 < $limit); # die zu löschenden Datensätze (nur zur Anzeige)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
push(@warp,$i."_".$nr); # Array der zu löschenden Datensätze
|
||||
}
|
||||
|
||||
my $c = (split("|",$nr))[-1];
|
||||
Log3 ($name, 4, "DbRep $name - WARP: $nr, ntodel: $ntodel, c: $c");
|
||||
$ntodel = $ntodel + $c;
|
||||
@ -5613,11 +5616,19 @@ sub deldoublets_DoParse {
|
||||
$val =~ s/'/''/g; # escape ' with ''
|
||||
$val =~ s/\\/\\\\/g if($model eq "MYSQL"); # escape \ with \\ für MySQL
|
||||
$st = [gettimeofday];
|
||||
if($model =~ /MYSQL|SQLITE/) {
|
||||
|
||||
if($model =~ /MYSQL/) {
|
||||
$dsql = "delete FROM $table WHERE TIMESTAMP = '$dt' AND DEVICE = '$dev' AND READING = '$read' AND VALUE = '$val' limit $limit;";
|
||||
} elsif ($model eq "POSTGRESQL") {
|
||||
}
|
||||
elsif ($model eq "SQLITE") { # Forum: https://forum.fhem.de/index.php/topic,122791.0.html
|
||||
$dsql = "delete FROM $table where rowid in (select rowid from $table WHERE TIMESTAMP = '$dt' AND DEVICE = '$dev' AND READING = '$read' AND VALUE = '$val' LIMIT $limit);";
|
||||
}
|
||||
elsif ($model eq "POSTGRESQL") {
|
||||
$dsql = "DELETE FROM $table WHERE ctid = any (array(SELECT ctid FROM $table WHERE TIMESTAMP = '$dt' AND DEVICE = '$dev' AND READING = '$read' AND VALUE = '$val' ORDER BY timestamp LIMIT $limit));";
|
||||
}
|
||||
|
||||
Log3 ($name, 4, "DbRep $name - SQL execute: $dsql");
|
||||
|
||||
my $sthd = $dbh->prepare($dsql);
|
||||
|
||||
eval {$sthd->execute();};
|
||||
@ -9395,12 +9406,11 @@ sub DbRep_ParseAborted {
|
||||
my $dbh = $hash->{DBH};
|
||||
my $erread = "";
|
||||
|
||||
Log3 ($name, 5, qq{DbRep $name - BlockingCall finished PID "$hash->{HELPER}{RUNNING_PID}{pid}"});
|
||||
Log3 ($name, 5, qq{DbRep $name - BlockingCall finished PID "$hash->{HELPER}{RUNNING_PID}{pid}"});
|
||||
Log3 ($name, 1, "DbRep $name -> BlockingCall $hash->{HELPER}{RUNNING_PID}{fn} pid:$hash->{HELPER}{RUNNING_PID}{pid} $cause");
|
||||
|
||||
delete($hash->{HELPER}{RUNNING_PID});
|
||||
|
||||
Log3 ($name, 1, "DbRep $name -> BlockingCall $hash->{HELPER}{RUNNING_PID}{fn} pid:$hash->{HELPER}{RUNNING_PID}{pid} $cause");
|
||||
|
||||
# Befehl nach Procedure ausführen
|
||||
no warnings 'uninitialized';
|
||||
$erread = DbRep_afterproc($hash, "command");
|
||||
@ -11783,12 +11793,12 @@ sub DbRep_setVersionInfo {
|
||||
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
|
||||
# META-Daten sind vorhanden
|
||||
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SMAPortal}{META}}
|
||||
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 23888 2021-03-04 19:58:00Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 24770 2021-07-18 14:28:08Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
$modules{$type}{META}{x_version} =~ s/1.1.1/$v/g;
|
||||
} else {
|
||||
$modules{$type}{META}{x_version} = $v;
|
||||
}
|
||||
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 23888 2021-03-04 19:58:00Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 24770 2021-07-18 14:28:08Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
|
||||
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
|
||||
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
|
||||
|
Loading…
Reference in New Issue
Block a user