Do not add another parameter_notification record is the notification
authorarjen <arjen>
Mon, 27 Oct 2003 11:28:27 +0000 (11:28 +0000)
committerarjen <arjen>
Mon, 27 Oct 2003 11:28:27 +0000 (11:28 +0000)
already exists for that parameter.

src/gcm_input/message.cpp

index 596aba5..1c36a27 100644 (file)
@@ -8,7 +8,7 @@
 ***********************
 **      FILE NAME      : message.cpp
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.14 $
+**      VERSION NUMBER : $Revision: 1.15 $
 **
 **  DESCRIPTION      :  Implementation of the message handling classes
 **
 
 /*****************************
    $Log: message.cpp,v $
-   Revision 1.14  2003-09-01 06:57:14  arjen
+   Revision 1.15  2003-10-27 11:28:27  arjen
+   Do not add another parameter_notification record is the notification
+   already exists for that parameter.
+
+   Revision 1.14  2003/09/01 06:57:14  arjen
    Reject log entries that are found to be invalid.
 
    Revision 1.13  2003/08/16 15:28:45  arjen
@@ -86,7 +90,7 @@
 
 *****************************/
 
-static const char *RCSID = "$Id: message.cpp,v 1.14 2003-09-01 06:57:14 arjen Exp $";
+static const char *RCSID = "$Id: message.cpp,v 1.15 2003-10-27 11:28:27 arjen Exp $";
 
 #include <algorithm>
 #include <libxml/xpath.h>
@@ -936,15 +940,23 @@ int client_message::enter()
                   {
                      remark = "Gnucomo detected a different version for package parameter(s) ";
                      change_notification = database.new_notification(objectid, "property modified", remark);
+                     change_notification = database.new_notification(objectid, "property modified", remark);
                   }
 
                   if (change_notification != "")
                   {
-                     insertion = "insert into parameter_notification (notificationid, paramid) values ('";
-                     insertion += change_notification + "', '";
-                     insertion += paramid + "')";
+                     qry = "select * from parameter_notification where notificationid='";
+                     qry += change_notification + "' and paramid='";
+                     qry += paramid + "'";
 
-                     database.Query(insertion);
+                     if (database.Query(qry) == 0)
+                     {
+                        insertion = "insert into parameter_notification (notificationid, paramid) values ('";
+                        insertion += change_notification + "', '";
+                        insertion += paramid + "')";
+
+                        database.Query(insertion);
+                     }
                   }
                   else
                   {