[support] Multiple DB connections within hook_cron

Earnie Boyd earnie at users.sourceforge.net
Fri Jan 25 19:12:25 UTC 2008


Quoting Tane Piper <digitalspaghetti at googlemail.com>:


>
> The function gets as far as the DB Selected message, and then gives me
> this error:
>
> Warning: Table 'client_ems.main_system' doesn't exist query: SELECT *
> FROM main_system WHERE type = 'theme' in
> /path/to/client/public_html/includes/database.mysql.inc on line 172
>
> However I am not making this request, it seems to be coming from
> drupal somehow.  Can anyone suggest what might be up?.
>


Well, I've discovered a couple of these types and have had to add a 
db_set_active('default') when they crop up.  I haven't made the time to 
issue patches though.  This one comes from the 
modules/system/system.module and the system_region_list() API.  You 
need to add that function

<?php
$original = db_set_active('default'); ?>

to the top of the function and

<?php
if ($original) {
db_set_active($original);
}
?>

before returning.  You may run into one or two more.

Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.com/



More information about the support mailing list