*
* Version $Id$
*/
-
/*
- Copyright (C) 2002-2004 Kern Sibbald and John Walker
+ Copyright (C) 2002-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
/* For ua_dotcmds.c */
const char *client_backups =
-"SELECT DISTINCT Job.JobId,Client.Name as Client,Level,StartTime,"
-"JobFiles,JobBytes,VolumeName,MediaType"
-" FROM Client,Job,JobMedia,Media"
-" WHERE Client.Name='%s'"
-" AND Client.ClientId=Job.ClientId"
-" AND JobStatus='T'"
-" AND JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId"
-" ORDER BY Job.StartTime";
+ "SELECT DISTINCT Job.JobId,Client.Name as Client,Level,StartTime,"
+ "JobFiles,JobBytes,VolumeName,MediaType,FileSet"
+ " FROM Client,Job,JobMedia,Media,FileSet"
+ " WHERE Client.Name='%s'"
+ " AND FileSet='%s'"
+ " AND Client.ClientId=Job.ClientId"
+ " AND JobStatus='T'"
+ " AND JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId"
+ " AND Job.FileSetId=FileSet.FileSetId"
+ " ORDER BY Job.StartTime";
/* ====== ua_prune.c */
const char *upd_Purged = "UPDATE Job Set PurgedFiles=1 WHERE JobId=%s";
const char *cnt_DelCand = "SELECT count(*) FROM DelCandidates";
const char *del_Job = "DELETE FROM Job WHERE JobId=%s";
+const char *del_MAC = "DELETE FROM MAC WHERE JobId=%s";
const char *del_JobMedia = "DELETE FROM JobMedia WHERE JobId=%s";
const char *cnt_JobMedia = "SELECT count(*) FROM JobMedia WHERE MediaId=%s";
const char *sel_JobMedia = "SELECT JobId FROM JobMedia WHERE MediaId=%s";
/* List of SQL commands to create temp table and indicies */
const char *create_deltabs[] = {
- "CREATE TABLE DelCandidates ("
+ "CREATE TEMPORARY TABLE DelCandidates ("
#ifdef HAVE_MYSQL
"JobId INTEGER UNSIGNED NOT NULL, "
"PurgedFiles TINYINT, "
const char *uar_del_temp1 = "DROP TABLE temp1";
const char *uar_create_temp =
- "CREATE TABLE temp ("
+ "CREATE TEMPORARY TABLE temp ("
#ifdef HAVE_POSTGRESQL
"JobId INTEGER NOT NULL,"
"JobTDate BIGINT,"
#endif
const char *uar_create_temp1 =
- "CREATE TABLE temp1 ("
+ "CREATE TEMPORARY TABLE temp1 ("
#ifdef HAVE_POSTGRESQL
"JobId INTEGER NOT NULL,"
"JobTDate BIGINT)";
"GROUP BY File.FileIndex ";
#endif
+/* Query to get list of files from table -- presuably built by an external program */
+const char *uar_jobid_fileindex_from_table =
+ "SELECT JobId, FileIndex from %s";