From ae5985fb6679715e6d7e58709860700884d3ab5d Mon Sep 17 00:00:00 2001 From: kongtiaowang Date: Mon, 6 May 2024 11:57:50 -0400 Subject: [PATCH] [minc_insertion] Improve command line arguments validation --- uploadNeuroDB/minc_insertion.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/uploadNeuroDB/minc_insertion.pl b/uploadNeuroDB/minc_insertion.pl index c3f1c623f..7462361a5 100755 --- a/uploadNeuroDB/minc_insertion.pl +++ b/uploadNeuroDB/minc_insertion.pl @@ -337,7 +337,8 @@ =head2 Methods IsTarchiveValidated, ArchiveLocation FROM - mri_upload JOIN tarchive USING (TarchiveID) + mri_upload + LEFT JOIN tarchive USING (TarchiveID) WHERE UploadID = ? QUERY @@ -345,6 +346,12 @@ =head2 Methods my $sth = $dbh->prepare($query); $sth->execute($upload_id); my @array = $sth->fetchrow_array; + + die "Upload with ID '$upload_id' does not exist. Aborting.\n" unless @array; + if (!defined $array[1]) { + die "Upload ID '$upload_id' does not have an associated TarchiveID " . + "(dicomTar does not appear to have been successfully run on it...). Aborting.\n"; + } $is_valid = $array[0]; $ArchiveLocation = $array[1];