File: [local] / wpscripts / elist / dbops.pm (download)
Revision 1.1.1.1 (vendor branch), Fri Jun 3 09:28:47 2011 UTC (13 years ago) by yason
Branch: yason, MAIN
CVS Tags: import, HEAD Changes since 1.1: +0 -0 lines
import scripts for fullprint
|
#!/usr/bin/perl
use DBI;
use warnings;
package dbops;
our $EPD_ZAYAVKA_T = 0;
our $EPD_PROBA_T = 1;
our $server = "MSSQL";
our $user = "it_men";
our $pass = "itmen712";
our $dsn = "DBI:Sybase:server=$server";
our $table = 'T$_EPD_File';
our $sth;
sub db_connect()
{
$dbh = DBI->connect($dsn, $user, $pass) or die "unable to connect to server $DBI::errstr";
}
sub db_select()
{
$dbh->do("use Manager");
}
sub db_disconnect()
{
$dbh->disconnect();
}
sub db_fetch($$)
{
my $file_type = shift;
my $Ready = shift;
my $i = 0;
my @OrderNO;
my @win_path;
my @setDate;
my @ReadyDate;
$sth = $dbh->prepare ("SELECT OrderNO,win_path,setDate,ReadyDate FROM $table WHERE File_type=$file_type AND Ready=$Ready AND Backed_up=0")
or die("fetch");
$sth->execute( ) or die "unable to execute query! error $DBI::errstr";
# initialize to zero everything
$#OrderNO = $#win_path = $#setDate = $#ReadyDate = 0;
while( ($OrderNO[$i], $win_path[$i], $setDate[$i], $ReadyDate[$i]) = $sth->fetchrow_array())
{
# fetch by row
$i++;
}
$sth->finish();
return( (\@OrderNO, \@win_path, \@setDate, \@ReadyDate) );
} # db_fetch()
return(1);