Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 wandering the Monastery: (7)
As of 2014-08-22 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (146 votes), past polls