in reply to Re^3: Best Perlish way to test if a mysql table exists?
in thread Best Perlish way to test if a mysql table exists?
re-write trappig code for every line of sql in the script....Not necessary, you can set RaiseError for just that particular query. BTW, did you know you can localize hash/array values? Even if the hash/array is a lexical variable?
Alternately, you can just set RaiseError/PrintError on the individual statement handle (not the database connection handle).eval { local $DBH->{RaiseError} = 1; local $DBH->{PrintError} = 0; $sth = $DBH->prepare($sql); $sth->execute; 1; }; # table was found if $@ is empty
blokhead
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Best Perlish way to test if a mysql table exists?
by Aristotle (Chancellor) on Jan 31, 2005 at 06:24 UTC |