[BACK]Return to dbops.pm CVS log [TXT][DIR] Up to [local] / wpscripts / elist

Annotation of wpscripts/elist/dbops.pm, Revision 1.1.1.1

1.1       yason       1: #!/usr/bin/perl
                      2: use DBI;
                      3: use warnings;
                      4:
                      5: package dbops;
                      6:
                      7: our $EPD_ZAYAVKA_T = 0;
                      8: our $EPD_PROBA_T = 1;
                      9:
                     10: our $server = "MSSQL";
                     11: our $user = "it_men";
                     12: our $pass = "itmen712";
                     13: our $dsn = "DBI:Sybase:server=$server";
                     14: our $table = 'T$_EPD_File';
                     15: our $sth;
                     16:
                     17: sub db_connect()
                     18: {
                     19:     $dbh = DBI->connect($dsn, $user, $pass) or die "unable to connect to server $DBI::errstr";
                     20: }
                     21:
                     22:
                     23: sub db_select()
                     24: {
                     25:     $dbh->do("use Manager");
                     26: }
                     27:
                     28:
                     29: sub db_disconnect()
                     30: {
                     31:     $dbh->disconnect();
                     32: }
                     33:
                     34:
                     35: sub db_fetch($$)
                     36: {
                     37:     my $file_type = shift;
                     38:     my $Ready = shift;
                     39:     my $i = 0;
                     40:     my @OrderNO;
                     41:     my @win_path;
                     42:     my @setDate;
                     43:     my @ReadyDate;
                     44:
                     45:
                     46:     $sth = $dbh->prepare ("SELECT OrderNO,win_path,setDate,ReadyDate FROM $table WHERE File_type=$file_type AND Ready=$Ready AND Backed_up=0")
                     47:        or die("fetch");
                     48:
                     49:     $sth->execute( ) or die "unable to execute query! error $DBI::errstr";
                     50:
                     51:     # initialize to zero everything
                     52:     $#OrderNO = $#win_path = $#setDate = $#ReadyDate = 0;
                     53:
                     54:     while( ($OrderNO[$i], $win_path[$i], $setDate[$i], $ReadyDate[$i]) = $sth->fetchrow_array())
                     55:     {
                     56:        # fetch by row
                     57:
                     58:        $i++;
                     59:     }
                     60:
                     61:     $sth->finish();
                     62:
                     63:     return( (\@OrderNO, \@win_path, \@setDate, \@ReadyDate) );
                     64:
                     65: } # db_fetch()
                     66:
                     67: return(1);

CVSweb