Guest User

Untitled

a guest
Jul 15th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1.  
  2. my $sth=$dbh->prepare("INSERT INTO borrower_attributes (borrowernumber,code,attribute) VALUES (?,?,?)");
  3. my $attr_sth=$dbh->prepare("SELECT borrowernumber from borrower_attributes where borrowernumber=? and attribute=?");
  4.  
  5. open my $io,"<$infile_name";
  6. RECORD:
  7.  
  8. while (my $row=$csv->getline($io)){
  9. last RECORD if ($debug and $i>10);
  10. $i++;
  11. print "." unless ($i %10);
  12. print "\r$i" unless ($i % 100);
  13. my @data=@$row;
  14. my $borrower=GetMemberDetails(undef,$data[0]);
  15. if (!$borrower){
  16. $borrower_not_found++;
  17. next RECORD;
  18. }
  19.  
  20. $attr_sth->execute($borrower->{borrowernumber},$attribute_name);
  21. my $attr=$attr_sth->fetchrow_hashref();
  22.  
  23. if (!$attr) {
  24. $debug and print "$data[0] ($borrower->{borrowernumber}: $attribute_name:$data[1]\n";
  25. if ($doo_eet){
  26. $sth->execute($borrower->{borrowernumber},$attribute_name,$data[1]);
  27. }
  28. $written++;
  29. }
  30.  
  31. }
Add Comment
Please, Sign In to add comment