API page: https://api.drupal.org/api/drupal/includes%21database%21database.inc/fun...
Enter a descriptive title (above) relating to public static function Database::addConnectionInfo, then describe the problem you have found:
For me it wasn't very clear how to use this function in order to add a database at runtime. I was coding a module that needed access to an external database, the documentation led my to believe that I should only use this function once instead of running it again each time the external database is required.
In general I'm finding the database API documentation lacking in info as to when and how functions should be called.
Comment | File | Size | Author |
---|---|---|---|
#14 | 2236983-14.patch | 1.27 KB | quietone |
|
Comments
Comment #1
DenEwout CreditAttribution: DenEwout commentedComment #2
jhodgdonOK. Needs to be fixed in 8.x first, then backported.
Comment #3
dvandusen CreditAttribution: dvandusen commentedThere is more to this.
The problem as I can see from the code is that several modules are involved in the database query that attempt to use the primary default database, and these fail when the default has been changed during the call to, for instance, db_select. To fix that, the call to getConnection from db_select must provide the information needed, without switching out of the connection with the default db.
see https://drupal.org/node/18429#comment-8857521
D
Comment #14
quietone CreditAttribution: quietone at PreviousNext commentedPerhaps adding a sentence and an @see about using setActiveConnection would resolve this.
Comment #15
larowlanComment #16
larowlanAssuming bot agrees
Comment #17
quietone CreditAttribution: quietone at PreviousNext commentedThis is adding documentation, not fixing "incorrect or misleading documentation', so changing to a task.
Comment #20
catchCommitted/pushed to 10.0.x and cherry-picked to 9.4.x, thanks!