- Issue created by @hkirsman
- 🇬🇧United Kingdom longwave UK
Personally I have some interest in this feature as we have customers on Aurora and this may benefit them but I would have to do some benchmarking to be sure.
However from a core point of view this is likely to be too specific to be included in Drupal core. This sort of thing is better off maintained in contrib as an Aurora-specific extension of the MySQL driver where this (and any other Aurora related features) would be better maintained and managed.
- 🇪🇪Estonia ragnarkurm
@longwave, so you mean to create and maintain it as a contrib module? I see it can be done, because currently, MySQL driver is also a module, a core module. The core module can be extended, and only relevant parts overridden. It can be done almost perfectly.
However, I'm not sure if a custom module can be loaded in the early stages of bootstrap before the database connection is established.
- 🇪🇪Estonia hkirsman
Looking at some other core db modules was the reason I went with patching. I'm hoping for some core expert to say how to properly extend mysql module.
- 🇪🇪Estonia ragnarkurm
Meanwhile, I checked that the condition for loading the custom database driver is the following:
- The driver is installed via Composer (so it's in the autoload paths, it does not even need to be a module)
- Is configured in
settings.php
with the correct driver and namespace
For extending MySQL driver:
- Create and classes with the same name as in MySQL driver
- Extend all classes from MySQL driver classes
- For affected methods create "wrappers" method which allows to prepend/append custom functionality
- 🇮🇹Italy mondrake 🇮🇹
Hi, you may want to check out https://www.drupal.org/node/3123251 → and https://www.drupal.org/node/3258175 → for the CRs that introduced db drivers as extensions/modules.
Also, 📌 Create the database driver for MySQLi for async queries Active is a WIP issue that means to introduce a new db driver that inherits from core's MySql one.
https://www.drupal.org/project/mysql57 → is a contrib driver extending from core MySql.
- 🇪🇪Estonia hkirsman
Regarding mysql57 - setting.inc is some magic file that is included https://git.drupalcode.org/project/mysql57/-/blob/1.0.x/settings.inc?ref... ?