From 4408e4964f75007f1e39e9b7d1a9d0ecd3be50cd Mon Sep 17 00:00:00 2001 From: betateilchen Date: Thu, 3 Apr 2014 15:43:17 +0000 Subject: [PATCH] configDB.pm - fixed: error global attributes not read from version 0 git-svn-id: https://svn.fhem.de/fhem/trunk@5423 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/configDB.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fhem/configDB.pm b/fhem/configDB.pm index 1676b3377..2d90debc5 100644 --- a/fhem/configDB.pm +++ b/fhem/configDB.pm @@ -50,6 +50,9 @@ # improved source code documentation # # 2014-03-20 - added export/import +# 2014-04-01 - removed export/import due to not working properly +# +# 2014-04-03 - fixed global attributes not read from version 0 # ############################################################################## # @@ -162,7 +165,8 @@ sub cfgDB_GlobalAttr { my ($sth, @line, $row, @dbconfig); my $fhem_dbh = _cfgDB_Connect; - $sth = $fhem_dbh->prepare( "SELECT * FROM fhemconfig WHERE DEVICE = 'global'" ); + my $uuid = $fhem_dbh->selectrow_array('SELECT versionuuid FROM fhemversions WHERE version = 0'); + $sth = $fhem_dbh->prepare( "SELECT * FROM fhemconfig WHERE DEVICE = 'global' and VERSIONUUID = '$uuid'" ); $sth->execute(); while (@line = $sth->fetchrow_array()) { @@ -172,7 +176,7 @@ sub cfgDB_GlobalAttr { $attr{global}{$line[2]} = $line[3]; } - $sth = $fhem_dbh->prepare( "SELECT * FROM fhemconfig WHERE DEVICE = 'configdb'" ); + $sth = $fhem_dbh->prepare( "SELECT * FROM fhemconfig WHERE DEVICE = 'configdb' and VERSIONUUID = '$uuid'" ); $sth->execute(); while (@line = $sth->fetchrow_array()) { @@ -373,7 +377,7 @@ sub _cfgDB_ReadCfg(@) { # using a join would be much nicer, but does not work due to sort of join's result my $uuid = $fhem_dbh->selectrow_array('SELECT versionuuid FROM fhemversions WHERE version = 0'); - $sth = $fhem_dbh->prepare( "SELECT * FROM fhemconfig WHERE versionuuid = '$uuid'" ); + $sth = $fhem_dbh->prepare( "SELECT * FROM fhemconfig WHERE versionuuid = '$uuid' and device <>'configdb'" ); $sth->execute(); while (@line = $sth->fetchrow_array()) {