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 (Parson)
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".


Comment on Re^2: How to give a database as an input in a perl script?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973478]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (12)
As of 2015-07-05 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls