From 6e01f56e9b94be9d704866d211b98c6da66e7628 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20=C5=A0kr=C3=A1bal?= Date: Fri, 22 Apr 2005 10:06:25 +0000 Subject: [PATCH] fixed bug #7910 -- datetime formatting (tripple apostrophes) --- org.glite.lb.server/src/dump.c | 9 +++------ org.glite.lb.server/src/notification.c | 13 +++++-------- org.glite.lb.server/src/server_state.c | 2 +- org.glite.lb.server/src/store.c.T | 2 +- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/org.glite.lb.server/src/dump.c b/org.glite.lb.server/src/dump.c index 67ae95b..afe262a 100644 --- a/org.glite.lb.server/src/dump.c +++ b/org.glite.lb.server/src/dump.c @@ -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; diff --git a/org.glite.lb.server/src/notification.c b/org.glite.lb.server/src/notification.c index f97860b..3b6243c 100644 --- a/org.glite.lb.server/src/notification.c +++ b/org.glite.lb.server/src/notification.c @@ -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', '%|Ss')", - nid_s, addr_s? addr_s: address_override, time_s+1, owner, xml_conds); + "values ('%|Ss','%|Ss',%s,'%|Ss', '%|Ss')", + 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; } diff --git a/org.glite.lb.server/src/server_state.c b/org.glite.lb.server/src/server_state.c index d2bf8f0..80a1316 100644 --- a/org.glite.lb.server/src/server_state.c +++ b/org.glite.lb.server/src/server_state.c @@ -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)) { diff --git a/org.glite.lb.server/src/store.c.T b/org.glite.lb.server/src/store.c.T index 47a894f..d45db39 100644 --- a/org.glite.lb.server/src/store.c.T +++ b/org.glite.lb.server/src/store.c.T @@ -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); -- 1.8.2.3