[development] External database handling

Chris Johnson cxjohnson at gmail.com
Tue Aug 26 12:41:03 UTC 2008


On Fri, Aug 22, 2008 at 12:24 AM, Larry Garfield <larry at garfieldtech.com> wrote:
> On Thursday 21 August 2008 10:21:37 pm Chris Johnson wrote:

>> I'd especially like to chat with the folks working on the DB layer for
>> D7.  It would be nice to provide an interface to allow adding an
>> additional DB programmatically from the contrib module.
>>
>> ..chris
>
> Well hi there! :-)

Heh.  I know who those are on the short list -- just didn't want to
drag anyone into the game involuntarily.  :-)


> What you describe was absolutely an issue in the D6 and earlier DB layer.  The
> new DB layer is still not perfect, but has improved on it in two ways:
>
> 1) The $databases value is always an array.  It can be a flattened array, as
> some layers are optional, but since the installer populates it in the first
> place it will in almost every case already be an array.

This might solve most of the problem.  I haven't used the new D7 layer
yet, so I only made a cursory review of the code.  I didn't notice
that $databases is always an array.  As long as a contrib module can
always say something like $databases['mydatabase'] = ... without
causing errors, I think we may be ok.  It's essentially pushing
another database onto the stack of known databases, and if that will
work without core changes, contrib modules should be able to use the
DB abstraction without resorting to strange code.


> It's still not perfect, though, I agree.  If you have a suggestion for how to
> make the connection management more flexible without hurting performance (it
> is along the critical path, so we have to be careful) please post an issue.
> Just because the mega-patch landed doesn't mean we're done changing things
> yet. :-)

If I see anything else, I'll let you know.  :-)


Regarding Ernst Plüss's comment about watchdog DB logging errors
occurring while other, non-Drupal databases are active:  I could have
sworn I fixed that very problem in a patch to 4.7 core a very long
time ago.  In fact, I'm 99.99% sure I did.  It appears there may be a
regression, although I'm not sure which version of core of Ernst is
referring to here.

Thanks much for the reply, Larry.

..chris


More information about the development mailing list