From: Eric Bollengier Date: Tue, 20 Oct 2009 18:57:22 +0000 (+0000) Subject: Permit to use MediaId or VolumeName in MediaEdit panel X-Git-Tag: Release-5.0.0~282^2~11^2^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=80c810e2937f2cb6083d467330dbf1590bd5aee8;p=bacula%2Fbacula Permit to use MediaId or VolumeName in MediaEdit panel --- 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());