1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
defined(%hash) is deprecated at wetter.cgi line 1742.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 2110.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 5935.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 6142.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 6175.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 6371.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 8699.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 8741.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 9960.
(Maybe you should just omit the defined()?)
defined(%hash) is deprecated at wetter.cgi line 10231.
(Maybe you should just omit the defined()?)
wetter.cgi syntax OK
1
2
3
4
5
6
7
8
DBD::mysql::st execute failed: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'AND sensid=1 ORDER by datetime DESC LIMIT 2' at line 1
at /var/www/cgi-bin/wetter.cgi line 7184. DBD::mysql::st execute failed:
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'AND sensid=1
ORDER by datetime DESC LIMIT 2' at line 1 at /var/www/cgi-bin/wetter.cgi
line 7184.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Iterate over all sensorIds of one sensortype
foreach $j ( @{${$sens}{$i}->{"sensorids"}} ){
$dbColName=$dbcols;
# The sensorids defined by the user in latest_th[] may be of the format
# sensorId.stationid. Here we have to split both values to get the right data
($sensorId, $station)=split(/\./o, $j, 2);
$stationId=$station if( length($station) );
# Only start sql query if there are dbcols to be retrieved by the sensors
# description and if this value is != "-" (rainsensor). The rainsensor is
# handled differently below
if( length($dbcols) && $dbcols ne "-" ){
$sql="SELECT $qdbcols FROM $table WHERE stationid = $stationId AND sensid=$sensorId";
#$sql.=" ORDER by datetime DESC,id DESC LIMIT 2";
$sql.=" ORDER by datetime DESC LIMIT 2";
# Query database for min, max and average of sensor
$sth = $dbh->prepare($sql);
$sth->execute;
# Fetch the latest rows. We need two for values that encode a difference
# like the rain sensor
@res= $sth->fetchrow_array;
# @res1=$sth->fetchrow_array if( ${$sens}{$i}->{"type"}=~/RA/o );
}
1
2
3
4
5
6
7
8
9
DBD::mysql::db selectrow_array failed: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version for
the right syntax to use near 'AND datetime>="2017-01-22 23:00:00" AND
LEFT(datetime,10) <="2017-01-23 22:59:59' at line 1 at /var/www/cgi-bin
/wetter.cgi line 7212. DBD::mysql::db selectrow_array failed: You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'AND datetime>="2017-01-22
23:00:00" AND LEFT(datetime,10) <="2017-01-23 22:59:59' at line 1 at
/var/www/cgi-bin/wetter.cgi line 7212.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if( ${$sens}{$i}->{"datediff"} ){
$dbColName=${$sens}{$i}->{"dbcolName"};
$unitFactor=${$sens}{$i}->{"unitfactor"}->{"$dbColName"};
$midnightDate=${$sens}{$i}->{"datediff"}; # date of day for which to calculate sum
$midnightTime="00:00:00"; # starting from midnight
$dayEndTime="23:59:59"; # Day end time
#
# Since the database stores dates in GMT we have to calculate what GMT time
# corresponds to the local time "midnight"
($midnightDateGMT, $midnightTimeGMT)=timeConvert($midnightDate, $midnightTime, "GMT");
# Now calculate what GMT time corresponds to local time "end of day"
($midnightDate, $dayEndTime)=timeConvert($midnightDate, $dayEndTime, "GMT");
# Now select data that is between midnight(GMT) and end of day(GMT)
$sql="SELECT SUM($dbColName) AS \"SUM\" FROM $table WHERE stationid = $stationId AND".
" datetime>=\"$midnightDateGMT $midnightTimeGMT\" AND".
" LEFT(datetime,10) <=\"$midnightDate $dayEndTime\" AND sensid=$sensorId";
@res=$dbh->selectrow_array($sql);
$tmp=$res[0] * $unitFactor;
$tmp=int($tmp*100)/100;
${$sens}{$i}->{"sensorval"}->{"$j"}->[0]->{$dbColName}=$tmp;
}
$sensorID = $DBH->quote($sensorID);
1
2
3
4
5
6
$sql="SELECT $qdbcols FROM $table WHERE stationid = $stationId AND sensid=$sensorId";
#$sql.=" ORDER by datetime DESC,id DESC LIMIT 2";
$sql.=" ORDER by datetime DESC LIMIT 2";
# Query database for min, max and average of sensor
$sth = $dbh->prepare($sql);
$sth->execute;
1
2
3
4
5
6
$sql="SELECT ? FROM ? WHERE `stationid` = ? AND `sensid`=?";
#$sql.=" ORDER by `datetime` DESC,id DESC LIMIT 2";
$sql.=" ORDER by `datetime` DESC LIMIT 2";
# Query database for min, max and average of sensor
$sth = $dbh->prepare($sql);
$sth->execute($qdbcols,$table,$stationId,$sensorId );
1
2
3
$sql="SELECT SUM($dbColName) AS \"SUM\" FROM $table WHERE stationid = $stationId AND".
" datetime>=\"$midnightDateGMT $midnightTimeGMT\" AND".
" LEFT(datetime,10) <=\"$midnightDate $dayEndTime\" AND sensid=$sensorId";
1
2
3
$sql=qq{SELECT SUM(?) AS `SUM` FROM ? WHERE `stationid`=? AND `datetime` >= "? ?" AND LEFT(`datetime`,10) <= "? ?" AND `sensid`=?};
$sth = $dbh->prepare( $sql );
$sth->execute($dbColName, $table, $stationId, $midnightDateGMT, $midnightTimeGMT, $midnightDate, $dayEndTime, $sensorId);