having problem selecting data from from a .csv or a .txt file using dbi:file in the following:
the above code works fine when connecting to mySql, but with file @rowResults is empty.
for the sake of comparisons we want to compare speed to a flat file. any suggestions would be helpful.
thanks.
Code:
$dbh = DBI->connect("DBI:File:f_dir=../directoryLocation") or die "Cannot connect: " . $DBI::errstr;
foreach $addedProduct (@productArray)
{
chop($addedProduct);
$item_number = $addedProduct;
my $query = "Select column1, column2, column3 from file.csv where item='$item_number'";
$sth = $dbh->prepare($query);
if (!$sth) { die "Illegal query: $query" };
$sth ->execute;
while (@row = $sth->fetchrow_array) {
foreach (@row) {
$rowResults[$counter].="$_\t" ;
}
$counter=$counter+1;
}
$sth->finish;
}
the above code works fine when connecting to mySql, but with file @rowResults is empty.
for the sake of comparisons we want to compare speed to a flat file. any suggestions would be helpful.
thanks.