=================================================================== RCS file: /cvs/wpscripts/zstatus/zstatus.pl,v retrieving revision 1.2 retrieving revision 1.4 diff -u -r1.2 -r1.4 --- wpscripts/zstatus/zstatus.pl 2011/07/20 07:42:05 1.2 +++ wpscripts/zstatus/zstatus.pl 2012/02/02 15:06:19 1.4 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: zstatus.pl,v 1.2 2011/07/20 07:42:05 yason Exp $ +# $Id: zstatus.pl,v 1.4 2012/02/02 15:06:19 yason Exp $ use DBI; my $DB_SERVER = "pdc"; # from /usr/local/etc/freetds.conf @@ -13,10 +13,10 @@ my $value; my @status; -if(scalar(@ARGV) != 3 || $ARGV[1] ne "tiff" && $ARGV[1] ne "proba") +if(scalar(@ARGV) != 3 || $ARGV[1] ne "tiff" && $ARGV[1] ne "proba" && $ARGV[1] ne "tt" && $ARGV[1] ne "zjpeg" && $ARGV[1] ne "pjpeg") { print "Usage:\n"; - print "zstatus \n"; + print "zstatus \n"; exit(-1); } $numcard = shift; @@ -33,6 +33,9 @@ $sth = $dbh->prepare("SELECT ID,status from upload_files WHERE numcard=$numcard AND type_file=0") if($type eq "tiff"); $sth = $dbh->prepare("SELECT ID,status from upload_files WHERE numcard=$numcard AND type_file=1") if($type eq "proba"); +$sth = $dbh->prepare("SELECT ID,status from upload_files WHERE numcard=$numcard AND type_file=2") if($type eq "tt"); +$sth = $dbh->prepare("SELECT ID,status from upload_files WHERE numcard=$numcard AND type_file=3") if($type eq "zjpeg"); +$sth = $dbh->prepare("SELECT ID,status from upload_files WHERE numcard=$numcard AND type_file=4") if($type eq "pjpeg"); $sth->execute( ); @status = ($sth->fetchrow_array( )); @@ -44,6 +47,9 @@ $sth = $dbh->prepare("UPDATE upload_files SET status=$value WHERE numcard=$numcard AND type_file=0") if($type eq "tiff"); $sth = $dbh->prepare("UPDATE upload_files SET status=$value WHERE numcard=$numcard AND type_file=1") if($type eq "proba"); +$sth = $dbh->prepare("UPDATE upload_files SET status=$value WHERE numcard=$numcard AND type_file=2") if($type eq "tt"); +$sth = $dbh->prepare("UPDATE upload_files SET status=$value WHERE numcard=$numcard AND type_file=3") if($type eq "zjpeg"); +$sth = $dbh->prepare("UPDATE upload_files SET status=$value WHERE numcard=$numcard AND type_file=4") if($type eq "pjpeg"); $sth->execute( ) or die("Can not execute SQL"); print "status changed from $status[1] " . ($status[1] == 0 ? "(NOT SENT)" : "(SENT)") . " to $value " . ($value == 1 ? "(SENT)" : "(NOT SENT)") . "\n";