in reply to Checking for DB table existence using DBI/DBD
I believe your code is equivalent to:
sub does_table_exist { my ($db_handle, $table_name) = @_; my $query_handle = $db_handle->prepare("DESC $table_name"); $query_handle->{RaiseError} = 0; $query_handle->{PrintError} = 0; return $query_handle->execute(); }
You didn't take into account PrintError. The above clears RaiseError and PrintError, but only only for the sth created to execute DESC.
By the way, you're not quoting the table name, so still have a bug. You'll probably save yourself some trouble using rnahi's solution.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Checking for DB table existence using DBI/DBD
by shemp (Deacon) on Oct 13, 2005 at 21:46 UTC | |
by ikegami (Patriarch) on Oct 13, 2005 at 22:44 UTC | |
by shemp (Deacon) on Oct 13, 2005 at 23:11 UTC |