work around missing id, RT#83146
[freeside.git] / bin / h_cust_main-wipe_paycvv
1 #!/usr/bin/perl
2
3 use strict;
4 use FS::UID qw(adminsuidsetup dbh);
5 use FS::Record; #buh?
6
7 my $user = shift or die 'usage';
8 adminsuidsetup $user;
9
10 while (1) {
11
12   my $sql = ' UPDATE h_cust_main SET paycvv = NULL
13                 WHERE historynum IN ( SELECT historynum FROM h_cust_main
14                                         WHERE paycvv IS NOT NULL LIMIT 8192 )';
15 #                                        WHERE paycvv IS NOT NULL LIMIT 1 )';
16
17   my $sth = dbh->prepare($sql) or die dbh->errstr;
18
19   print '.'; $|=1;
20
21   my $rv = $sth->execute;
22
23   dbh->commit or die dbh->errstr;
24
25   last if $rv == 0;
26
27 }
28
29 print "\n";
30