From a4ed084c5b5008f4957fe232284245a1940a8d84 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Thu, 14 Apr 2005 14:42:14 +0000 Subject: [PATCH] fixed bug #7910 -- datetime formatting (tripple apostrophes) --- org.glite.lb.server/project/version.properties | 4 ++-- org.glite.lb.server/src/dump.c | 9 +++------ org.glite.lb.server/src/notification.c | 13 +++++-------- org.glite.lb.server/src/server_state.c | 4 ++-- org.glite.lb.server/src/store.c.T | 2 +- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/org.glite.lb.server/project/version.properties b/org.glite.lb.server/project/version.properties index 34be4df..54d6b19 100644 --- a/org.glite.lb.server/project/version.properties +++ b/org.glite.lb.server/project/version.properties @@ -1,4 +1,4 @@ -module.version = 1.0.1 +module.version = 1.0.2 module.age = 1 - \ No newline at end of file + 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 79caeb7..a0edb60 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..4f82ecb 100644 --- a/org.glite.lb.server/src/server_state.c +++ b/org.glite.lb.server/src/server_state.c @@ -32,14 +32,14 @@ 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)) { case 1: break; case -1: if (edg_wll_Error(ctx,NULL,NULL) == EEXIST) { free(stmt); - trio_asprintf(&stmt,"update server_state set value = '%|Ss' " + trio_asprintf(&stmt,"update server_state set value = %s " "where prefix = 'https://%|Ss:%d' " "and name = '%|Ss'", val,ctx->srvName,ctx->srvPort,name); 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