Fix up "bestdb" bits
authorGreg Sabino Mullane <greg@endpoint.com>
Thu, 23 Feb 2012 21:27:35 +0000 (16:27 -0500)
committerGreg Sabino Mullane <greg@endpoint.com>
Thu, 23 Feb 2012 21:27:35 +0000 (16:27 -0500)
bucardo

diff --git a/bucardo b/bucardo
index 632762ee1407f6440580dfa66e29478b8d08646b..49dfecb9dd33255b1b1763447090c00d78595f11 100755 (executable)
--- a/bucardo
+++ b/bucardo
@@ -4354,8 +4354,8 @@ sub get_goat_ids {
     ## Which tables we added to the goat table
     my %new;
 
-    ## Figure out which database to search in
-    my $bestdb = find_best_db_for_searching();
+    ## Figure out which database to search in, unless already given
+    my $bestdb = exists $dbcols->{db} ? $dbcols->{db} : find_best_db_for_searching();
 
     ## This check still makes sense: if no databases, there should be nothing in $GOAT!
     if (! defined $bestdb) {
@@ -4557,6 +4557,7 @@ sub add_items_to_goat_table {
         my @args = ($schema, $table, $reltype, $db);
         if (exists $info->{$name}{dbcols}) {
             for my $newcol (sort keys %{ $info->{$name}{dbcols} }) {
+                next if $newcol eq 'db';
                 $SQL =~ s/\)/,$newcol)/;
                 $SQL =~ s/\?,/?,?,/;
                 push @args => $info->{$name}{dbcols}{$newcol};