From 80c810e2937f2cb6083d467330dbf1590bd5aee8 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 20 Oct 2009 18:57:22 +0000 Subject: [PATCH] Permit to use MediaId or VolumeName in MediaEdit panel --- bacula/src/qt-console/mediaedit/mediaedit.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bacula/src/qt-console/mediaedit/mediaedit.cpp b/bacula/src/qt-console/mediaedit/mediaedit.cpp index a31ae97811..f38ae472d0 100644 --- a/bacula/src/qt-console/mediaedit/mediaedit.cpp +++ b/bacula/src/qt-console/mediaedit/mediaedit.cpp @@ -91,10 +91,15 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) query += field + " AS " + AsList[i]; i += 1; } + + QString where = " WHERE Media.VolumeName = '" + mediaId + "' "; + if (mediaId.contains(QRegExp("^[0-9]+$"))) { + where = " WHERE Media.MediaId=" + mediaId; + } query += " FROM Media" " JOIN Pool ON (Media.PoolId=Pool.PoolId)" " LEFT OUTER JOIN Pool AS Pol ON (Media.RecyclePoolId=Pol.PoolId)" - " WHERE Media.MediaId='" + mediaId + "'"; + + where; if (mainWin->m_sqlDebug) { Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data()); -- 2.39.5