]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/tools/dbcheck.c
Change to inner joins. The outer joins don't get us any more resulting records
[bacula/bacula] / bacula / src / tools / dbcheck.c
index 4e5eee8aabbf7133e8bbe443f480aea9fd551992..1963931e64efa15aa34ea67c379744c0ebc07b1d 100644 (file)
@@ -1,13 +1,3 @@
-/*
- *
- *  Program to check a Bacula database for consistency and to
- *   make repairs
- *
- *   Kern E. Sibbald, August 2002
- *
- *   Version $Id$
- *
- */
 /*
    Bacula® - The Network Backup Solution
 
@@ -17,8 +7,8 @@
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
    modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+/*
+ *
+ *  Program to check a Bacula database for consistency and to
+ *   make repairs
+ *
+ *   Kern E. Sibbald, August 2002
+ *
+ *   Version $Id$
+ *
+ */
 
 #include "bacula.h"
 #include "cats/cats.h"
@@ -732,6 +732,8 @@ static void eliminate_orphaned_jobmedia_records()
       if (fix && id_list.num_ids > 0) {
          printf(_("Deleting %d orphaned JobMedia records.\n"), id_list.num_ids);
          delete_id_list("DELETE FROM JobMedia WHERE JobMediaId=%s", &id_list);
+      } else {
+         break;                       /* get out if not updating db */
       }
       if (!make_id_list(query, &id_list)) {
          exit(1);
@@ -773,6 +775,8 @@ static void eliminate_orphaned_file_records()
       if (fix && id_list.num_ids > 0) {
          printf(_("Deleting %d orphaned File records.\n"), id_list.num_ids);
          delete_id_list("DELETE FROM File WHERE FileId=%s", &id_list);
+      } else {
+         break;                       /* get out if not updating db */
       }
       if (!make_id_list(query, &id_list)) {
          exit(1);
@@ -810,6 +814,8 @@ static void eliminate_orphaned_path_records()
       if (fix && id_list.num_ids > 0) {
          printf(_("Deleting %d orphaned Path records.\n"), id_list.num_ids);
          delete_id_list("DELETE FROM Path WHERE PathId=%s", &id_list);
+      } else {
+         break;                       /* get out if not updating db */
       }
       if (!make_id_list(query, &id_list)) {
          exit(1);
@@ -847,6 +853,8 @@ static void eliminate_orphaned_filename_records()
       if (fix && id_list.num_ids > 0) {
          printf(_("Deleting %d orphaned Filename records.\n"), id_list.num_ids);
          delete_id_list("DELETE FROM Filename WHERE FilenameId=%s", &id_list);
+      } else {
+         break;                       /* get out if not updating db */
       }
       if (!make_id_list(query, &id_list)) {
          exit(1);