From: Marco van Wieringen Date: Thu, 1 Apr 2010 17:26:33 +0000 (+0200) Subject: Drop Ingres specific versions of queries with #ifdefs X-Git-Tag: Release-5.0.2~133 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=58ee8849be0febcda4a2dc5bf7cc8d19277727b8;p=bacula%2Fbacula Drop Ingres specific versions of queries with #ifdefs --- diff --git a/bacula/src/cats/sql_cmds.c b/bacula/src/cats/sql_cmds.c index b8dd1b4c9b..c368cfb0e4 100644 --- a/bacula/src/cats/sql_cmds.c +++ b/bacula/src/cats/sql_cmds.c @@ -287,19 +287,11 @@ const char *uar_count_files = "SELECT JobFiles FROM Job WHERE JobId=%s"; /* List last 20 Jobs */ -#if HAVE_INGRES -const char *uar_list_jobs = - "SELECT JobId,Client.Name as Client,StartTime,Level as " - "JobLevel,JobFiles,JobBytes " - "FROM Client,Job WHERE Client.ClientId=Job.ClientId AND JobStatus IN ('T','W') " - "AND Type='B' ORDER BY StartTime DESC FETCH FIRST 20 ROWS ONLY"; -#else const char *uar_list_jobs = "SELECT JobId,Client.Name as Client,StartTime,Level as " "JobLevel,JobFiles,JobBytes " "FROM Client,Job WHERE Client.ClientId=Job.ClientId AND JobStatus IN ('T','W') " "AND Type='B' ORDER BY StartTime DESC LIMIT 20"; -#endif const char *uar_print_jobs = "SELECT DISTINCT JobId,Level,JobFiles,JobBytes,StartTime,VolumeName" @@ -320,21 +312,6 @@ const char *uar_sel_files = const char *uar_del_temp = "DROP TABLE temp"; const char *uar_del_temp1 = "DROP TABLE temp1"; -#if HAVE_INGRES -const char *uar_last_full = - "INSERT INTO temp1 SELECT Job.JobId,JobTdate " - "FROM Client,Job,JobMedia,Media,FileSet WHERE Client.ClientId=%s " - "AND Job.ClientId=%s " - "AND Job.StartTime < '%s' " - "AND Level='F' AND JobStatus IN ('T','W') AND Type='B' " - "AND JobMedia.JobId=Job.JobId " - "AND Media.Enabled=1 " - "AND JobMedia.MediaId=Media.MediaId " - "AND Job.FileSetId=FileSet.FileSetId " - "AND FileSet.FileSet='%s' " - "%s" - "ORDER BY Job.JobTDate DESC FETCH FIRST 1 ROW ONLY"; -#else const char *uar_last_full = "INSERT INTO temp1 SELECT Job.JobId,JobTdate " "FROM Client,Job,JobMedia,Media,FileSet WHERE Client.ClientId=%s " @@ -348,7 +325,6 @@ const char *uar_last_full = "AND FileSet.FileSet='%s' " "%s" "ORDER BY Job.JobTDate DESC LIMIT 1"; -#endif const char *uar_full = "INSERT INTO temp SELECT Job.JobId,Job.JobTDate," @@ -360,24 +336,6 @@ const char *uar_full = "AND JobMedia.JobId=Job.JobId " "AND JobMedia.MediaId=Media.MediaId"; -#if HAVE_INGRES -const char *uar_dif = - "INSERT INTO temp SELECT Job.JobId,Job.JobTDate,Job.ClientId," - "Job.Level,Job.JobFiles,Job.JobBytes," - "Job.StartTime,Media.VolumeName,JobMedia.StartFile," - "Job.VolSessionId,Job.VolSessionTime " - "FROM Job,JobMedia,Media,FileSet " - "WHERE Job.JobTDate>%s AND Job.StartTime<'%s' " - "AND Job.ClientId=%s " - "AND JobMedia.JobId=Job.JobId " - "AND Media.Enabled=1 " - "AND JobMedia.MediaId=Media.MediaId " - "AND Job.Level='D' AND JobStatus IN ('T','W') AND Type='B' " - "AND Job.FileSetId=FileSet.FileSetId " - "AND FileSet.FileSet='%s' " - "%s" - "ORDER BY Job.JobTDate DESC FETCH FIRST 1 ROW ONLY"; -#else const char *uar_dif = "INSERT INTO temp SELECT Job.JobId,Job.JobTDate,Job.ClientId," "Job.Level,Job.JobFiles,Job.JobBytes," @@ -394,7 +352,6 @@ const char *uar_dif = "AND FileSet.FileSet='%s' " "%s" "ORDER BY Job.JobTDate DESC LIMIT 1"; -#endif const char *uar_inc = "INSERT INTO temp SELECT Job.JobId,Job.JobTDate,Job.ClientId," @@ -443,20 +400,6 @@ const char *uar_mediatype = * Find JobId, FileIndex for a given path/file and date * for use when inserting individual files into the tree. */ -#if HAVE_INGRES -const char *uar_jobid_fileindex = - "SELECT Job.JobId,File.FileIndex FROM Job,File,Path,Filename,Client " - "WHERE Job.JobId=File.JobId " - "AND Job.StartTime<='%s' " - "AND Path.Path='%s' " - "AND Filename.Name='%s' " - "AND Client.Name='%s' " - "AND Job.ClientId=Client.ClientId " - "AND Path.PathId=File.PathId " - "AND Filename.FilenameId=File.FilenameId " - "AND JobStatus IN ('T','W') AND Type='B' " - "ORDER BY Job.StartTime DESC FETCH FIRST 1 ROW ONLY"; -#else const char *uar_jobid_fileindex = "SELECT Job.JobId,File.FileIndex FROM Job,File,Path,Filename,Client " "WHERE Job.JobId=File.JobId " @@ -469,22 +412,7 @@ const char *uar_jobid_fileindex = "AND Filename.FilenameId=File.FilenameId " "AND JobStatus IN ('T','W') AND Type='B' " "ORDER BY Job.StartTime DESC LIMIT 1"; -#endif -#if HAVE_INGRES -const char *uar_jobids_fileindex = - "SELECT Job.JobId,File.FileIndex FROM Job,File,Path,Filename,Client " - "WHERE Job.JobId IN (%s) " - "AND Job.JobId=File.JobId " - "AND Job.StartTime<='%s' " - "AND Path.Path='%s' " - "AND Filename.Name='%s' " - "AND Client.Name='%s' " - "AND Job.ClientId=Client.ClientId " - "AND Path.PathId=File.PathId " - "AND Filename.FilenameId=File.FilenameId " - "ORDER BY Job.StartTime DESC FETCH FIRST 1 ROW ONLY"; -#else const char *uar_jobids_fileindex = "SELECT Job.JobId,File.FileIndex FROM Job,File,Path,Filename,Client " "WHERE Job.JobId IN (%s) " @@ -497,7 +425,6 @@ const char *uar_jobids_fileindex = "AND Path.PathId=File.PathId " "AND Filename.FilenameId=File.FilenameId " "ORDER BY Job.StartTime DESC LIMIT 1"; -#endif /* Query to get list of files from table -- presuably built by an external program */ const char *uar_jobid_fileindex_from_table = diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index 6247e10ce0..3920798a0b 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -75,21 +75,12 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime) /* If no Id given, we must find corresponding job */ if (jr->JobId == 0) { /* Differential is since last Full backup */ -#if HAVE_INGRES - Mmsg(mdb->cmd, -"SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " -"Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s " -"ORDER BY StartTime DESC FETCH FIRST 1 ROW ONLY", - jr->JobType, L_FULL, jr->Name, - edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2)); -#else Mmsg(mdb->cmd, "SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " "Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s " "ORDER BY StartTime DESC LIMIT 1", jr->JobType, L_FULL, jr->Name, edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2)); -#endif if (jr->JobLevel == L_DIFFERENTIAL) { /* SQL cmd for Differential backup already edited above */ @@ -114,21 +105,12 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime) } sql_free_result(mdb); /* Now edit SQL command for Incremental Job */ -#if HAVE_INGRES - Mmsg(mdb->cmd, -"SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " -"Level IN ('%c','%c','%c') AND Name='%s' AND ClientId=%s " -"AND FileSetId=%s ORDER BY StartTime DESC FETCH FIRST 1 ROW ONLY", - jr->JobType, L_INCREMENTAL, L_DIFFERENTIAL, L_FULL, jr->Name, - edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2)); -#else Mmsg(mdb->cmd, "SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " "Level IN ('%c','%c','%c') AND Name='%s' AND ClientId=%s " "AND FileSetId=%s ORDER BY StartTime DESC LIMIT 1", jr->JobType, L_INCREMENTAL, L_DIFFERENTIAL, L_FULL, jr->Name, edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2)); -#endif } else { Mmsg1(mdb->errmsg, _("Unknown level=%d\n"), jr->JobLevel); goto bail_out; @@ -184,21 +166,12 @@ db_find_last_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime, i pm_strcpy(stime, "0000-00-00 00:00:00"); /* default */ -#if HAVE_INGRES - Mmsg(mdb->cmd, -"SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " -"Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s " -"ORDER BY StartTime DESC FETCH FIRST 1 ROW ONLY", - jr->JobType, JobLevel, jr->Name, - edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2)); -#else Mmsg(mdb->cmd, "SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " "Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s " "ORDER BY StartTime DESC LIMIT 1", jr->JobType, JobLevel, jr->Name, edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2)); -#endif if (!QUERY_DB(jcr, mdb, mdb->cmd)) { Mmsg2(&mdb->errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"), sql_strerror(mdb), mdb->cmd); @@ -236,16 +209,6 @@ db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int & db_lock(mdb); /* Differential is since last Full backup */ -#if HAVE_INGRES - Mmsg(mdb->cmd, -"SELECT Level FROM Job WHERE JobStatus NOT IN ('T','W') AND " -"Type='%c' AND Level IN ('%c','%c') AND Name='%s' AND ClientId=%s " -"AND FileSetId=%s AND StartTime>'%s' " -"ORDER BY StartTime DESC FETCH FIRST 1 ROW ONLY", - jr->JobType, L_FULL, L_DIFFERENTIAL, jr->Name, - edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2), - stime); -#else Mmsg(mdb->cmd, "SELECT Level FROM Job WHERE JobStatus NOT IN ('T','W') AND " "Type='%c' AND Level IN ('%c','%c') AND Name='%s' AND ClientId=%s " @@ -254,7 +217,6 @@ db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int & jr->JobType, L_FULL, L_DIFFERENTIAL, jr->Name, edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2), stime); -#endif if (!QUERY_DB(jcr, mdb, mdb->cmd)) { db_unlock(mdb); return false; @@ -291,46 +253,24 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr) db_lock(mdb); Dmsg2(100, "JobLevel=%d JobType=%d\n", jr->JobLevel, jr->JobType); if (jr->JobLevel == L_VERIFY_CATALOG) { -#if HAVE_INGRES - Mmsg(mdb->cmd, -"SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND " -" JobStatus IN ('T','W') AND Name='%s' AND " -"ClientId=%s ORDER BY StartTime DESC FETCH FIRST 1 ROW ONLY", - L_VERIFY_INIT, jr->Name, - edit_int64(jr->ClientId, ed1)); -#else Mmsg(mdb->cmd, "SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND " " JobStatus IN ('T','W') AND Name='%s' AND " "ClientId=%s ORDER BY StartTime DESC LIMIT 1", L_VERIFY_INIT, jr->Name, edit_int64(jr->ClientId, ed1)); -#endif } else if (jr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG || jr->JobLevel == L_VERIFY_DISK_TO_CATALOG || jr->JobType == JT_BACKUP) { if (Name) { -#if HAVE_INGRES - Mmsg(mdb->cmd, -"SELECT JobId FROM Job WHERE Type='B' AND JobStatus IN ('T','W') AND " -"Name='%s' ORDER BY StartTime DESC FETCH FIRST 1 ROW ONLY", Name); -#else Mmsg(mdb->cmd, "SELECT JobId FROM Job WHERE Type='B' AND JobStatus IN ('T','W') AND " "Name='%s' ORDER BY StartTime DESC LIMIT 1", Name); -#endif } else { -#if HAVE_INGRES - Mmsg(mdb->cmd, -"SELECT JobId FROM Job WHERE Type='B' AND JobStatus IN ('T','W') AND " -"ClientId=%s ORDER BY StartTime DESC FETCH FIRST 1 ROW ONLY", - edit_int64(jr->ClientId, ed1)); -#else Mmsg(mdb->cmd, "SELECT JobId FROM Job WHERE Type='B' AND JobStatus IN ('T','W') AND " "ClientId=%s ORDER BY StartTime DESC LIMIT 1", edit_int64(jr->ClientId, ed1)); -#endif } } else { Mmsg1(&mdb->errmsg, _("Unknown Job level=%d\n"), jr->JobLevel); @@ -383,19 +323,6 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr db_lock(mdb); if (item == -1) { /* find oldest volume */ /* Find oldest volume */ -#if HAVE_INGRES - Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks," - "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes," - "MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs," - "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger," - "EndFile,EndBlock,VolParts,LabelType,LabelDate,StorageId," - "Enabled,LocationId,RecycleCount,InitialWrite," - "ScratchPoolId,RecyclePoolId,VolReadTime,VolWriteTime,ActionOnPurge " - "FROM Media WHERE PoolId=%s AND MediaType='%s' AND VolStatus IN ('Full'," - "'Recycle','Purged','Used','Append') AND Enabled=1 " - "ORDER BY LastWritten FETCH FIRST 1 ROW ONLY", - edit_int64(mr->PoolId, ed1), mr->MediaType); -#else Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks," "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes," "MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs," @@ -407,7 +334,6 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr "'Recycle','Purged','Used','Append') AND Enabled=1 " "ORDER BY LastWritten LIMIT 1", edit_int64(mr->PoolId, ed1), mr->MediaType); -#endif item = 1; } else { POOL_MEM changer(PM_FNAME); @@ -422,21 +348,6 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr } else { order = "ORDER BY LastWritten IS NULL,LastWritten DESC,MediaId"; /* take most recently written */ } -#if HAVE_INGRES - Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks," - "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes," - "MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs," - "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger," - "EndFile,EndBlock,VolParts,LabelType,LabelDate,StorageId," - "Enabled,LocationId,RecycleCount,InitialWrite," - "ScratchPoolId,RecyclePoolId,VolReadTime,VolWriteTime,ActionOnPurge " - "FROM Media WHERE PoolId=%s AND MediaType='%s' AND Enabled=1 " - "AND VolStatus='%s' " - "%s " - "%s FETCH FIRST %d ROWS ONLY", - edit_int64(mr->PoolId, ed1), mr->MediaType, - mr->VolStatus, changer.c_str(), order, item); -#else Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks," "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes," "MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs," @@ -450,7 +361,6 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr "%s LIMIT %d", edit_int64(mr->PoolId, ed1), mr->MediaType, mr->VolStatus, changer.c_str(), order, item); -#endif } Dmsg1(050, "fnextvol=%s\n", mdb->cmd); if (!QUERY_DB(jcr, mdb, mdb->cmd)) { diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 729d53b98a..b5e9c9677d 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -116,16 +116,6 @@ int db_get_file_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr, FILE_DBR *fdbr) char ed1[50], ed2[50], ed3[50]; if (jcr->getJobLevel() == L_VERIFY_DISK_TO_CATALOG) { -#if HAVE_INGRES - Mmsg(mdb->cmd, -"SELECT FileId, LStat, MD5 FROM File,Job WHERE " -"File.JobId=Job.JobId AND File.PathId=%s AND " -"File.FilenameId=%s AND Job.Type='B' AND Job.JobStatus IN ('T','W') AND " -"ClientId=%s ORDER BY StartTime DESC FETCH FIRST 1 ROW ONLY", - edit_int64(fdbr->PathId, ed1), - edit_int64(fdbr->FilenameId, ed2), - edit_int64(jr->ClientId,ed3)); -#else Mmsg(mdb->cmd, "SELECT FileId, LStat, MD5 FROM File,Job WHERE " "File.JobId=Job.JobId AND File.PathId=%s AND " @@ -134,7 +124,6 @@ int db_get_file_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr, FILE_DBR *fdbr) edit_int64(fdbr->PathId, ed1), edit_int64(fdbr->FilenameId, ed2), edit_int64(jr->ClientId,ed3)); -#endif } else { Mmsg(mdb->cmd, "SELECT FileId, LStat, MD5 FROM File WHERE File.JobId=%s AND File.PathId=%s AND " @@ -801,15 +790,9 @@ int db_get_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr) "WHERE FileSetId=%s", edit_int64(fsr->FileSetId, ed1)); } else { /* find by name */ -#if HAVE_INGRES - Mmsg(mdb->cmd, - "SELECT FileSetId,FileSet,MD5,CreateTime FROM FileSet " - "WHERE FileSet='%s' ORDER BY CreateTime DESC FETCH FIRST 1 ROW ONLY", fsr->FileSet); -#else Mmsg(mdb->cmd, "SELECT FileSetId,FileSet,MD5,CreateTime FROM FileSet " "WHERE FileSet='%s' ORDER BY CreateTime DESC LIMIT 1", fsr->FileSet); -#endif } if (QUERY_DB(jcr, mdb, mdb->cmd)) { @@ -1180,21 +1163,6 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, jobids->count = 0; /* First, find the last good Full backup for this job/client/fileset */ -#if HAVE_INGRES - Mmsg(query, -"CREATE TABLE btemp3%s AS " - "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " - "FROM Job JOIN FileSet USING (FileSetId) " - "WHERE ClientId = %s " - "AND Level='F' AND JobStatus IN ('T','W') AND Type='B' " - "AND StartTime<'%s' " - "AND FileSet.FileSet=(SELECT FileSet FROM FileSet WHERE FileSetId = %s) " - "ORDER BY Job.JobTDate DESC FETCH FIRST 1 ROW ONLY", - edit_uint64(jcr->JobId, jobid), - edit_uint64(jr->ClientId, clientid), - date, - edit_uint64(jr->FileSetId, filesetid)); -#else Mmsg(query, "CREATE TABLE btemp3%s AS " "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " @@ -1208,7 +1176,6 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, edit_uint64(jr->ClientId, clientid), date, edit_uint64(jr->FileSetId, filesetid)); -#endif if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) { goto bail_out; @@ -1216,23 +1183,6 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, if (jr->JobLevel == L_INCREMENTAL || jr->JobLevel == L_VIRTUAL_FULL) { /* Now, find the last differential backup after the last full */ -#if HAVE_INGRES - Mmsg(query, -"INSERT INTO btemp3%s (JobId, StartTime, EndTime, JobTDate, PurgedFiles) " - "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " - "FROM Job JOIN FileSet USING (FileSetId) " - "WHERE ClientId = %s " - "AND Level='D' AND JobStatus IN ('T','W') AND Type='B' " - "AND StartTime > (SELECT EndTime FROM btemp3%s ORDER BY EndTime DESC LIMIT 1) " - "AND StartTime < '%s' " - "AND FileSet.FileSet= (SELECT FileSet FROM FileSet WHERE FileSetId = %s) " - "ORDER BY Job.JobTDate DESC FETCH FIRST 1 ROW ONLY ", - jobid, - clientid, - jobid, - date, - filesetid); -#else Mmsg(query, "INSERT INTO btemp3%s (JobId, StartTime, EndTime, JobTDate, PurgedFiles) " "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " @@ -1248,30 +1198,12 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, jobid, date, filesetid); -#endif if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) { goto bail_out; } /* We just have to take all incremental after the last Full/Diff */ -#if HAVE_INGRES - Mmsg(query, -"INSERT INTO btemp3%s (JobId, StartTime, EndTime, JobTDate, PurgedFiles) " - "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " - "FROM Job JOIN FileSet USING (FileSetId) " - "WHERE ClientId = %s " - "AND Level='I' AND JobStatus IN ('T','W') AND Type='B' " - "AND StartTime > (SELECT EndTime FROM btemp3%s ORDER BY EndTime DESC FETCH FIRST 1 ROW ONLY) " - "AND StartTime < '%s' " - "AND FileSet.FileSet= (SELECT FileSet FROM FileSet WHERE FileSetId = %s) " - "ORDER BY Job.JobTDate DESC ", - jobid, - clientid, - jobid, - date, - filesetid); -#else Mmsg(query, "INSERT INTO btemp3%s (JobId, StartTime, EndTime, JobTDate, PurgedFiles) " "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " @@ -1287,7 +1219,6 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, jobid, date, filesetid); -#endif if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) { goto bail_out; } @@ -1344,10 +1275,6 @@ bool db_get_base_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr, JobId_t *jobid) // "AND FileSet.FileSet= '%s' " // "AND Client.Name = '%s' " "AND StartTime<'%s' " -#if HAVE_INGRES -#else - "ORDER BY Job.JobTDate DESC FETCH FIRST 1 ROW ONLY", -#endif "ORDER BY Job.JobTDate DESC LIMIT 1", jr->Name, // edit_uint64(jr->ClientId, clientid), diff --git a/bacula/src/cats/sql_list.c b/bacula/src/cats/sql_list.c index 4942ca7940..aa903a0ca0 100644 --- a/bacula/src/cats/sql_list.c +++ b/bacula/src/cats/sql_list.c @@ -249,11 +249,7 @@ void db_list_copies_records(JCR *jcr, B_DB *mdb, uint32_t limit, char *JobIds, POOL_MEM str_jobids(PM_MESSAGE); if (limit > 0) { -#if HAVE_INGRES - Mmsg(str_limit, " FETCH FIRST %d ROWS ONLY", limit); -#else Mmsg(str_limit, " LIMIT %d", limit); -#endif } if (JobIds && JobIds[0]) { @@ -334,11 +330,7 @@ db_list_job_records(JCR *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, char limit[100]; db_lock(mdb); if (jr->limit > 0) { -#if HAVE_INGRES - snprintf(limit, sizeof(limit), " FETCH FIRST %d ROWS ONLY", jr->limit); -#else snprintf(limit, sizeof(limit), " LIMIT %d", jr->limit); -#endif } else { limit[0] = 0; }