Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use the server_version option to define the vendor name #3110

Closed
javiereguiluz opened this issue Apr 16, 2018 · 7 comments
Closed

Don't use the server_version option to define the vendor name #3110

javiereguiluz opened this issue Apr 16, 2018 · 7 comments

Comments

@javiereguiluz
Copy link
Contributor

In this comment: #2985 (comment) you can see that when using MariaDB, the server_version option must include not only the version number but also the vendor name: server_version: 'mariadb-10.2.12' instead of server_version: '10.2.12'.

I wonder if this could be solved differently to keep the vendor name out of the server_version value. Thanks for your time and consideration!

@Ocramius
Copy link
Member

Ocramius commented Apr 16, 2018 via email

@javiereguiluz
Copy link
Contributor Author

I don't use MariaDB (maybe @tristanbes, the original issue reporter, can help us here) but it looks like the version returned by MariaDB follows a different format. According to their official docs (https://mariadb.com/kb/en/library/version/) it would be something like this: 10.0.3-MariaDB-1~precise-log

@tristanbes
Copy link
Contributor

tristanbes commented Apr 17, 2018

I confirm that the format is different:
Connecting to the database via the cli gives something like (but this may differs depending on distributions):

Your MariaDB connection id is 14
Server version: 10.2.14-MariaDB-10.2.14+maria~stretch-log mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

@belgattitude
Copy link
Contributor

belgattitude commented Apr 29, 2018

For the full story: read the first paragraph in #2825 about the mariadb version detection.

MariaDB server returns the version with their vendor name (+ some prefixes or suffixes are added per distributions to handle some replications issues). Their clients 'libmariadb-client', connector/j'... will strip the vendors and prefixes transparently... In other words if you're using jdbc or php compiled with libmariadb-client, you won't see the 'mariadb' vendor.

Some tentatives have been done to strip it in the php src too (like php/php-src#1767... or others I cannot find anymore). But till now we need to strip the prefix in userland.

In DBAL, it's done here:

private function getMariaDbMysqlVersionNumber(string $versionString) : string

And the corresponding test file:
['10.0.15-MariaDB-1~wheezy', MySqlPlatform::class],

@belgattitude
Copy link
Contributor

I like the idea of @Ocramius

What can be done is allowing selection of the platform via class name (I think that might already be possible, jus didn't check).

@javiereguiluz do you think it would be ok ?

@morozov
Copy link
Member

morozov commented Oct 30, 2021

What can be done is allowing selection of the platform via class name (I think that might already be possible, jus didn't check).

Passing a platform is already possible:

dbal/src/Connection.php

Lines 175 to 181 in d3c7081

if (isset($params['platform'])) {
if (! $params['platform'] instanceof Platforms\AbstractPlatform) {
throw Exception::invalidPlatformType($params['platform']);
}
$this->platform = $params['platform'];
}

@morozov morozov closed this as completed Oct 30, 2021
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants