create host config file, auto-configure path to restore file, better output
[BackupPC.git] / dbxml / convert_pgsql_xmldb.pl
index fa859b9..089c957 100755 (executable)
@@ -19,9 +19,11 @@ my $xmldb_container = 'backuppc.dbxml';
 my $connect = "DBI:Pg:dbname=backuppc";
 
 my $commit_every = 100;
+my $limit = 0; # no limit
+#$limit = 1000;
 
 my $bar = Term::ProgressBar->new({
-       count => 100,
+       count => 1000,
 #      fh    => \*STDOUT,
 #      name  => 'thingy',
        ETA     => 'linear',
@@ -84,6 +86,8 @@ join backups on shares.hostid = backups.hostid
 order by backups.date
 };
 
+$sql .= qq{ limit $limit } if ($limit);
+
 _debug("prepare");
 my $sth = $dbh->prepare($sql) || die $dbh->errstr();
 _debug("execute");
@@ -96,7 +100,7 @@ my $next_update = 0;
 
 while (my $row = $sth->fetchrow_hashref() ) {
 
-       my $xml = XMLout( $row );
+       my $xml = XMLout( $row, NoAttr => 1, RootName => 'file' );
        if ($xml) {
                # Set the XmlDocument to the relevant string and then put it 
                #  into the container.
@@ -126,6 +130,6 @@ while (my $row = $sth->fetchrow_hashref() ) {
 
 # Commit the writes. This causes the container write operations
 #   to be saved to the container.
-_debug("commit");
+_debug("final commit");
 $txn->commit();