fixed bug #7910 -- datetime formatting (tripple apostrophes)
authorJiří Škrábal <nykolas@ics.muni.cz>
Fri, 22 Apr 2005 10:06:25 +0000 (10:06 +0000)
committerJiří Škrábal <nykolas@ics.muni.cz>
Fri, 22 Apr 2005 10:06:25 +0000 (10:06 +0000)
org.glite.lb.server/src/dump.c
org.glite.lb.server/src/notification.c
org.glite.lb.server/src/server_state.c
org.glite.lb.server/src/store.c.T

index 67ae95b..afe262a 100644 (file)
@@ -64,7 +64,7 @@ int edg_wll_DumpEvents(edg_wll_Context ctx,const edg_wll_DumpRequest *req,edg_wl
                        "where u.userid=e.userid "
                        "and j.jobid = e.jobid "
                        "and j.dg_jobid like 'https://%|Ss:%d%%' "
-                       "and arrived > '%|Ss' and arrived <= '%|Ss' "
+                       "and arrived > %s and arrived <= %s "
                        "order by arrived",
                        ctx->srvName,ctx->srvPort,
                        from_s,to_s);
@@ -130,15 +130,12 @@ int edg_wll_DumpEvents(edg_wll_Context ctx,const edg_wll_DumpRequest *req,edg_wl
        }
 
        time(&end);
-/* XXX: get rid of apostrophes returned by edg_wll_TimeToDB() */
        time_s = strdup(edg_wll_TimeToDB(start));
-       time_s[strlen(time_s)-1] = 0;
-       edg_wll_SetServerState(ctx,EDG_WLL_STATE_DUMP_START,time_s+1);
+       edg_wll_SetServerState(ctx,EDG_WLL_STATE_DUMP_START,time_s);
        free(time_s);
        
        time_s = strdup(edg_wll_TimeToDB(end));
-       time_s[strlen(time_s)-1] = 0;
-       edg_wll_SetServerState(ctx,EDG_WLL_STATE_DUMP_END,time_s+1);
+       edg_wll_SetServerState(ctx,EDG_WLL_STATE_DUMP_END,time_s);
        free(time_s);
 
        result->from = from;
index f97860b..3b6243c 100644 (file)
@@ -84,7 +84,6 @@ int edg_wll_NotifNewServer(
                edg_wll_SetError(ctx, errno, NULL);
                goto cleanup;
        }
-       time_s[strlen(time_s)-1] = 0;
 
        /*      Format the address
         */
@@ -105,8 +104,8 @@ int edg_wll_NotifNewServer(
         */
        trio_asprintf(&q,
                                "insert into notif_registrations(notifid,destination,valid,userid,conditions) "
-                               "values ('%|Ss','%|Ss','%|Ss','%|Ss', '<and>%|Ss</and>')",
-                               nid_s, addr_s? addr_s: address_override, time_s+1, owner, xml_conds);
+                               "values ('%|Ss','%|Ss',%s,'%|Ss', '<and>%|Ss</and>')",
+                               nid_s, addr_s? addr_s: address_override, time_s, owner, xml_conds);
 
        if ( edg_wll_ExecStmt(ctx, q, NULL) < 0 )
                goto cleanup;
@@ -191,7 +190,6 @@ int edg_wll_NotifBindServer(
                edg_wll_SetError(ctx, errno, "Formating validity time");
                goto cleanup;
        }
-       time_s[strlen(time_s)-1] = 0;
 
        /*      Format the address
         */
@@ -209,7 +207,7 @@ int edg_wll_NotifBindServer(
        }
 
 
-       update_notif(ctx, nid, NULL, addr_s? addr_s: address_override, (const char *)(time_s+1));
+       update_notif(ctx, nid, NULL, addr_s? addr_s: address_override, (const char *)(time_s));
 
 cleanup:
        if ( time_s ) free(time_s);
@@ -347,9 +345,8 @@ int edg_wll_NotifRefreshServer(
                edg_wll_SetError(ctx, errno, "Formating validity time");
                goto cleanup;
        }
-       time_s[strlen(time_s)-1] = 0;
 
-       update_notif(ctx, nid, NULL, NULL, time_s+1);
+       update_notif(ctx, nid, NULL, NULL, time_s);
 
 cleanup:
        if ( time_s ) free(time_s);
@@ -604,7 +601,7 @@ static int update_notif(
        }
        if ( valid )
        {
-               trio_asprintf(&aux, "%s %svalid='%|Ss'", stmt, dest? ",": "", valid);
+               trio_asprintf(&aux, "%s %svalid=%s", stmt, dest? ",": "", valid);
                free(stmt);
                stmt = aux;
        }
index d2bf8f0..80a1316 100644 (file)
@@ -32,7 +32,7 @@ int edg_wll_SetServerState(edg_wll_Context ctx,const char *name,const char *val)
        char    *stmt = NULL;
 
        trio_asprintf(&stmt,"insert into server_state (prefix,name,value) "
-                       "values ('https://%|Ss:%d','%|Ss','%|Ss')",
+                       "values ('https://%|Ss:%d','%|Ss',%s)",
                        ctx->srvName,ctx->srvPort,name,val);
 
        switch(edg_wll_ExecStmt(ctx,stmt,NULL)) {
index 47a894f..d45db39 100644 (file)
@@ -109,7 +109,7 @@ int edg_wll_StoreEvent(edg_wll_Context ctx,edg_wll_Event *e,int *seq)
         * with readers */
                trio_asprintf(&stmt,
                        "insert into events(jobid,event,code,prog,host,time_stamp,usec,arrived,level,userid) "
-                       "values ('%|Ss',%d,%d,'%|Ss','%|Ss',%s,%d,'%|Ss',%d,'%|Ss')",
+                       "values ('%|Ss',%d,%d,'%|Ss','%|Ss',%s,%d,%s,%d,'%|Ss')",
                        jobid,next,EDG_WLL_EVENT_UNDEF,ssrc,e->any.host,
                        edg_wll_TimeToDB(e->any.timestamp.tv_sec),e->any.timestamp.tv_usec,
                        now_s, e->any.level,userid);