#Windows-based Perl/DBI/MS Access example
use DBI;
#open connection to Access database
$dbh = DBI->connect( "dbi:ODBC:driver=Microsoft Access Driver (*.mdb);
+dbq=C:TestCasesXP2K.mdb", "", "" );
#prepare and execute SQL statement
$stg = $dbh->prepare('SELECT REFERENCE, REQUIREMENTS FROM TestCasesOut
+put WHERE PassFail = "fail";
$stg->execute ||
die "Could not execute SQL statement ... maybe invalid?";
"""""THE ERROR OCCURS RIGHT HERE"""""
$sth = $dbh->prepare('SELECT REFERENCE FROM TestCasesOutput');
$sth->execute ||
die "Could not execute SQL statement ... maybe invalid?";
#output database results
$stt = $dbh->prepare('SELECT REQUIREMENT FROM TestCasesOutput');
$stt->execute ||
die "Could not execute SQL statement ... maybe invalid?";
#output database results
while (@row=$stg->fetchrow_array) {
@row1=$sth->fetchrow_array;
@row2=$stt->fetchrow_array;
open(fileOUT, ">>log.txt") or dienice("Can't open log.txt for writ
+ing: $!");
flock(fileOUT, 2);
seek(fileOUT, 0, 2);
print fileOUT "Reference: @row1\n";
print fileOUT "Requirement: @row2\n\n\n\n";
}
close(fileOUT);
janitore<d by ybiC: Remove HTML markup formatting and replace with balanced <code> tags, as per Monastery convention |