koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-devel] CVS: koha/misc fines2.pl,1.2,1.3 fixborrower.pl,1.1.1.1,1.2


From: Pat Eyler
Subject: [Koha-devel] CVS: koha/misc fines2.pl,1.2,1.3 fixborrower.pl,1.1.1.1,1.2
Date: Tue Apr 9 15:09:11 2002

Update of /cvsroot/koha/koha/misc
In directory usw-pr-cvs1:/tmp/cvs-serv24953

Modified Files:
        fines2.pl fixborrower.pl 
Log Message:
refactoring, marking spots for further refactoring


Index: fines2.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/fines2.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** fines2.pl   17 Mar 2002 02:31:02 -0000      1.2
--- fines2.pl   9 Apr 2002 22:08:15 -0000       1.3
***************
*** 1,5 ****
  #!/usr/bin/perl
  
! #script to keep total of number of issues;
  
  use C4::Database;
--- 1,9 ----
  #!/usr/bin/perl
  
! #  This script loops through each overdue item, determines the fine,
! #  and updates the total amount of fines due by each user.  It relies on 
! #  the existence of /tmp/fines, which is created by ???
! #
! #  This script is meant to be run nightly out of cron.
  
  use C4::Database;
***************
*** 10,30 ****
  
  open (FILE,'>/tmp/fines') || die;
! my ($count,$data)=Getoverdues();
! #print $count;
! my $count2=0;
! #$count=1000;
  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
  $mon++;
  $year=$year+1900;
  my $date=Date_DaysSince1BC($mon,$mday,$year);
  #my $date=Date_DaysSince1BC(1,24,2002);
  my $bornum;
! #print $date;
  my $total=0;
! my $max=5;
  #my $bornum2=$data->[0]->{'borrowernumber'};
  
! my $i2=1;
! for (my $i=0;$i<$count;$i++){
    my @dates=split('-',$data->[$i]->{'date_due'});
    my $date2=Date_DaysSince1BC($dates[1],$dates[2],$dates[0]);    
--- 14,66 ----
  
  open (FILE,'>/tmp/fines') || die;
! # FIXME
! # it looks like $count is just a counter, would it be
! # better to rely on the length of the array @$data and turn the
! # for loop below into a foreach loop?
! #
! my ($numOverdueItems,$data)=Getoverdues();
! print $numOverdueItems if $DEBUG;
! my $overdueItemsCounted=0 if $DEBUG;
! 
! # FIXME
! # delete this?
! #$numOverdueItems=1000;
! 
  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
  $mon++;
  $year=$year+1900;
+ 
  my $date=Date_DaysSince1BC($mon,$mday,$year);
+ 
+ # FIXME
+ # delete this?
  #my $date=Date_DaysSince1BC(1,24,2002);
+ print $date if $DEBUG;
+ 
  my $bornum;
! 
! # FIXME
! # $total isn't used anywhere else in the file,
! # can we delete it?
! #
  my $total=0;
! 
! # FIXME
! # this probably ought to be a global variable or constant
! # defined in a central place
! #
! my $maxFine=5;
! 
! # FIXME
! # delete both of these?
  #my $bornum2=$data->[0]->{'borrowernumber'};
+ #my $i2=1;
  
! # FIXME
! # This should be rewritten to be a foreach loop
! # Also, this loop is really long, and could be better grokked if broken
! # into a number of smaller, separate functions
! #
! for (my $i=0;$i<$numOverdueItems;$i++){
    my @dates=split('-',$data->[$i]->{'date_due'});
    my $date2=Date_DaysSince1BC($dates[1],$dates[2],$dates[0]);    
***************
*** 32,47 ****
    my $borrower=BorType($data->[$i]->{'borrowernumber'});
    if ($date2 <= $date){
!     $count2++;
      my $difference=$date-$date2;
!     my 
($amount,$type,$printout)=CalcFine($data->[$i]->{'itemnumber'},$borrower->{'categorycode'},$difference);
      
!     if ($amount > $max){
!       $amount=$max;
      }
      if ($amount > 0){
        
UpdateFine($data->[$i]->{'itemnumber'},$data->[$i]->{'borrowernumber'},$amount,$type,$due);
  #      if ($amount ==5){
  #           marklost();
  #      }
!        if ($borrower->{'categorycode'} eq 'C'){
         my $dbh=C4Connect;
         my $query="Select * from borrowers where 
borrowernumber='$borrower->{'guarantor'}'";
--- 68,95 ----
    my $borrower=BorType($data->[$i]->{'borrowernumber'});
    if ($date2 <= $date){
!     $overdueItemsCounted++ if $DEBUG;
      my $difference=$date-$date2;
!     my ($amount,$type,$printout)=
!       CalcFine($data->[$i]->{'itemnumber'},
!                $borrower->{'categorycode'},
!                $difference);      
!     if ($amount > $maxFine){
!       $amount=$maxFine;
      }
      if ($amount > 0){
        
UpdateFine($data->[$i]->{'itemnumber'},$data->[$i]->{'borrowernumber'},$amount,$type,$due);
+ 
+ #
+ # FIXME
+ # If this isn't needed it should be deleted
+ #
+ 
  #      if ($amount ==5){
  #           marklost();
  #      }
!        if ($borrower->{'categorycode'} eq 'C'){  # FIXME
!                                                # this should be a
!                                                  # separate function
!                                                  #
         my $dbh=C4Connect;
         my $query="Select * from borrowers where 
borrowernumber='$borrower->{'guarantor'}'";
***************
*** 54,61 ****
         }
         print 
"$printout\t$borrower->{'cardnumber'}\t$borrower->{'categorycode'}\t$borrower->{'firstname'}\t$borrower->{'surname'}\t$data->[$i]->{'date_due'}\t$type\t$difference\t$borrower->{'emailaddress'}\t$borrower->{'phone'}\t$borrower->{'streetaddress'}\t$borrower->{'city'}\t$amount\n";
!     } else {
  #      print "$borrower->{'cardnumber'}\t$borrower->{'categorycode'}\t0 
fine\n";
      }
!     if ($difference >= 28){ 
        my $borrower=BorType($data->[$i]->{'borrowernumber'});
        if ($borrower->{'cardnumber'} ne ''){
--- 102,114 ----
         }
         print 
"$printout\t$borrower->{'cardnumber'}\t$borrower->{'categorycode'}\t$borrower->{'firstname'}\t$borrower->{'surname'}\t$data->[$i]->{'date_due'}\t$type\t$difference\t$borrower->{'emailaddress'}\t$borrower->{'phone'}\t$borrower->{'streetaddress'}\t$borrower->{'city'}\t$amount\n";
!     } else { # FIXME
!            # if this is really useless, the whole else clause should be 
!            # deleted. 
!              #
  #      print "$borrower->{'cardnumber'}\t$borrower->{'categorycode'}\t0 
fine\n";
      }
!     if ($difference >= 28){ # FIXME
!                           # this should be a separate function
!                             #
        my $borrower=BorType($data->[$i]->{'borrowernumber'});
        if ($borrower->{'cardnumber'} ne ''){
***************
*** 66,69 ****
--- 119,125 ----
        my $item=itemnodata($env,$dbh,$data->[$i]->{'itemnumber'});
        if ($item->{'itemlost'} ne '1' && $item->{'itemlost'} ne '2' ){
+               # FIXME
+               # this should be a separate function
+               #
          $item->{'title'}=~ s/\'/\\'/g;
          my $query="Insert into accountlines
***************
*** 79,84 ****
          $sth->execute;
          $sth->finish;
!       } else {
!         
        }
        $dbh->disconnect;
--- 135,141 ----
          $sth->execute;
          $sth->finish;
!       } else { # FIXME
!                # this should be deleted
!                  #
        }
        $dbh->disconnect;
***************
*** 88,90 ****
--- 145,157 ----
    }
  }
+ 
+ if ($DEBUG) {
+    print <<EOM
+ 
+ Number of Overdue Items counted $overdueItemsCounted
+ Number of Overdue Items reported $numOverdueItems
+ 
+ EOM
+ }
+ 
  close FILE;

Index: fixborrower.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/fixborrower.pl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** fixborrower.pl      19 Dec 2000 23:45:57 -0000      1.1.1.1
--- fixborrower.pl      9 Apr 2002 22:08:15 -0000       1.2
***************
*** 1,54 ****
  #!/usr/bin/perl
  
  use C4::Database;
  use strict;
  
  my $dbh=C4Connect;
  my $query = "Select * from categories where (categorycode like 'L%' or 
categorycode like 'F%'
  or categorycode like 'S%' or categorycode like 'O%' or categorycode like 
'H%') and (categorycode <>'HR' 
  and categorycode <> 'ST')";
  my $sth=$dbh->prepare($query);
  $sth->execute;
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
-     my $temp=substr($data->{'categorycode'},0,1);
-   $query="update borrowers set area='$temp' where 
categorycode='$data->{'categorycode'}'";
-   my $sth2=$dbh->prepare($query);
-   $sth2->execute;
-   $sth2->finish;
-   $temp=substr($data->{'categorycode'},1,1);
-   $query="update borrowers set categorycode='$temp' where 
categorycode='$data->{'categorycode'}'"; 
-   $sth2=$dbh->prepare($query);
-   $sth2->execute;
-   $sth2->finish;
-    $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
-   $sth2=$dbh->prepare($query);
-   $sth2->execute;
-   $sth2->finish;
  
  }
  
  $query = "Select * from categories where (categorycode like 'V%') and 
(categorycode <>'HR' 
  and categorycode <> 'ST')";
  my $sth=$dbh->prepare($query);
  $sth->execute;
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
  #    my $temp=substr($data->{'categorycode'},0,1);
!   $query="update borrowers set area='V' where 
categorycode='$data->{'categorycode'}'";
!   my $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!   my $temp=substr($data->{'categorycode'},1,1);
!   $query="update borrowers set categorycode='$temp' where 
categorycode='$data->{'categorycode'}'"; 
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!    $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
  
  }
--- 1,68 ----
  #!/usr/bin/perl
  
+ # This script will convert a database into the newer, proper
+ # form ... I think.
+ 
+ 
  use C4::Database;
  use strict;
  
  my $dbh=C4Connect;
+ 
  my $query = "Select * from categories where (categorycode like 'L%' or 
categorycode like 'F%'
  or categorycode like 'S%' or categorycode like 'O%' or categorycode like 
'H%') and (categorycode <>'HR' 
  and categorycode <> 'ST')";
+ 
  my $sth=$dbh->prepare($query);
  $sth->execute;
+ 
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
  
+     my $temp=substr($data->{'categorycode'},0,1);
+     $query="update borrowers set area='$temp' where 
categorycode='$data->{'categorycode'}'";
+     my $sth2=$dbh->prepare($query);
+     $sth2->execute;
+     $sth2->finish;
+  
+    $temp=substr($data->{'categorycode'},1,1);
+     $query="update borrowers set categorycode='$temp' where 
categorycode='$data->{'categorycode'}'"; 
+     $sth2=$dbh->prepare($query);
+     $sth2->execute;
+     $sth2->finish;
+ 
+     $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
+     $sth2=$dbh->prepare($query);
+     $sth2->execute;
+     $sth2->finish;
+     
  }
  
  $query = "Select * from categories where (categorycode like 'V%') and 
(categorycode <>'HR' 
  and categorycode <> 'ST')";
+ 
  my $sth=$dbh->prepare($query);
  $sth->execute;
+ 
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
  #    my $temp=substr($data->{'categorycode'},0,1);
!     $query="update borrowers set area='V' where 
categorycode='$data->{'categorycode'}'";
!     my $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     my $temp=substr($data->{'categorycode'},1,1);
!     $query="update borrowers set categorycode='$temp' where 
categorycode='$data->{'categorycode'}'"; 
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
  
  }
***************
*** 57,75 ****
  my $sth=$dbh->prepare($query);
  $sth->execute;
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!   $query="update borrowers set area='' where 
categorycode='$data->{'categorycode'}'";
!   my $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!   $query="update borrowers set categorycode='W' where 
categorycode='$data->{'categorycode'}'"; 
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!    $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
  
  }
--- 71,92 ----
  my $sth=$dbh->prepare($query);
  $sth->execute;
+ 
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!     $query="update borrowers set area='' where 
categorycode='$data->{'categorycode'}'";
!     my $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="update borrowers set categorycode='W' where 
categorycode='$data->{'categorycode'}'"; 
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
  
  }
***************
*** 78,116 ****
  my $sth=$dbh->prepare($query);
  $sth->execute;
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!   $query="update borrowers set area='' where 
categorycode='$data->{'categorycode'}'";
!   my $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!   $query="update borrowers set categorycode='I' where 
categorycode='$data->{'categorycode'}'"; 
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!    $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
  
  }
  my $query = "Select * from categories where categorycode = 'TD'  or 
categorycode='TR'";
  my $sth=$dbh->prepare($query);
  $sth->execute;
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!   $query="update borrowers set area='X' where 
categorycode='$data->{'categorycode'}'";
!   my $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!   $query="update borrowers set categorycode='A' where 
categorycode='$data->{'categorycode'}'"; 
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!    $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
  
  }
--- 95,140 ----
  my $sth=$dbh->prepare($query);
  $sth->execute;
+ 
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!     $query="update borrowers set area='' where 
categorycode='$data->{'categorycode'}'";
!     my $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="update borrowers set categorycode='I' where 
categorycode='$data->{'categorycode'}'"; 
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
  
  }
+ 
  my $query = "Select * from categories where categorycode = 'TD'  or 
categorycode='TR'";
  my $sth=$dbh->prepare($query);
  $sth->execute;
+ 
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!     $query="update borrowers set area='X' where 
categorycode='$data->{'categorycode'}'";
!     my $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="update borrowers set categorycode='A' where 
categorycode='$data->{'categorycode'}'"; 
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
  
  }
***************
*** 119,137 ****
  my $sth=$dbh->prepare($query);
  $sth->execute;
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!   $query="update borrowers set area='K' where 
categorycode='$data->{'categorycode'}'";
!   my $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!   $query="update borrowers set categorycode='A' where 
categorycode='$data->{'categorycode'}'"; 
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!    $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
  
  }
--- 143,164 ----
  my $sth=$dbh->prepare($query);
  $sth->execute;
+ 
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!     $query="update borrowers set area='K' where 
categorycode='$data->{'categorycode'}'";
!     my $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="update borrowers set categorycode='A' where 
categorycode='$data->{'categorycode'}'"; 
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
  
  }
***************
*** 140,160 ****
  my $sth=$dbh->prepare($query);
  $sth->execute;
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!   $query="update borrowers set area='Z' where 
categorycode='$data->{'categorycode'}'";
!   my $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!   $query="update borrowers set categorycode='L' where 
categorycode='$data->{'categorycode'}'"; 
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!    $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
  
  }
  my $query = "Select * from categories where categorycode = 'TB'";
  my $sth=$dbh->prepare($query);
--- 167,191 ----
  my $sth=$dbh->prepare($query);
  $sth->execute;
+ 
  while (my $data=$sth->fetchrow_hashref){
    #update borrowers corresponding
    #update categories
!     $query="update borrowers set area='Z' where 
categorycode='$data->{'categorycode'}'";
!     my $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="update borrowers set categorycode='L' where 
categorycode='$data->{'categorycode'}'"; 
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
  
  }
+ 
  my $query = "Select * from categories where categorycode = 'TB'";
  my $sth=$dbh->prepare($query);
***************
*** 163,220 ****
    #update borrowers corresponding
    #update categories
!   $query="update borrowers set area='' where 
categorycode='$data->{'categorycode'}'";
!   my $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!   $query="update borrowers set categorycode='P' where 
categorycode='$data->{'categorycode'}'"; 
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
!    $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!   $sth2=$dbh->prepare($query);
!   $sth2->execute;
!   $sth2->finish;
  
  }
  
  $sth->finish;
- $query="insert into categories values ('A','Adult',5,99,0,'A',0,0,0,99,1)";
- $sth=$dbh->prepare($query);
- $sth->execute;
- $sth->finish;
- $query="insert into categories values ('E','Senior 
Citizen',5,99,0,'A',0,0,0,99,1)";                                               
                 
- $sth=$dbh->prepare($query);                                                   
                                                                    
- $sth->execute;                                                                
                                                                    
- $sth->finish;    
- $query="insert into categories values ('C','Child',5,16,0,'A',0,0,0,99,0)";
- $sth=$dbh->prepare($query);
- $sth->execute;
- $sth->finish;
- $query="insert into categories values 
('B','Housebound',5,99,0,'E',0,0,0,99,0)";
- $sth=$dbh->prepare($query);
- $sth->execute;
- $sth->finish;
- $query="insert into categories values ('F','Family',5,99,0,'A',0,0,0,99,1)";
- $sth=$dbh->prepare($query);
- $sth->execute;
- $sth->finish;
- $query="insert into categories values ('W','Workers',5,99,0,'A',0,0,0,99,0)";
- $sth=$dbh->prepare($query);
- $sth->execute;
- $sth->finish;
- $query="insert into categories values 
('I','Institution',5,99,0,'A',0,0,0,99,0)";
- $sth=$dbh->prepare($query);
- $sth->execute;
- $sth->finish;
- $query="insert into categories values 
('P','Privileged',5,99,0,'A',0,0,0,99,0)";
- $sth=$dbh->prepare($query);
- $sth->execute;
- $sth->finish;
- $query="insert into categories values ('L','Library',5,99,0,'A',0,0,0,99,0)";
- $sth=$dbh->prepare($query);
- $sth->execute;
- $sth->finish;
- 
  
  
  $dbh->disconnect;
--- 194,234 ----
    #update borrowers corresponding
    #update categories
! 
!     $query="update borrowers set area='' where 
categorycode='$data->{'categorycode'}'";
!     my $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
!     
!     $query="update borrowers set categorycode='P' where 
categorycode='$data->{'categorycode'}'"; 
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
! 
!     $query="delete from categories where 
categorycode='$data->{'categorycode'}'";
!     $sth2=$dbh->prepare($query);
!     $sth2->execute;
!     $sth2->finish;
  
  }
  
  $sth->finish;
  
+ my @queryValues = 
+     ("insert into categories values ('E','Senior 
Citizen',5,99,0,'A',0,0,0,99,1)",
+      "insert into categories values ('A','Adult',5,99,0,'A',0,0,0,99,1)",
+      "insert into categories values ('C','Child',5,16,0,'A',0,0,0,99,0)",
+      "insert into categories values ('B','Housebound',5,99,0,'E',0,0,0,99,0)",
+      "insert into categories values ('F','Family',5,99,0,'A',0,0,0,99,1)",
+      "insert into categories values ('W','Workers',5,99,0,'A',0,0,0,99,0)",
+      "insert into categories values 
('I','Institution',5,99,0,'A',0,0,0,99,0)",
+      "insert into categories values ('P','Privileged',5,99,0,'A',0,0,0,99,0)",
+      "insert into categories values ('L','Library',5,99,0,'A',0,0,0,99,0)"
+      );   
+ 
+ foreach $query (@queryValues) {
+     $sth=$dbh->prepare($query);
+     $sth->execute;
+     $sth->finish;
+ }
  
  $dbh->disconnect;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]