[drupal-devel] Detecting table existence/absence in a Drupally-correct way

Gabor Hojtsy gabor at hojtsy.hu
Thu Apr 14 13:11:34 UTC 2005

>>Good evening!
> Goood morning!

Good afternoon!

>>Is there a well-behaved way to use Drupal's DB abstraction to find
>>out if a table exists? I'm working on a migration feature, and need
>>to be able to detect the existence of the table so that I can issue
>>a user-friendly "you don't need to do this step" message if the
>>table isn't there.
> You could do "CREATE TABLE IF NOT EXISTS foo ...." and take out the user
> intervention completely.

Or issue a SHOW TABLES command if you need a list of available tables in 
a particular database.


More information about the drupal-devel mailing list