fixes in query implementation, not working yet
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 27 Sep 2005 14:12:12 +0000 (14:12 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 27 Sep 2005 14:12:12 +0000 (14:12 +0000)
org.glite.jp.primary/examples/README.test
org.glite.jp.primary/examples/jpps-test.c
org.glite.jp.primary/src/feed.c
org.glite.jp.primary/src/new_ftp_backend.c

index 8568f04..8997ff7 100644 (file)
@@ -75,3 +75,20 @@ OK - repeated startupload
 XX - get uncommitted file
 XX - get file with different credentials
 XX - upload again comitted file
+
+
+
+
+
+Register feed
+
+$ jpps-test FeedIndex
+
+registers predefined feed, seen in database (table feeds), slaves should
+restart
+
+
+
+Batch feed
+
+$ jpps-test FeedIndex yes
index 23bc8ad..79f31fb 100644 (file)
@@ -32,7 +32,7 @@ static void usage(const char *me)
                        "               RecordTag jobid tagname stringvalue\n"
                        "               GetJobFiles jobid\n"
                        "               GetJobAttr jobid attr\n"
-                       "               FeedIndex \n"
+                       "               FeedIndex [yes (history)]\n"
                        "               FeedIndexRefresh feedid\n"
                ,me);
 
@@ -217,6 +217,8 @@ int main(int argc,char *argv[])
                };
                struct _jpelem__FeedIndexResponse       out;
 
+               in.history = argc >= 3 && !strcasecmp(argv[2],"yes");
+
                if (!check_fault(soap,soap_call___jpsrv__FeedIndex(soap,server,"",&in,&out)))
                {
                        printf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.feedExpires));
index b4bf9dd..079ab37 100644 (file)
@@ -352,8 +352,34 @@ static struct jpfeed *make_jpfeed(
 
 void jpfeed_free(struct jpfeed *f)
 {
-       /* TODO */
-       abort();
+       int     i;
+
+       assert(f->njobs == 0); /* XXX: we shouldn't do this */
+
+       free(f->id);
+       free(f->destination);
+       if (f->attrs) {
+               for (i=0; f->attrs[i]; i++) free(f->attrs[i]);
+               free(f->attrs);
+       }
+       for (i=0; i<f->nmeta_attr; i++) free(f->meta_attr[i]);
+       free(f->meta_attr);
+       for (i=0; i<f->nother_attr; i++) free(f->other_attr[i]);
+       free(f->other_attr);
+
+       if (f->qry) {
+               for (i=0; f->qry[i].attr; i++) glite_jp_free_query_rec(f->qry+i);
+               free(f->qry);
+       }
+
+       for (i=0; i<f->nmeta_qry; i++) glite_jp_free_query_rec(f->meta_qry+i);
+       free(f->meta_qry);
+       for (i=0; i<f->nother_qry; i++) glite_jp_free_query_rec(f->other_qry+i);
+       free(f->other_qry);
+
+       /* XXX: no next */
+
+       free(f);
 }
 
 static int drain_feed(glite_jp_context_t ctx, struct jpfeed *f)
@@ -443,7 +469,7 @@ static int run_feed_deferred(glite_jp_context_t ctx,void *feed)
        glite_jp_clear_error(ctx);
 /* count "meta" attributes */
        cnt = 0;
-       for (i=0; f->attrs[i]; f++)
+       for (i=0; f->attrs[i]; i++)
                if (glite_jppsbe_is_metadata(ctx,f->attrs[i])) cnt++;
 
        f->meta_attr = cnt ? malloc((cnt+1) * sizeof *f->meta_attr) : NULL;
index eb68804..ff6d315 100644 (file)
@@ -1867,10 +1867,11 @@ int glite_jppsbe_query(
                case 3: cols = "j.dg_jobid,u.cert_subj,j.reg_time"; break;
        }
        
-       trio_asprintf(stmt,"select %s from jobs j%s where %s",
+       trio_asprintf(&stmt,"select %s from jobs j%s where %s %s",
                        cols,
-                       quser ? ",u.users" : "",
-                       where);
+                       quser ? ",users u" : "",
+                       where,
+                       cmask & 1 ? "and u.userid = j.owner" : "");
 
        if (glite_jp_db_execstmt(ctx,stmt,&q) <= 0) {
                err.code = EIO;