joomla-framework / database

Joomla Framework Database Package
GNU General Public License v2.0
28 stars 34 forks source link

[3.x] Get database server version from database so it works also with ProxySQL #312

Open richard67 opened 4 weeks ago

richard67 commented 4 weeks ago

Pull Request for Issue #309

Summary of Changes

This pull request (PR) changes the getVersion methods of the "MySQLi" and "MySQL (PDO)" drivers so that they select the version from the database after the first connection instead of relying on the connection's server_info in case of "MySQLi" or PDO::ATTR_SERVER_VERSION in case of "MySQL (PDO)".

The result is cached in a protected class variable so that the database query is only executed at the very first connection of the particular driver instance.

This makes it possible to use ProxySQL for a Joomla 5.x installation.

Testing Instructions

With ProxySQL see issue #309 .

Otherwise (without ProxySQL) check that the version returned by getVersion() is the same as without this PR for the same database, e.g. something like "10.11.7-MariaDB-log" for MariaDB or "8.0.39-0ubuntu0.22.04.1" for MySQL databases.

Documentation Changes Required

None.