win32 odbc test script

Discussion in 'Perl Misc' started by joe, Jun 27, 2004.

  1. joe

    joe Guest

    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";

    }
    }
    joe, Jun 27, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Frank Millman
    Replies:
    2
    Views:
    1,458
    THavelick
    Feb 14, 2008
  2. Robert Brewer
    Replies:
    1
    Views:
    305
    Frank Millman
    Mar 18, 2005
  3. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    682
    Skybuck Flying
    Oct 4, 2009
  4. Wes Gamble
    Replies:
    1
    Views:
    152
    Gerardo Santana Gómez Garrido
    Apr 5, 2006
  5. Jim Roberts
    Replies:
    7
    Views:
    235
    Bart Lateur
    Jan 4, 2006
Loading...

Share This Page