const char *create_delindex = "CREATE INDEX DelInx1 ON DelCandidates (JobId)";
-/* Fill candidates table with all Jobs subject to being deleted.
- * This is used for pruning Jobs (first the files, then the Jobs).
- */
-const char *insert_delcand =
- "INSERT INTO DelCandidates "
- "SELECT JobId,PurgedFiles,FileSetId,JobFiles,JobStatus FROM Job "
- "WHERE Type IN ('B', 'C', 'M') "
- "AND JobTDate<%s "
- "AND ClientId=%s";
-
-/*
- * Select Jobs from the DelCandidates table that have a
- * more recent backup -- i.e. are not the only backup.
- * This is the list of Jobs to delete for a Backup Job.
- * At the same time, we select "orphanned" jobs
- * (i.e. no files, ...) for deletion.
- */
-#ifdef old_way
-const char *select_backup_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobTDate<%s AND ((DelCandidates.JobFiles=0) OR "
- "(DelCandidates.JobStatus NOT IN ('T','W')))) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Level='F' AND Job.JobStatus IN ('T','W') AND Job.Type IN ('B','M') "
- "AND Job.FileSetId=DelCandidates.FileSetId)";
-
-/* Select Jobs from the DelCandidates table that have a
- * more recent InitCatalog -- i.e. are not the only InitCatalog
- * This is the list of Jobs to delete for a Verify Job.
- */
-const char *select_verify_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='V' AND Job.Level='V' AND Job.JobStatus IN ('T','W') "
- "AND Job.FileSetId=DelCandidates.FileSetId)";
-
-
-/* Select Jobs from the DelCandidates table.
- * This is the list of Jobs to delete for a Restore Job.
- */
-const char *select_restore_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='R')";
-
-/* Select Jobs from the DelCandidates table.
- * This is the list of Jobs to delete for an Admin Job.
- */
-const char *select_admin_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='D')";
-
-/*
- * Select Jobs from the DelCandidates table.
- * This is the list of Jobs to delete for an Migrate Job.
- */
-const char *select_migrate_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='g')";
-
-/*
- * Select Jobs from the DelCandidates table.
- * This is the list of Jobs to delete for an Copy Job.
- */
-const char *select_copy_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='c')";
-
-
-#else
-/* Faster way */
-const char *select_backup_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobId=DelCandidates.JobId AND ((DelCandidates.JobFiles=0) OR "
- "(DelCandidates.JobStatus NOT IN ('T','W')))) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Level='F' AND Job.JobStatus IN ('T','W') AND Job.Type IN ('B','M') "
- "AND Job.FileSetId=DelCandidates.FileSetId)";
-
-/* Select Jobs from the DelCandidates table that have a
- * more recent InitCatalog -- i.e. are not the only InitCatalog
- * This is the list of Jobs to delete for a Verify Job.
- */
-const char *select_verify_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='V' AND Job.Level='V' AND Job.JobStatus IN ('T','W') "
- "AND Job.FileSetId=DelCandidates.FileSetId)";
-
-
-/* Select Jobs from the DelCandidates table.
- * This is the list of Jobs to delete for a Restore Job.
- */
-const char *select_restore_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='R')";
-
-/* Select Jobs from the DelCandidates table.
- * This is the list of Jobs to delete for an Admin Job.
- */
-const char *select_admin_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='D')";
-
-/*
- * Select Jobs from the DelCandidates table.
- * This is the list of Jobs to delete for an Migrate Job.
- */
-const char *select_migrate_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='g')";
-
-const char *select_copy_del =
- "SELECT DISTINCT DelCandidates.JobId,DelCandidates.PurgedFiles "
- "FROM Job,DelCandidates "
- "WHERE (Job.JobId=DelCandidates.JobId AND DelCandidates.JobStatus NOT IN ('T','W')) OR "
- "(Job.JobTDate>%s "
- "AND Job.ClientId=%s "
- "AND Job.Type='c')";
-
-
-#endif
-
/* ======= ua_restore.c */
const char *uar_count_files =
"SELECT JobFiles FROM Job WHERE JobId=%s";