[drupal-devel] [bug] db_set_active acting strangely/not working

chx drupal-devel at drupal.org
Wed Apr 13 18:53:14 UTC 2005


Issue status update for http://drupal.org/node/20235

 Project:      Drupal
 Version:      cvs
 Component:    database system
 Category:     bug reports
 Priority:     critical
 Assigned to:  chx
 Reported by:  jakeg
 Updated by:   chx
 Status:       patch

"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.




chx



Previous comments:
------------------------------------------------------------------------

April 9, 2005 - 21:50 : jakeg

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.




------------------------------------------------------------------------

April 9, 2005 - 22:09 : jakeg

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.




------------------------------------------------------------------------

April 10, 2005 - 08:57 : jakeg

[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]




------------------------------------------------------------------------

April 11, 2005 - 09:14 : jakeg

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




------------------------------------------------------------------------

April 13, 2005 - 17:39 : chx

Yes. Working on this.




------------------------------------------------------------------------

April 13, 2005 - 19:44 : chx

Attachment: http://drupal.org/files/issues/db_set_active.patch (760 bytes)




------------------------------------------------------------------------

April 13, 2005 - 19:46 : jakeg

legend







More information about the drupal-devel mailing list