2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 05:06:35 +00:00

configDB - code cleanup

git-svn-id: https://svn.fhem.de/fhem/trunk@5732 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2014-05-03 12:00:31 +00:00
parent f46a4ba14d
commit bb131dc332

View File

@ -159,6 +159,7 @@ if($cfgDB_dbconn =~ m/pg:/i) {
my $count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhemconfig');
if($count < 1) {
# insert default entries to get fhem running
$fhem_dbh->commit();
my $uuid = _cfgDB_Uuid;
$fhem_dbh->do("INSERT INTO fhemversions values (0, '$uuid')");
_cfgDB_InsertLine($fhem_dbh, $uuid, '#created by cfgDB_Init');
@ -912,37 +913,6 @@ sub _cfgDB_Filelist(;$) {
#
#######################################
# replaced by cfgDB_AttrRead()
sub cfgDB_GlobalAttr {
my (@line, $row);
my $fhem_dbh = _cfgDB_Connect;
my $uuid = $fhem_dbh->selectrow_array('SELECT versionuuid FROM fhemversions WHERE version = 0');
my $sth = $fhem_dbh->prepare( "SELECT * FROM fhemconfig WHERE DEVICE = ( ? ) and VERSIONUUID = '$uuid'" );
$sth->execute('global');
while (@line = $sth->fetchrow_array()) {
$row = "$line[0] $line[1] $line[2] $line[3]";
$line[3] =~ s/#.*//;
$line[3] =~ s/ .*$//;
$attr{global}{$line[2]} = $line[3];
GlobalAttr("set", "global", $line[2], $line[3]);
}
$sth->execute('configdb');
while (@line = $sth->fetchrow_array()) {
$row = "$line[0] $line[1] $line[2] $line[3]";
$line[3] =~ s/#.*//;
$line[3] =~ s/ .*$//;
$attr{configdb}{$line[2]} = $line[3];
GlobalAttr("set", "global", $line[2], $line[3]);
}
$fhem_dbh->disconnect();
return;
}
# deprecated - replaced by cfgDB_FileRead()
sub _cfgDB_Readfile($) {
my ($filename) = @_;