#!/usr/bin/perl # $Id: zlist.pl,v 1.1.1.1 2011/06/03 09:28:47 yason Exp $ use DBI; $| = 1; my $server = "MSSQL"; my $user = "it_men"; my $pass = "itmen712"; my $dsn = "DBI:Sybase:server=$server"; my $sth; my @zayavki; my @zayavki_times; my @zayavki_pri; my @jpegs; my @jpegs_times; my @jpegs_pri; my @probas; my @probas_times; my @probas_pri; my $i; $dbh = DBI->connect($dsn, $user, $pass) or die "unable to connect to server $DBI::errstr"; $dbh->do("use Manager"); $sth = $dbh->prepare ("SELECT NumCard,time_file,file_priority FROM upload_files WHERE Status=0 AND type_file=0") or die "SQL prepare failed\n"; $sth->execute( ) or die "unable to execute query $query error $DBI::errstr"; $i=0; print "*** Zayavki ***\n"; while( ($zayavki[$i], $zayavki_times[$i], $zayavki_pri[$i]) = $sth->fetchrow_array()) { print "$zayavki[$i] - $zayavki_times[$i] [priority $zayavki_pri[$i]]\n"; $i++; } $sth->finish(); $sth = $dbh->prepare ("SELECT NumCard,time_file,file_priority FROM upload_files WHERE Status=0 AND type_file=1") or die "SQL prepare failed\n"; $sth->execute( ) or die "unable to execute query $query error $DBI::errstr"; $i=0; print "\n*** Jpegs ***\n"; while( ($jpegs[$i], $jpegs_times[$i], $jpegs_pri[$i]) = $sth->fetchrow_array()) { print "$jpegs[$i] - $jpegs_times[$i] [priority $jpegs_pri[$i]]\n"; $i++; } $sth->finish(); $sth = $dbh->prepare ("SELECT NumCard,time_file,file_priority FROM upload_files WHERE Status=0 AND type_file=2") or die "SQL prepare failed\n"; $sth->execute( ) or die "unable to execute query $query error $DBI::errstr"; $i=0; print "\n*** Probas ***\n"; while( ($probas[$i], $probas_times[$i], $probas_pri[$i]) = $sth->fetchrow_array()) { print "$probas[$i] - $probas_times[$i] [priority $probas_pri[$i]]\n"; $i++; } $sth->finish();