From a0887455e368b014bbd3f796e3917e8d17253058 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Fri, 27 Oct 2006 09:16:49 +0000 Subject: [PATCH] Another improvement to Child Job Histrogram storage and retrieval functions. --- org.glite.lb.server/src/jobstat.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/org.glite.lb.server/src/jobstat.c b/org.glite.lb.server/src/jobstat.c index ac43d9a..4715d4f 100644 --- a/org.glite.lb.server/src/jobstat.c +++ b/org.glite.lb.server/src/jobstat.c @@ -892,23 +892,19 @@ edg_wll_ErrorCode edg_wll_GetSubjobHistogram(edg_wll_Context ctx, edg_wlc_JobId char *stmt = NULL,*out = NULL; edg_wll_Stmt sh; int f = -1; - char *string_jobid; + char *jobid_md5; - string_jobid = edg_wlc_JobIdUnparse(parent_jobid); + jobid_md5 = edg_wlc_JobIdGetUnique(parent_jobid); edg_wll_ResetError(ctx); - trio_asprintf(&stmt,"select int_status from states where (jobid='%|Ss') AND (version='%|Ss')", string_jobid, INTSTAT_VERSION); + trio_asprintf(&stmt,"select int_status from states where (jobid='%|Ss') AND (version='%|Ss')", jobid_md5, INTSTAT_VERSION); - free(string_jobid); + free(jobid_md5); if (stmt==NULL) { return edg_wll_SetError(ctx,ENOMEM, NULL); } -/* XXX: Untested */ - -/* XXX: This positively does not work, needs finishing: */ - if (edg_wll_ExecStmt(ctx,stmt,&sh) >= 0) { f=edg_wll_FetchRow(sh,&out); if (f == 0) { @@ -930,26 +926,24 @@ edg_wll_ErrorCode edg_wll_SetSubjobHistogram(edg_wll_Context ctx, edg_wlc_JobId char *stat_enc = NULL; char *stmt; int dbret; - char *string_jobid; + char *jobid_md5; stat_enc = enc_intJobStat(strdup(""), ijs); - string_jobid = edg_wlc_JobIdUnparse(parent_jobid); + jobid_md5 = edg_wlc_JobIdGetUnique(parent_jobid); trio_asprintf(&stmt, "update states set " "status=%d,int_status='%|Ss',version='%|Ss'" "where jobid='%|Ss'", - ijs->pub.state, stat_enc, INTSTAT_VERSION, string_jobid); + ijs->pub.state, stat_enc, INTSTAT_VERSION, jobid_md5); - free(string_jobid); + free(jobid_md5); if (stmt==NULL) { return edg_wll_SetError(ctx,ENOMEM, NULL); } -/* XXX: Untested */ - //printf ("\n\n\n Would like to run SQL statament: %s\n\n\n\n", stmt); if ((dbret = edg_wll_ExecStmt(ctx,stmt,NULL)) < 0) goto cleanup; -- 1.8.2.3