MySQL Forums
Forum List  »  General

Retrieving table information from a database
Posted by: cREbralFIX
Date: February 15, 2005 09:23PM

Hi all,

I'm using Perl, DBI, and the ODBC driver on Windows with MySQL 4.1.9. I am writing a DB creation script want to test for the existence of a table. I've tracked down the table_info and table functions (and TABLE_NAME attribute) in perldoc DBI. However, it seems I cannot use the information returned. How do I test for a table in a database?

I'm looking at something like:

my $table = "this_isa_name";
my $result = $dbh -> table_info ( '','',$table, '');

if ( $result ) {
print "table $table exists\n";
} else {
print "nope, ain't there!\n";
}

Thanks!

Options: ReplyQuote


Subject
Written By
Posted
Retrieving table information from a database
February 15, 2005 09:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.