Professional Web Applications Themes

mysql dbi list of tables - PERL Modules

Hello, I'm trying to get a list of table names from a mysql database in my perl program. I've been hacking through lots of possible ways to do it, struggling with the (to me) cryptic perldoc pages, but I can't make it perform sensibly, eg. I've just been battling with $dbh->tables() calls, but I can't understand the arguments it takes, and apprently the version with no arguments is deprecated, and in any case I just get a number 940 out of it -- that's probably the number of tables in my database. Maybe I'm closer than I think. What's the ...

  1. #1

    Default mysql dbi list of tables

    Hello,
    I'm trying to get a list of table names from a mysql database in my perl
    program. I've been hacking through lots of possible ways to do it,
    struggling with the (to me) cryptic perldoc pages, but I can't make it
    perform sensibly, eg. I've just been battling with $dbh->tables() calls,
    but I can't understand the arguments it takes, and apprently the version
    with no arguments is deprecated, and in any case I just get a number 940
    out of it -- that's probably the number of tables in my database. Maybe I'm
    closer than I think. What's the easiest way to do this?

    Thanks,

    Jez.
    neo ancient Guest

  2. #2

    Default Re: mysql dbi list of tables

    On 11 Dec 2003 18:05:37 GMT, neo ancient <neoancienthotmail.com> wrote:
    > Hello,
    > I'm trying to get a list of table names from a mysql database in my
    > perl program.
    [snip]

    # untested

    my $sql = qq[ SHOW TABLES ];
    my $rows = $dbh->selectall_arrayref($sql);

    etc...

    John J. Trammell Guest

  3. #3

    Default Re: mysql dbi list of tables

    In article <Xns944EB7B38A7B3neoancienthotmailcom130.133.1.4> , neo
    ancient <neoancienthotmail.com> wrote:
    > I'm trying to get a list of table names from a mysql database in my perl
    > program.
    use DBI;

    my $dbh = DBI->connect('dbi:mysql:databasename', 'user','pass');
    my tables = $dbh->tables();

    --
    cp
    cp Guest

  4. #4

    Default Re: mysql dbi list of tables

    [url]http://www.cyberciti.biz/faq/how-to-access-mysql-database-using-perl/#comment-49961[/url]

    It works!
    Unregistered Guest

Similar Threads

  1. list tables from Access 2000
    By manylists in forum Coldfusion Database Access
    Replies: 1
    Last Post: April 28th, 09:09 PM
  2. List Access database tables
    By Kevin Ingram in forum ASP Database
    Replies: 7
    Last Post: January 9th, 04:09 AM
  3. Replies: 1
    Last Post: October 5th, 06:14 AM
  4. Replies: 5
    Last Post: August 19th, 12:15 AM
  5. Getting list of available tables
    By TsTom in forum Oracle Server
    Replies: 1
    Last Post: January 14th, 03:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139