Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: How to give a database as an input in a perl script?

by dsheroh (Prior)
on May 31, 2012 at 09:38 UTC ( #973478=note: print w/replies, xml ) Need Help??


in reply to Re: How to give a database as an input in a perl script?
in thread How to give a database as an input in a perl script?

Generic version:
use strict; use warnings; use DBI; my $dbh = DBI->connect(...); my @tables = $dbh->tables(undef, undef, undef, 'TABLE'); print "$_\n" for @tables;
The tables method should work for all databases supported by DBI. Sending a show tables query is MySQL-specific - I know it doesn't work with SQLite databases and, from long-gone memory, I'm pretty sure PostgreSQL wouldn't like it either. Any other database engine, I can only say "seems unlikely".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973478]
help
Chatterbox?
[chacham]: Just paint the white house black again.
dbander snorts
LanX Gesundheit! :)
talexb wonders about dividing developers in those born before the Unix timestamp of zero .. and after. Spoiler: I'm before.
chacham remebers I am a mad scientist
[stevieb]: talexb I'm after by a few years, but we can still be friends because you live in my hometown ;)
[LanX]: White House

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2017-08-18 13:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (302 votes). Check out past polls.

    Notices?