J
Johnson Lau
I wrote a code to compare the NAME1 in table1 an NAME2 in table2. If a NAME2 equals to any one of NAME1, delete the record
containing NAME2. Each of table1 and table2 is in Foxpro (*.dbf) format, containing around 6000 records and sorting according to
NAME1 or NAME2. It takes me around 2 hours to finish the job. Is it possible to improve the efficiency? Thanks very much.
#!/usr/bin/perl
use strict;
use DBI;
my $dbh = DBI->connect("DBI:XBase:") or die $DBI::errstr;
my $abc = $dbh->selectcol_arrayref("select NAME1 from table1");
my $def = $dbh->prepare("delete from table2 where NAME2 = ?", {'MaxRows' => 1});
foreach (@$abc) {
$lc->execute($_);
}
containing NAME2. Each of table1 and table2 is in Foxpro (*.dbf) format, containing around 6000 records and sorting according to
NAME1 or NAME2. It takes me around 2 hours to finish the job. Is it possible to improve the efficiency? Thanks very much.
#!/usr/bin/perl
use strict;
use DBI;
my $dbh = DBI->connect("DBI:XBase:") or die $DBI::errstr;
my $abc = $dbh->selectcol_arrayref("select NAME1 from table1");
my $def = $dbh->prepare("delete from table2 where NAME2 = ?", {'MaxRows' => 1});
foreach (@$abc) {
$lc->execute($_);
}