2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

configDB - code improvement

git-svn-id: https://svn.fhem.de/fhem/trunk@5687 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2014-04-28 17:53:37 +00:00
parent 976b815826
commit 54892dc026

View File

@ -192,8 +192,9 @@ if($cfgDB_dbconn =~ m/pg:/i) {
my ($row, $sql, @line, @rets);
my $fhem_dbh = _cfgDB_Connect;
my $uuid = $fhem_dbh->selectrow_array('SELECT versionuuid FROM fhemversions WHERE version = 0');
$sql = "SELECT * FROM fhemconfig WHERE DEVICE = '$readSpec' AND VERSIONUUID = '$uuid'";
$sql = "SELECT * FROM fhemconfig WHERE (DEVICE = 'global' OR DEVICE = 'configdb') and VERSIONUUID = '$uuid'" if($readSpec eq 'global');
$sql = "SELECT * FROM fhemconfig WHERE COMMAND = 'attr' AND DEVICE = '$readSpec' AND VERSIONUUID = '$uuid'";
$sql = "SELECT * FROM fhemconfig WHERE COMMAND = 'attr' AND (DEVICE = 'global' OR DEVICE = 'configdb') and VERSIONUUID = '$uuid'"
if($readSpec eq 'global');
my $sth = $fhem_dbh->prepare( $sql );
$sth->execute();
while (@line = $sth->fetchrow_array()) {
@ -729,6 +730,16 @@ sub _cfgDB_Diff($$) {
return $ret;
}
sub _cfgDB_AttrTypeSet($$){
my ($dName,$tName) = @_;
my @typeAttr = cfgDB_AttrRead($tName);
foreach my $ta (@typeAttr) {
my (undef,$n,$v) = split(/,/,$ta);
$attr{$dName}{$n} = $v;
}
return;
}
##################################################
# functions used for file handling
#