Don't return uncommitted files for GetJob
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 9 Jun 2005 12:00:58 +0000 (12:00 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 9 Jun 2005 12:00:58 +0000 (12:00 +0000)
org.glite.jp.primary/src/new_ftp_backend.c

index be620e4..14b701b 100644 (file)
@@ -752,6 +752,8 @@ int glite_jppsbe_get_job_url(
                }
                goto error_out;
        }
+
+       free(stmt); stmt = NULL;
        
        db_retn = glite_jp_db_fetchrow(db_res, db_row);
        if (db_retn != 3) {
@@ -784,6 +786,22 @@ int glite_jppsbe_get_job_url(
                goto error_out;
        }
 
+       trio_asprintf(&stmt,"select 'x' from files where jobid='%|Ss' "
+                               "and ext_url = '%|Ss' "
+                               "and state='committed' ",ju,*url_out);
+
+       if ((db_retn = glite_jp_db_execstmt(ctx,stmt,&db_res)) <= 0) {
+               if (db_retn == 0) {
+                       err.code = ENOENT;
+                       err.desc = "not uploaded yet";
+               }
+               else {
+                       err.code = EIO;
+                       err.desc = "DB access failed";
+               }
+               /* goto error_out; */
+       }
+
 error_out:
        free(db_row[0]); free(db_row[1]);
        free(stmt);