win32 odbc test script

J

joe

Hi i just wrote a little quick and dirty script to query odbc, i could not
find anything similar so i wrote this.

use Win32::ODBC;
print "Enter ODBC data source: ";
$myprompt = <STDIN>;
chop($myprompt);

my($db) = new Win32::ODBC("$myprompt");

while (true){
print "> ";
$myprompt = <STDIN>;
chop($myprompt);

if ($myprompt eq "quit"){
$db->Close();
exit;
}

$db->Sql("$myprompt");
my(@fields) = $db->FieldNames;

while ($db->FetchRow()) {
my(%data) = $db->DataHash();
foreach $field (sort @fields) {
$test = "$data{$field} ";
print "$test";
}
print "\n";

}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top