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. Advertisements

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,557
    THavelick
    Feb 14, 2008
  2. Robert Brewer
    Replies:
    1
    Views:
    354
    Frank Millman
    Mar 18, 2005
  3. Frank Millman

    Buglet in win32 odbc

    Frank Millman, Aug 12, 2005, in forum: Python
    Replies:
    0
    Views:
    310
    Frank Millman
    Aug 12, 2005
  4. Skybuck Flying

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

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    1,042
    Skybuck Flying
    Oct 4, 2009
  5. Wes Gamble
    Replies:
    1
    Views:
    339
    Gerardo Santana Gómez Garrido
    Apr 5, 2006
  6. Bernt Levinsson

    Win32::ODBC and creating fields

    Bernt Levinsson, Aug 6, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    143
    Bernt Levinsson
    Aug 7, 2003
  7. Max Harvey
    Replies:
    3
    Views:
    233
    Max Harvey
    Sep 15, 2003
  8. Jim Roberts
    Replies:
    7
    Views:
    465
    Bart Lateur
    Jan 4, 2006
Loading...