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

Syscrusher scott at 4th.com
Thu Apr 14 15:53:49 UTC 2005


On Thursday 14 April 2005 09:30, Adrian Rossouw wrote:
> I wrote db_table_exists and a db_column_exists functions recently for
> the install system, if you want them ?
> 
> What are you using it for ?

I am creating a migration feature for images (in cooperation with Walkah), and
I need to detect whether the old-style image table is present. If it is, then
I look to see if it has rows, and if so, then a migration makes sense. If the
table is missing or empty, then I will disable the migration feature and
(if the user goes to that URL anyway) tell them that it's not applicable to
their situation.

In answer to your original question, though, yes, I'd very much like to borrow
that code. I can put a "function_exists()" test in my code so that mine doesn't
break if yours already defines the functions. I'll put these functions into a
separate include file, and just not include it if they aren't needed.

Scott

-- 
-------------------------------------------------------------------------------
Scott Courtney     Drupal user name: "syscrusher"   http://drupal.org/user/9184
scott at 4th.com      Drupal projects: http://drupal.org/project/user/9184
Sandbox:  http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/syscrusher



More information about the drupal-devel mailing list