missed a few lines to cleanup and move ALTER statements to sql_noresult
[migration-tools.git] / kmig.d / bin / mig-import
index 965fd48..95ddfa6 100755 (executable)
@@ -30,7 +30,7 @@ $mig_path =~ s|[^/]+$||;
 
 my @taglist = @ARGV;
 my $arg_list_length = scalar @taglist;
-if($arg_list_length < 1) { @taglist = ("authorisedvalues","booksellers","borrowerattributes","budgets","calendar","circrules","itemtypes","letters","libraries","patrontypes","preferences","reports","smsproviders"); } 
+if($arg_list_length < 1) { @taglist = ("libraries","patrontypes","itemtypes","authorisedvalues","booksellers","borrowerattributes","budgets","calendar","circrules","letters","preferences","reports","smsproviders"); } 
 $MIGGITDIR =~ s/\/\//\//;
 
 my @errors;
@@ -309,31 +309,18 @@ sub restore_budgets {
     my $dom = $parser->parse_file($restore_file);
 
     sql_noresult($dbh,"DELETE FROM aqbudgets WHERE 1 = 1");
-    my $sth = $dbh->prepare($query);
-    $sth->execute();
-    
     sql_noresult($dbh,"DELETE FROM aqbudgetperiods WHERE 1 = 1");
-    $sth = $dbh->prepare($query);
-    $sth->execute();
 
     my $budget_ai;
     my $budgetperiod_ai;
-
     foreach my $node ($dom->findnodes('/document/budgets')) {
         $budget_ai = sql_num($node->findvalue('./autoincrement'));
     }
-
     foreach my $node ($dom->findnodes('/document/budgetperiods')) {
         $budgetperiod_ai = sql_num($node->findvalue('./autoincrement'));
     }
-
-    $query = "ALTER TABLE aqbudgets AUTO_INCREMENT = $budget_ai";
-    $sth = $dbh->prepare($query);
-    $sth->execute();    
-
-    $query = "ALTER TABLE aqbudgetperiods AUTO_INCREMENT = $budgetperiod_ai";
-    $sth = $dbh->prepare($query);
-    $sth->execute();    
+    sql_noresult($dbh,"ALTER TABLE aqbudgets AUTO_INCREMENT = $budget_ai");
+    sql_noresult($dbh,"ALTER TABLE aqbudgetperiods AUTO_INCREMENT = $budgetperiod_ai");
 
     foreach my $node ($dom->findnodes('/document/budgetperiods/value')) {
         my $budget_period_id = sql_num($node->findvalue('./budget_period_id'));