diff --git a/fhem/CHANGED b/fhem/CHANGED index 3db61cc3d..4880ec0f6 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - bugfix: 93_DbLog: V2.22.7, bugfix in configCheck for PostgreSQL - feature: 10_MYSENSORS_DEVICE: updated to latest MYSENSORS version - feature: 50_TelegramBot: hide cmd in favorites/changed favorites confirm - feature: 49_SSCam: V2.9.0, function get homeModeState, minor fixes, diff --git a/fhem/FHEM/93_DbLog.pm b/fhem/FHEM/93_DbLog.pm index ecb0e6ba1..36f679638 100644 --- a/fhem/FHEM/93_DbLog.pm +++ b/fhem/FHEM/93_DbLog.pm @@ -16,6 +16,7 @@ ############################################################################################################################################ # Versions History done by DS_Starter & DeeSPe: # +# 2.22.7 24.09.2017 minor fixes in configcheck # 2.22.6 22.09.2017 commandref revised # 2.22.5 05.09.2017 fix Internal MODE isn't set correctly after DEF is edited, nextsynch is not renewed if reopen is # set manually after reopen was set with a delay Forum:#76213, Link to 98_FileLogConvert.pm added @@ -150,7 +151,7 @@ use Blocking; use Time::HiRes qw(gettimeofday tv_interval); use Encode qw(encode_utf8); -my $DbLogVersion = "2.22.6"; +my $DbLogVersion = "2.22.7"; my %columns = ("DEVICE" => 64, "TYPE" => 64, @@ -2848,26 +2849,26 @@ sub DbLog_configcheck($) { @sr_unt = DbLog_sqlget($hash,"SHOW FIELDS FROM history where FIELD='UNIT'"); } if($dbmodel =~ /POSTGRESQL/) { - @sr_dev = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='history' and column_name='device'"); - @sr_typ = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='history' and column_name='type'"); - @sr_evt = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='history' and column_name='event'"); - @sr_rdg = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='history' and column_name='reading'"); - @sr_val = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='history' and column_name='value'"); - @sr_unt = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='history' and column_name='unit'"); + @sr_dev = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='history' and column_name='device'"); + @sr_typ = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='history' and column_name='type'"); + @sr_evt = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='history' and column_name='event'"); + @sr_rdg = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='history' and column_name='reading'"); + @sr_val = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='history' and column_name='value'"); + @sr_unt = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='history' and column_name='unit'"); } $cdat_dev = @sr_dev?($sr_dev[1]):"no result"; - $cdat_dev =~ tr/varchar\(|\)//d; + $cdat_dev =~ tr/varchar\(|\)//d if($cdat_dev ne "no result"); $cdat_typ = @sr_typ?($sr_typ[1]):"no result"; - $cdat_typ =~ tr/varchar\(|\)//d; + $cdat_typ =~ tr/varchar\(|\)//d if($cdat_typ ne "no result"); $cdat_evt = @sr_evt?($sr_evt[1]):"no result"; - $cdat_evt =~ tr/varchar\(|\)//d; + $cdat_evt =~ tr/varchar\(|\)//d if($cdat_evt ne "no result"); $cdat_rdg = @sr_rdg?($sr_rdg[1]):"no result"; - $cdat_rdg =~ tr/varchar\(|\)//d; + $cdat_rdg =~ tr/varchar\(|\)//d if($cdat_rdg ne "no result"); $cdat_val = @sr_val?($sr_val[1]):"no result"; - $cdat_val =~ tr/varchar\(|\)//d; + $cdat_val =~ tr/varchar\(|\)//d if($cdat_val ne "no result"); $cdat_unt = @sr_unt?($sr_unt[1]):"no result"; - $cdat_unt =~ tr/varchar\(|\)//d; + $cdat_unt =~ tr/varchar\(|\)//d if($cdat_unt ne "no result"); $cmod_dev = $hash->{HELPER}{DEVICECOL}; $cmod_typ = $hash->{HELPER}{TYPECOL}; @@ -2894,7 +2895,7 @@ sub DbLog_configcheck($) { } $check .= "Result of table 'history' check

"; - $check .= "Column width set in DB $dbname: 'DEVICE' = $cdat_dev, 'TYPE' = $cdat_typ, 'EVENT' = $cdat_evt, 'READING' = $cdat_rdg, 'VALUE' = $cdat_val, 'UNIT' = $cdat_unt
"; + $check .= "Column width set in DB $dbname.history: 'DEVICE' = $cdat_dev, 'TYPE' = $cdat_typ, 'EVENT' = $cdat_evt, 'READING' = $cdat_rdg, 'VALUE' = $cdat_val, 'UNIT' = $cdat_unt
"; $check .= "Column width used by $name: 'DEVICE' = $cmod_dev, 'TYPE' = $cmod_typ, 'EVENT' = $cmod_evt, 'READING' = $cmod_rdg, 'VALUE' = $cmod_val, 'UNIT' = $cmod_unt
"; $check .= "Recommendation: $rec

"; @@ -2909,26 +2910,26 @@ sub DbLog_configcheck($) { } if($dbmodel =~ /POSTGRESQL/) { - @sr_dev = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='current' and column_name='device'"); - @sr_typ = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='current' and column_name='type'"); - @sr_evt = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='current' and column_name='event'"); - @sr_rdg = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='current' and column_name='reading'"); - @sr_val = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='current' and column_name='value'"); - @sr_unt = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_schema='$dbname' and table_name='current' and column_name='unit'"); + @sr_dev = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='current' and column_name='device'"); + @sr_typ = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='current' and column_name='type'"); + @sr_evt = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='current' and column_name='event'"); + @sr_rdg = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='current' and column_name='reading'"); + @sr_val = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='current' and column_name='value'"); + @sr_unt = DbLog_sqlget($hash,"select column_name,character_maximum_length from information_schema.columns where table_name='current' and column_name='unit'"); } $cdat_dev = @sr_dev?($sr_dev[1]):"no result"; - $cdat_dev =~ tr/varchar\(|\)//d; + $cdat_dev =~ tr/varchar\(|\)//d if($cdat_dev ne "no result"); $cdat_typ = @sr_typ?($sr_typ[1]):"no result"; - $cdat_typ =~ tr/varchar\(|\)//d; + $cdat_typ =~ tr/varchar\(|\)//d if($cdat_typ ne "no result"); $cdat_evt = @sr_evt?($sr_evt[1]):"no result"; - $cdat_evt =~ tr/varchar\(|\)//d; + $cdat_evt =~ tr/varchar\(|\)//d if($cdat_evt ne "no result"); $cdat_rdg = @sr_rdg?($sr_rdg[1]):"no result"; - $cdat_rdg =~ tr/varchar\(|\)//d; + $cdat_rdg =~ tr/varchar\(|\)//d if($cdat_rdg ne "no result"); $cdat_val = @sr_val?($sr_val[1]):"no result"; - $cdat_val =~ tr/varchar\(|\)//d; + $cdat_val =~ tr/varchar\(|\)//d if($cdat_val ne "no result"); $cdat_unt = @sr_unt?($sr_unt[1]):"no result"; - $cdat_unt =~ tr/varchar\(|\)//d; + $cdat_unt =~ tr/varchar\(|\)//d if($cdat_unt ne "no result"); $cmod_dev = $hash->{HELPER}{DEVICECOL}; $cmod_typ = $hash->{HELPER}{TYPECOL}; @@ -2955,7 +2956,7 @@ sub DbLog_configcheck($) { } $check .= "Result of table 'current' check

"; - $check .= "Column width set in DB $dbname: 'DEVICE' = $cdat_dev, 'TYPE' = $cdat_typ, 'EVENT' = $cdat_evt, 'READING' = $cdat_rdg, 'VALUE' = $cdat_val, 'UNIT' = $cdat_unt
"; + $check .= "Column width set in DB $dbname.current: 'DEVICE' = $cdat_dev, 'TYPE' = $cdat_typ, 'EVENT' = $cdat_evt, 'READING' = $cdat_rdg, 'VALUE' = $cdat_val, 'UNIT' = $cdat_unt
"; $check .= "Column width used by $name: 'DEVICE' = $cmod_dev, 'TYPE' = $cmod_typ, 'EVENT' = $cmod_evt, 'READING' = $cmod_rdg, 'VALUE' = $cmod_val, 'UNIT' = $cmod_unt
"; $check .= "Recommendation: $rec

"; @@ -4486,7 +4487,8 @@ sub checkUsePK ($$){ Sample code and Scripts to prepare a MySQL/PostgreSQL/SQLite database you can find in contrib/dblog/<DBType>_create.sql. The database contains two tables: current and history.
The latter contains all events whereas the former only contains the last event for any given reading and device. - (see also attribute DbLogType) + Please consider the attribute DbLogType implicitly to determine the usage of tables + current and history.

The columns have the following meaning::

@@ -5350,7 +5352,9 @@ sub checkUsePK ($$){ enthalten. Die Datenbank beinhaltet 2 Tabellen: current und history.
Die Tabelle current enthält den letzten Stand pro Device und Reading.
- In der Tabelle history sind alle Events historisch gespeichert. (siehe auch Attribut DbLogType) + In der Tabelle history sind alle Events historisch gespeichert.
+ Beachten sie bitte unbedingt das Attribut DbLogType um die Benutzung der Tabellen + current und history festzulegen.

Die Tabellenspalten haben folgende Bedeutung: