As per my forum posting at http://drupal.org/node/20211 , db_set_active isn't working, and is in fact acting extremely strangely. I've never used it before, so maybe I'm using it wrong, but I've looked at the contributed drupal docs and I believe I have the correct usage.

See http://drupal.org/node/20211 for details.

Jake.

CommentFileSizeAuthor
#5 db_set_active.patch760 byteschx

Comments

jakeg’s picture

This problem persists and hence is not related to my other problem I had concurrently (http://drupal.org/node/20233) which has now been resolved for me.

jakeg’s picture

[GRRRRR... I just posted a long explanation of this problem only to get Terminated request because of suspicious input data., and when I pressed the back button my response was gone. Damn it!!! That took about half an hour to write and I don't have time to write it all again now]

jakeg’s picture

some more detail:

settings.php:

...
$db_url['default'] = 'mysql://[snip]@localhost/local_aspodrupal';
$db_url['depletion'] = 'mysql://[snip]@localhost/local_aspo';
...

mymodule.module:

...
// Switch to the depletion database to perform some queries
db_set_active('depletion');
// [run a query on my custom db, or even do nothing and i still have the problem]
// switch back to the default drupal database
db_set_active('anything-but-default');
...

... the code above works, but the last line should be, as far as I can understand, db_set_active('default'), but that causes errors. If I ue anything-but-default then it works.

Jake

chx’s picture

Assigned: Unassigned » chx

Yes. Working on this.

chx’s picture

StatusFileSize
new760 bytes
jakeg’s picture

legend

chx’s picture

If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. The new_link parameter modifies this behavior and makes mysql_connect() always open a new link, even if mysql_connect() was called before with the same parameters.

So, two calls to the same server had only resource ID instead of two. This is corrected.

dries’s picture

Committed to HEAD and DRUPAL-4-6. Thanks.

Anonymous’s picture