From f4007f6470ec677a0d2e25ed0203dfb8f4322a3f Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Tue, 21 Aug 2007 02:09:38 +0000 Subject: [PATCH] After making minor changes to a patch that Eric B sent to me. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5386 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/jobgraphs/jobplot.cpp | 14 ++++++++------ bacula/src/qt-console/joblist/joblist.cpp | 13 +++++++------ bacula/src/qt-console/mediaedit/mediaedit.cpp | 5 ++--- bacula/src/qt-console/medialist/medialist.cpp | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/bacula/src/qt-console/jobgraphs/jobplot.cpp b/bacula/src/qt-console/jobgraphs/jobplot.cpp index 4dc0189a85..2dc2493f6b 100644 --- a/bacula/src/qt-console/jobgraphs/jobplot.cpp +++ b/bacula/src/qt-console/jobgraphs/jobplot.cpp @@ -220,11 +220,10 @@ void JobPlot::runQuery() " Job.JobBytes AS Bytes," " Job.JobId AS JobId" " FROM Job" - " LEFT OUTER JOIN Client ON (Client.ClientId=Job.ClientId)" - " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId)" - " LEFT OUTER JOIN Status ON (Job.JobStatus=Status.JobStatus)" - " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId)" - " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId)"; + " JOIN Client ON (Client.ClientId=Job.ClientId)" + " JOIN Status ON (Job.JobStatus=Status.JobStatus)" + " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId)"; + QStringList conditions; int jobIndex = controls->jobComboBox->currentIndex(); if ((jobIndex != -1) && (controls->jobComboBox->itemText(jobIndex) != "Any")) @@ -233,8 +232,11 @@ void JobPlot::runQuery() if ((clientIndex != -1) && (controls->clientComboBox->itemText(clientIndex) != "Any")) conditions.append("Client.Name='" + controls->clientComboBox->itemText(clientIndex) + "'"); int volumeIndex = controls->volumeComboBox->currentIndex(); - if ((volumeIndex != -1) && (controls->volumeComboBox->itemText(volumeIndex) != "Any")) + if ((volumeIndex != -1) && (controls->volumeComboBox->itemText(volumeIndex) != "Any")) { + query += " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId)" + " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId)"; conditions.append("Media.VolumeName='" + controls->volumeComboBox->itemText(volumeIndex) + "'"); + } int fileSetIndex = controls->fileSetComboBox->currentIndex(); if ((fileSetIndex != -1) && (controls->fileSetComboBox->itemText(fileSetIndex) != "Any")) conditions.append("FileSet.FileSet='" + controls->fileSetComboBox->itemText(fileSetIndex) + "'"); diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index fcfe902502..67727c5201 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -154,20 +154,21 @@ void JobList::populateTable() int volumeIndex = volumeComboBox->currentIndex(); if (volumeIndex != -1) m_mediaName = volumeComboBox->itemText(volumeIndex); - query += "SELECT DISTINCT Job.Jobid AS Id, Job.Name AS JobName, Client.Name AS Client," + query += "SELECT Job.Jobid AS Id, Job.Name AS JobName, " + " Client.Name AS Client," " Job.Starttime AS JobStart, Job.Type AS JobType," " Job.Level AS BackupLevel, Job.Jobfiles AS FileCount," " Job.JobBytes AS Bytes," " Job.JobStatus AS Status, Status.JobStatusLong AS StatusLong," " Job.PurgedFiles AS Purged, FileSet.FileSet" " FROM Job" - " LEFT OUTER JOIN Client ON (Client.ClientId=Job.ClientId)" - " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId)" - " LEFT OUTER JOIN Status ON (Job.JobStatus=Status.JobStatus)" - " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId)" - " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId)"; + " JOIN Client ON (Client.ClientId=Job.ClientId)" + " JOIN Status ON (Job.JobStatus=Status.JobStatus)" + " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId) "; QStringList conditions; if (m_mediaName != "Any") { + query += " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId) " + " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId) "; conditions.append("Media.VolumeName='" + m_mediaName + "'"); } int clientIndex = clientComboBox->currentIndex(); diff --git a/bacula/src/qt-console/mediaedit/mediaedit.cpp b/bacula/src/qt-console/mediaedit/mediaedit.cpp index 29c928bc0c..7bd6107015 100644 --- a/bacula/src/qt-console/mediaedit/mediaedit.cpp +++ b/bacula/src/qt-console/mediaedit/mediaedit.cpp @@ -96,10 +96,9 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) i += 1; } query += " FROM Media" - " LEFT OUTER JOIN Pool ON (Media.PoolId=Pool.PoolId)" + " JOIN Pool ON (Media.PoolId=Pool.PoolId)" " LEFT OUTER JOIN Pool AS Pol ON (Media.recyclepoolid=Pol.PoolId)" - " WHERE Media.MediaId='" + mediaId + "'" - " ORDER BY Pool.Name"; + " WHERE Media.MediaId='" + mediaId + "'"; if (mainWin->m_sqlDebug) { Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data()); diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index e9ef0a981d..6cda1e5a1b 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -114,7 +114,7 @@ void MediaList::populateTree() " Media.Enabled AS enabled, Pol.Name AS RecyclePool," " Media.LastWritten AS LastWritten" " FROM Media" - " LEFT OUTER JOIN Pool ON (Media.PoolId=Pool.PoolId)" + " JOIN Pool ON (Media.PoolId=Pool.PoolId)" " LEFT OUTER JOIN Pool AS Pol ON (Media.RecyclePoolId=Pol.PoolId)" " WHERE"; query += " Pool.Name='" + pool_listItem + "'"; -- 2.39.5