Fixed enclosing of attribute values in apostrophes.
authorZdeněk Šustr <sustr4@cesnet.cz>
Wed, 12 Mar 2008 15:12:09 +0000 (15:12 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Wed, 12 Mar 2008 15:12:09 +0000 (15:12 +0000)
org.glite.lb.server/src/index.c.T
org.glite.lb.server/src/notif_match.c

index 5b68b81..72246e3 100644 (file)
@@ -204,6 +204,7 @@ char *edg_wll_JDLStatToSQL(edg_wll_JobStat const *stat,edg_wll_QueryRec col_rec)
 {
         struct cclassad *ad = NULL;
         char *extr_val = NULL;
+       char *extr_val_apostrophed = NULL;
 
         ad = cclassad_create(stat->jdl);
         if (ad) {
@@ -213,8 +214,13 @@ char *edg_wll_JDLStatToSQL(edg_wll_JobStat const *stat,edg_wll_QueryRec col_rec)
                 }
         }
 
-        //return extr_val ? extr_val : (char *) -1;
-        return extr_val;
+       if (extr_val) {
+               //XXX: To do this properly, it mayrequire some escaping
+               asprintf(&extr_val_apostrophed,"'%s'", extr_val);
+               free(extr_val);
+       }
+
+        return extr_val_apostrophed;
 }
 
 int edg_wll_ColumnToQueryRec(const char *col_name,edg_wll_QueryRec *rec)
index 7bd7e50..a820c1a 100644 (file)
@@ -54,7 +54,7 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *stat)
                        if (val) {
                                char    *aux;
                                if (!cond_where) cond_where = strdup("");
-                               trio_asprintf(&aux, "%s or %s = '%s'",cond_where,
+                               trio_asprintf(&aux, "%s or %s = %s",cond_where,
                                                notif_index_cols[i].colname,val);
                                free(cond_where);
                                cond_where = aux;