[pmwiki-devel] limitation found in ADOdb (and DatabaseStandard)

Ben Stallings Ben at InterdependentWeb.com
Mon Jan 8 15:57:22 CST 2007


Hi, folks.  This is sort of an open letter to Crisses and Marc, but 
anyone else who's using ADOdb (with or without the DatabaseStandard 
recipe) may be interested...

I encountered a problem when connecting multiple simultaneous databases 
with the same username and password, and it appears that the problem is 
in ADOdb itself: it reuses the same connection internally despite having 
two different objects with different properties.

For example, if you're using DatabaseStandard, and if you have the same 
username and password specified in the $Databases variable for 
connections One and Two, and your recipe says
  ADOdbConnect('One');
  ADOdbConnect('Two');
  print_r($DB['One']->MetaTables());
you'll get a list of the tables in database Two!

If you print_r($DB) you'll find that 'One' and 'Two' are separate 
objects with different database names and different query_ids, but the 
same connection_id, so that methods such as MetaTables() consult only 
the last database connected.

The only solution I have found to this problem is to require that admins 
use a different username and password for each database, which causes 
the two objects to have different connection_ids, and everything works 
as it should.  If someone can find another way, I'm eager to hear it! 
:-(  --Ben



More information about the pmwiki-devel mailing list