- set auto-reconnect explicitely (necessary for 5.x servers)
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 24 Aug 2007 12:38:36 +0000 (12:38 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 24 Aug 2007 12:38:36 +0000 (12:38 +0000)
- extend example for storing multiple tags

org.glite.jp.primary/examples/jpps-test.c
org.glite.jp.primary/src/mysql.c

index c03df55..1af5271 100644 (file)
@@ -31,7 +31,7 @@ static void usage(const char *me)
                        "               RegisterJob jobid owner\n"
                        "               StartUpload jobid class commit_before mimetype\n"
                        "               CommitUpload destination\n"
-                       "               RecordTag jobid tagname stringvalue\n"
+                       "               RecordTag jobid tagname stringvalue ...\n"
                        "               GetJobFiles jobid\n"
                        "               GetJobAttr jobid attr\n"
                        "               FeedIndex [yes (history)]\n"
@@ -138,21 +138,24 @@ int main(int argc,char *argv[])
                struct _jpelem__RecordTagResponse       empty;
                struct jptype__tagValue tagval;
                struct jptype__stringOrBlob     val;
-               
-               int seq = 0;
+               int idx;
        
-               if (argc != 5) usage(argv[0]);
-               
+               if (argc < 5 && argc % 2 == 0) usage(argv[0]);
+
                in.jobid = argv[2];
                in.tag = &tagval;
-               tagval.name = argv[3];
                tagval.value = &val;
-               memset(&val, 0, sizeof(val));
-               GSOAP_SETSTRING(&val, argv[4]);
                
-               if (!(ret = check_fault(soap,
-                               soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty)))) {
-                       /* OK */
+               for  (idx = 3; idx < argc; idx += 2) {
+                       tagval.name = argv[idx];
+                       memset(&val, 0, sizeof(val));
+                       GSOAP_SETSTRING(&val, argv[idx+1]);
+                       
+                       printf("%s ... ",tagval.name);
+                       if (!(ret = check_fault(soap,
+                                       soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty)))) {
+                               /* OK */
+                       }
                }
        } 
         else if (!strcasecmp(argv[1],"FeedIndex")) {
index c74e063..b798352 100644 (file)
@@ -42,6 +42,7 @@ int glite_jp_db_connect(glite_jp_context_t ctx,char *cs)
        char    *buf = NULL;
        char    *host,*user,*pw,*db; 
        char    *slash,*at,*colon;
+       my_bool reconnect = 1;
 
        glite_jp_error_t err;
 
@@ -57,6 +58,7 @@ int glite_jp_db_connect(glite_jp_context_t ctx,char *cs)
        }
 
        mysql_options(ctx->dbhandle, MYSQL_READ_DEFAULT_FILE, "my");
+       mysql_options(ctx->dbhandle, MYSQL_OPT_RECONNECT, &reconnect);
 
        host = user = pw = db = NULL;