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

configDB - prepare import/export

git-svn-id: https://svn.fhem.de/fhem/trunk@5265 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2014-03-20 19:43:52 +00:00
parent 9470638408
commit 668d500d59
2 changed files with 13 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $Id $
# $Id$
#
package main;
@ -14,6 +14,7 @@ my @pathname;
sub configdb_Initialize($$) {
my %hash = ( Fn => "CommandConfigdb",
Hlp => "info|list|diff|uuid|
export|import|
reorg|recover|backup ,access additional functions from configDB" );
$cmds{configdb} = \%hash;
}
@ -189,6 +190,13 @@ sub CommandConfigdb($$) {
$ret = _cfgDB_Export($param1, $param2);
}
when ('import') {
open ( FILE, "<./$param1" );
my @dbconfig = <FILE>;
close ( FILE );
$ret = _cfgDB_Execute(undef,@dbconfig);
}
when ('info') {
Log3('configdb', 4, "info requested.");
$ret = _cfgDB_Info;
@ -226,7 +234,7 @@ sub CommandConfigdb($$) {
}
default {
$ret = "\n Syntax:".
$ret = "\n Syntax:\n".
" configdb attr [attribute] [value]\n".
" configdb backup\n".
" configdb diff <device> <version>\n".

View File

@ -49,6 +49,8 @@
# restructured libraray internally
# improved source code documentation
#
# 2014-03-20 - added export/import
#
##############################################################################
#
@ -624,7 +626,7 @@ sub _cfgDB_Export($$) {
open( FILE, ">./$filename" );
while ( my $row = $sth->fetchrow_arrayref ) {
$counter++;
print FILE join( "|", @$row ), "\n";
print FILE join( " ", @$row ), "\n";
}
close ( FILE );