Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my $sth=$dbh->prepare("INSERT INTO borrower_attributes (borrowernumber,code,attribute) VALUES (?,?,?)");
- my $attr_sth=$dbh->prepare("SELECT borrowernumber from borrower_attributes where borrowernumber=? and attribute=?");
- open my $io,"<$infile_name";
- RECORD:
- while (my $row=$csv->getline($io)){
- last RECORD if ($debug and $i>10);
- $i++;
- print "." unless ($i %10);
- print "\r$i" unless ($i % 100);
- my @data=@$row;
- my $borrower=GetMemberDetails(undef,$data[0]);
- if (!$borrower){
- $borrower_not_found++;
- next RECORD;
- }
- $attr_sth->execute($borrower->{borrowernumber},$attribute_name);
- my $attr=$attr_sth->fetchrow_hashref();
- if (!$attr) {
- $debug and print "$data[0] ($borrower->{borrowernumber}: $attribute_name:$data[1]\n";
- if ($doo_eet){
- $sth->execute($borrower->{borrowernumber},$attribute_name,$data[1]);
- }
- $written++;
- }
- }
Add Comment
Please, Sign In to add comment