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

marc gmane at auxbuss.com
Tue Jan 9 03:39:23 CST 2007


Ben Stallings said...
> 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! 

I can confirm this. Plus, using the OO Database Standard ;-) the same 
problem occurs with:

  $db = ADOdbConnect('localdb');
  $db2 = ADOdbConnect('testdb');
  print_r($db->MetaTables());

as well as,

  $db = ADOdbConnect('localdb');
  $db2 = ADOdbConnect('testdb');
  print_r($DB['localdb']->MetaTables());

since I support this method.

Nevertheless, this strikes me as a bug - although not one I can imagine 
encountering - so why not call it in to John. He's usually receptive to 
bugs. Better still if you have a fix for him.

-- 
Cheers,
Marc




More information about the pmwiki-devel mailing list