From f6cf456abdd20aee1c004ff14d3ddc3b5fe2e36e Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Tue, 5 Sep 2017 14:43:00 +0000 Subject: [PATCH] contrib/configdb: for debugging git-svn-id: https://svn.fhem.de/fhem/trunk@15011 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/configDB/configDB.pm | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/fhem/contrib/configDB/configDB.pm b/fhem/contrib/configDB/configDB.pm index 84be4dacb..b32da161f 100644 --- a/fhem/contrib/configDB/configDB.pm +++ b/fhem/contrib/configDB/configDB.pm @@ -179,8 +179,7 @@ sub _cfgDB_Reorg(;$$); sub _cfgDB_Rotate($$); sub _cfgDB_Search($$;$); sub _cfgDB_Uuid(); -sub _cfgDB_table_exists($$) { - +sub _cfgDB_table_exists($$); ################################################## # Read configuration file for DB connection @@ -301,20 +300,16 @@ sub cfgDB_Init() { } ### migrate fhembinfilesave to fhemb64filesave - # check: fhembinfilesave exists? +# # check: fhembinfilesave exists? # my $sth_test = $fhem_dbh->table_info(undef, 'public', "fhembinfilesave", 'TABLE'); # $sth_test->execute; # my @info = $sth_test->fetchrow_array; # my $exists = scalar @info; -# printf "exists: $exists\n"; -# if ($exists) { - - if ( _cfgDB_table_exists($fhem_dbh,"fhembinfilesave") ) { + if (_cfgDB_table_exists($fhem_dbh,'fhembinfilesave')) { # $sth_test->finish(); # check: any files for migratione? $count = undef; $count = $fhem_dbh->selectrow_array('SELECT count(*) FROM fhembinfilesave'); - printf "count: $count\n"; if ($count > 0) { printf "need to migrate $count files to base64\n"; my @toMigrate; @@ -345,21 +340,22 @@ sub cfgDB_Init() { # close database connection $fhem_dbh->commit(); $fhem_dbh->disconnect(); + return; -}} +} sub _cfgDB_table_exists($$) { my ($dbh,$table) = @_; printf "looking for table fhembinfilesave\n"; my @tables = $dbh->tables('','','','TABLE'); if (@tables) { - printf "testing 1\n"; + printf "testing #1\n"; for (@tables) { next unless $_; return 1 if $_ eq $table } } else { - printf "testing 2\n"; + printf "testing #2\n"; eval { local $dbh->{PrintError} = 0; local $dbh->{RaiseError} = 1; @@ -367,7 +363,7 @@ sub _cfgDB_table_exists($$) { }; return 1 unless $@; } - printf "table not found.\n"; + printf "table not found\n"; return 0; }