Corecting minor errors in SQL query generation.
authorZdeněk Šustr <sustr4@cesnet.cz>
Tue, 18 Dec 2007 15:01:47 +0000 (15:01 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Tue, 18 Dec 2007 15:01:47 +0000 (15:01 +0000)
org.glite.lb.common/src/query_rec.c
org.glite.lb.server/src/query.c

index 9317f73..8e52b92 100644 (file)
@@ -27,6 +27,7 @@ void edg_wll_QueryRecFree(edg_wll_QueryRec *prec)
                case EDG_WLL_QUERY_ATTR_DESTINATION:
                case EDG_WLL_QUERY_ATTR_HOST:
                case EDG_WLL_QUERY_ATTR_INSTANCE:
+               case EDG_WLL_QUERY_ATTR_JDL_ATTR:
                        if ( prec->value.c ) free(prec->value.c);
                        break;
                case EDG_WLL_QUERY_ATTR_JOBID:
@@ -40,6 +41,8 @@ void edg_wll_QueryRecFree(edg_wll_QueryRec *prec)
                case EDG_WLL_QUERY_ATTR_EVENT_TYPE:
                case EDG_WLL_QUERY_ATTR_RESUBMITTED:
                case EDG_WLL_QUERY_ATTR_TIME:
+               case EDG_WLL_QUERY_ATTR_STATEENTERTIME:
+               case EDG_WLL_QUERY_ATTR_LASTUPDATETIME:
                        /* do nothing */
                        break;
                default:
index 9faf04d..0fde3a1 100644 (file)
@@ -344,15 +344,16 @@ int edg_wll_QueryJobsServer(
 
        if ( (where_flags & FL_SEL_STATUS) )
                trio_asprintf(&qbase,"SELECT DISTINCT j.dg_jobid,j.userid "
-                                                "FROM jobs j, states s WHERE j.jobid=s.jobid %s %s AND %s", 
+                                                "FROM jobs j, states s WHERE j.jobid=s.jobid %s %s %s %s", 
                                                (job_where) ? "AND" : "",
                                                (job_where) ? job_where : "",
+                                               (job_where) ? "AND" : "",
                                                (ctx->isProxy) ? "j.proxy='1'" : "j.server='1'");
        else
                trio_asprintf(&qbase,"SELECT DISTINCT j.dg_jobid,j.userid "
-                                                "FROM jobs j %s %s AND %s", 
-                                               (job_where) ? "WHERE" : "",
+                                                "FROM jobs j WHERE %s %s %s", 
                                                (job_where) ? job_where : "",
+                                               (job_where) ? "AND" : "",
                                                (ctx->isProxy) ? "j.proxy='1'" : "j.server='1'");
 
        if ( ctx->softLimit )
@@ -904,6 +905,7 @@ static char *jc_to_head_where(
                        break;
 
                case EDG_WLL_QUERY_ATTR_TIME:
+               case EDG_WLL_QUERY_ATTR_STATEENTERTIME:
                        if ( jc[m][n].attr_id.state == EDG_WLL_JOB_UNDEF )
                        {
                                edg_wll_SetError(ctx, EINVAL, "Time attribut have to be associated with status specification");
@@ -914,7 +916,6 @@ static char *jc_to_head_where(
                case EDG_WLL_QUERY_ATTR_DONECODE:
                case EDG_WLL_QUERY_ATTR_EXITCODE:
                case EDG_WLL_QUERY_ATTR_STATUS:
-               case EDG_WLL_QUERY_ATTR_STATEENTERTIME:
                case EDG_WLL_QUERY_ATTR_LASTUPDATETIME:
                        ct++;
                        break;