Allow database API calls to specify database

Created on 9 June 2015, over 9 years ago
Updated 15 September 2024, 3 months ago

Most of the database API functions (db_query, db_select, db_update, db_insert, db_delete, db_merge) are fairly simple wrapper functions that call Database::getConnection(). getConnection() takes two variables - $target and $key - and the API functions allow developers to include one of these ($target) in the $options array. This allows a developer to switch between the default and slave within a cluster, but not name a database to operate on.

Presently the only way to switch between databases is to either call db_set_active() before and after our queries, or perform the getConnection() calls directly. It would be useful to be able to include a $key in the $options array as well, which would be passed directly through to the getConnection() call.

Apologies if this has been raised and discarded before, I had a look through the queue and there didn't seem to be anything immediately obviously connected.

Feature request
Status

Closed: works as designed

Version

11.0 🔥

Component
Database 

Last updated 2 days ago

  • Maintained by
  • 🇳🇱Netherlands @daffie
Created by

🇬🇧United Kingdom kingandy

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024