mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
93_DbRep: contrib 8.36.0
git-svn-id: https://svn.fhem.de/fhem/trunk@21457 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e7922e332d
commit
d455f487c3
@ -2063,18 +2063,19 @@ sub DbRep_Main($$;$) {
|
||||
} elsif ($prop eq "allDevCount") {
|
||||
$prop = "select device, count(*) from history group by DEVICE;";
|
||||
} elsif ($prop eq "recentReadingsOfDevice") {
|
||||
my $tq;
|
||||
if($dbmodel =~ /MYSQL/) {$tq = "NOW() - INTERVAL 1 DAY"};
|
||||
if($dbmodel =~ /SQLITE/) {$tq = "date('now','-1 day')"};
|
||||
my ($tq,$gcl);
|
||||
if($dbmodel =~ /MYSQL/) {$tq = "NOW() - INTERVAL 1 DAY"; $gcl = "READING"};
|
||||
if($dbmodel =~ /SQLITE/) {$tq = "date('now','-1 day')"; $gcl = "READING"};
|
||||
if($dbmodel =~ /POSTGRESQL/) {$tq = "CURRENT_TIMESTAMP - INTERVAL '1 day'"; $gcl = "READING,DEVICE"};
|
||||
|
||||
my @cmd = split(/\s/, "SELECT t1.TIMESTAMP,t1.DEVICE,t1.READING,t1.VALUE
|
||||
FROM history t1
|
||||
INNER JOIN
|
||||
(select max(TIMESTAMP) AS TIMESTAMP,DEVICE,READING
|
||||
from history where DEVICE = \"$device\" and TIMESTAMP > ".$tq." group by READING) x
|
||||
from history where DEVICE = '".$device."' and TIMESTAMP > ".$tq." group by ".$gcl.") x
|
||||
ON x.TIMESTAMP = t1.TIMESTAMP AND
|
||||
x.DEVICE = t1.DEVICE AND
|
||||
x.READING = t1.READING;");
|
||||
# if($dbmodel =~ /POSTGRESQL/) {$tq = "CURRENT_TIMESTAMP - INTERVAL '1 day'"};
|
||||
|
||||
$prop = join(" ", @cmd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user