2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

configdb - added command "fileshow" to display file content

git-svn-id: https://svn.fhem.de/fhem/trunk@5595 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2014-04-21 18:53:43 +00:00
parent a8e5d2df39
commit 99f59ee857
2 changed files with 7 additions and 2 deletions

View File

@ -226,6 +226,11 @@ sub CommandConfigdb($$) {
return _cfgDB_Filelist;
}
when ('fileshow') {
my $r = _cfgDB_Readfile($param1);
return ($r)?$r:"File $param1 not found in database.";
}
when ('info') {
Log3('configdb', 4, "info requested.");
$ret = _cfgDB_Info;

View File

@ -734,7 +734,7 @@ sub _cfgDB_Readfile($) {
$sth->execute();
my @outfile;
while (my @line = $sth->fetchrow_array()) {
push @outfile, "$line[0] ";
push @outfile, "$line[0]";
}
$sth->finish();
$fhem_dbh->disconnect();
@ -749,7 +749,7 @@ sub _cfgDB_Writefile($$) {
$fhem_dbh->do("delete from fhemfilesave where filename = '$filename'");
my $sth = $fhem_dbh->prepare('INSERT INTO fhemfilesave values (?, ?)');
foreach (@c){
$sth->execute($filename,$_);
$sth->execute($filename,rtrim($_));
}
$sth->finish();
$fhem_dbh->commit();