if (($Temp eq $TempDSN) && ($DSNs{$Temp} eq $DriverType)){
$iTempDSNExists++;
}
if ($DSN =~ /$Temp/i){
$iTempDSN = 0;
$DriverType = $DSNs{$Temp};
}
print "\tDSN=\"$Temp\" (\"$DSNs{$Temp}\")\n";
}
####
# T E S T 2.5
####
# IF WE DO NOT find the DSN the user specified...
if ($iTempDSN){
PrintTest("2.5", "Create a Temporary DSN");
print "\n\tCould not find the DSN (\"$DSN\") so we will\n\tuse a temporary one (\"$TempDSN\")...\n\n";
$DSN = $TempDSN;
if (! $iTempDSNExists){
print "\tAdding DSN \"$DSN\"...";
if (Win32::ODBC::ConfigDSN(ODBC_ADD_DSN, $DriverType, ("DSN=$DSN", "Description=The Win32 ODBC Test DSN for Perl", "DBQ=$Dir\\$DBase", "DEFAULTDIR=$Dir", "UID=", "PWD="))){
print "Successful!\n";
}else{
print "Failure\n";
$Failed{'Test 2.5'} = "ConfigDSN(): Could not add \"$DSN\": " . Win32::ODBC::Error();
# If we failed here then use the last DSN we listed in Test 2
$DriverType = $DSNs{$Temp};
$DSN = $Temp;
print "\n\tCould not add a temporary DSN so using the last one listed:\n";
print "\t\t$DSN ($DriverType)\n";
}
}
}
####
# Report What Driver/DSN we are using
####
print "\n\nWe are using the DSN:\n\tDSN = \"$DSN\"\n";
print "\tDriver = \"$DriverType\"\n\n";
####
# T E S T 3
####
PrintTest(3, "Open several ODBC connections");
print "\n\tOpening ODBC connection for \"$DSN\"...\n\t\t";