Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > $dbh->tables() returns nothing

Reply
Thread Tools

$dbh->tables() returns nothing

 
 
Julia deSilva
Guest
Posts: n/a
 
      12-17-2003
Hi there all,

Unix Perl MYSQL

Has anyone experienced on some servers ...

my @tables = $dbh->tables() returning nothing Nil Nada zilch when you are
100% sure you have oodles of tables ?

Is this a known problem, is there a fix, workaround ?

TIA and Merry Xmas.

J


 
Reply With Quote
 
 
 
 
James Willmore
Guest
Posts: n/a
 
      12-18-2003
On Wed, 17 Dec 2003 11:58:55 -0000
"Julia deSilva" <(E-Mail Removed)> wrote:
> Unix Perl MYSQL
>
> Has anyone experienced on some servers ...
>
> my @tables = $dbh->tables() returning nothing Nil Nada zilch when
> you are 100% sure you have oodles of tables ?
>
> Is this a known problem, is there a fix, workaround ?


Have you done an 'execute' or 'do' before doing a 'tables' call?
Some calls to 'tables', 'rows', etc. do not return a value unless
there's an 'execute' performed first. Try something like this
(untested)

....connect as usual ...
$dbh->prepare('select * from test');
$dbh->execute;

my @tables = $dbh->tables();
.... continue with your code ...

You may want to check over the DBD::mysql and DBI documents to
(dis)prove what I've said. It ('tables') varies from vendor to vendor
and may not even be available for MySQL. So, you may have to fall
back to using an SQL statement instead.

In any event - double check the docs

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Without ice cream life and fame are meaningless.

 
Reply With Quote
 
 
 
 
Jim Keenan
Guest
Posts: n/a
 
      12-18-2003
"Julia deSilva" <(E-Mail Removed)> wrote in message news:<3xXDb.22875$(E-Mail Removed)>...
> Hi there all,
>
> Unix Perl MYSQL
>
> Has anyone experienced on some servers ...
>
> my @tables = $dbh->tables() returning nothing Nil Nada zilch when you are
> 100% sure you have oodles of tables ?
>
> Is this a known problem, is there a fix, workaround ?
>

FWIW, in most recent version of DBI, this method is deprecated. See:
http://search.cpan.org/~timb/DBI-1.39/DBI.pm#tables

jimk
 
Reply With Quote
 
Bryan Castillo
Guest
Posts: n/a
 
      12-18-2003
"Julia deSilva" <(E-Mail Removed)> wrote in message news:<3xXDb.22875$(E-Mail Removed)>...
> Hi there all,
>
> Unix Perl MYSQL
>
> Has anyone experienced on some servers ...
>
> my @tables = $dbh->tables() returning nothing Nil Nada zilch when you are
> 100% sure you have oodles of tables ?
>
> Is this a known problem, is there a fix, workaround ?
>
> TIA and Merry Xmas.
>
> J


I haven't experience the problem, but if you need the tables in the meantime.
Here ya go:

sub show_tables {
my $dbh = shift;
my @tables;
my $st = $dbh->prepare('show tables');
$st->execute;
while (my $row = $st->fetchrow_arrayref) {
push(@tables, $row->[0]);
}
return @tables;
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
re module: Nothing to repeat, but no sre_constants.error: nothing torepeat ? Devin Jeanpierre Python 2 02-14-2012 01:33 PM
DataGrid.FindControl() returns nothing MattB ASP .Net 2 02-16-2005 04:47 AM
qry returns nothing (no data matched qry) Bob Green via .NET 247 ASP .Net 2 04-16-2004 08:54 AM
Query returns nothing Bijoy Naick ASP .Net 2 02-01-2004 07:16 PM
show running returns nothing, routing stops Richard Antony Burton Cisco 10 11-25-2003 10:39 AM



Advertisments