Added some debug info
authorarjen <arjen>
Thu, 24 Mar 2011 10:20:37 +0000 (10:20 +0000)
committerarjen <arjen>
Thu, 24 Mar 2011 10:20:37 +0000 (10:20 +0000)
src/gcm_input/gcm_input.cpp
src/gcm_input/message.cpp

index 4717f22..526a7ce 100644 (file)
@@ -7,7 +7,7 @@
 ***********************
 **      FILE NAME      : gcm_input.cpp
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.15 $
+**      VERSION NUMBER : $Revision: 1.16 $
 **
 **  DESCRIPTION      :  Application to store client messages into the database
 **                      The client message contains a log file from one of the
 
 /*****************************
    $Log: gcm_input.cpp,v $
-   Revision 1.15  2007-11-14 16:19:25  arjen
+   Revision 1.16  2011-03-24 10:20:37  arjen
+   Added some debug info
+
+   Revision 1.15  2007/11/14 16:19:25  arjen
    Bugfix: Segmentation fault when reading an rpm package list
    with empty lines.
 
 
 *****************************/
 
-static const char *RCSID = "$Id: gcm_input.cpp,v 1.15 2007-11-14 16:19:25 arjen Exp $";
+static const char *RCSID = "$Id: gcm_input.cpp,v 1.16 2011-03-24 10:20:37 arjen Exp $";
 
 #include <fstream>
 
index ce006fc..185fa0e 100644 (file)
@@ -8,7 +8,7 @@
 ***********************
 **      FILE NAME      : message.cpp
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.18 $
+**      VERSION NUMBER : $Revision: 1.19 $
 **
 **  DESCRIPTION      :  Implementation of the message handling classes
 **
 
 /*****************************
    $Log: message.cpp,v $
-   Revision 1.18  2007-11-03 10:23:53  arjen
+   Revision 1.19  2011-03-24 10:20:37  arjen
+   Added some debug info
+
+   Revision 1.18  2007/11/03 10:23:53  arjen
    Handling of parameters is greatly improved.
    When creating a new parameter from an XML report which is fed into
    gcm_input, the class definition is used as a template to fill in
 
 *****************************/
 
-static const char *RCSID = "$Id: message.cpp,v 1.18 2007-11-03 10:23:53 arjen Exp $";
+static const char *RCSID = "$Id: message.cpp,v 1.19 2011-03-24 10:20:37 arjen Exp $";
 
 #include <algorithm>
 #include <libxml/xpath.h>
@@ -990,22 +993,35 @@ void client_message::enterXML()
          {
             //  Check if any parameters in this class have disappeared.
 
+#ifdef DEBUG
+            *Log << "Checking for disappeared parameters.\n";
+#endif
             qry = "select name, paramid from parameter where objectid='";
             qry += objectid + "' and class='" + param_class + "'";
 
             int          nr_parameters = database.Query(qry);
-            pqxx::Result parameter_set = database.Result();
+            pqxx::result parameter_set = database.Result();
 
+#ifdef DEBUG
+            *Log << nr_parameters << " parameters of class " << param_class << " found in the database.\n";
+#endif
             for (int i = 0; i < nr_parameters; i++)
             {
                String XPath;
                String param_name, paramid;
 
                param_name = database.Field(parameter_set, i, "name");
+#ifdef DEBUG
+               *Log << "Looking for " << param_name << " in XML tree.\n";
+#endif
                XPath = "gcmt:parameter[@name='" + param_name + "']";
 
                res = xmlXPathEval((const xmlChar *)(const char *)XPath, pathcontext);
-               if (res->nodesetval->nodeTab == NULL)
+#ifdef DEBUG
+               *Log << "XPATH result: " << res->type << ".\n";
+               *Log << "Nr of nodes found: " << res->nodesetval->nodeNr << ".\n";
+#endif
+               if (res->nodesetval->nodeNr == 0)
                {
                   // The parameter is in the database but not in the report
 
@@ -1057,6 +1073,12 @@ void client_message::enterXML()
                      }
                   }
                }
+               else
+               {
+#ifdef DEBUG
+                  *Log << XPath << " was found in XML tree.\n";
+#endif
+               }
             }
          }
       }