-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
How to get driver version in dbal 3.x #5026
Comments
You can use use But be wary of #4966 |
That sounds.. fragile at best. Is there another recommended way to get the driver name / client version, that we might not be aware of? |
What is the use case where you need the client version and what is it in the context of the DBAL? |
The 2 first seem to be about giving info about the current installation in CLI or via HTTP (hopefully the latter one is only available on the dev env, otherwise it's a security issue). That should be obtained form application configuration as pointed out in #4086. The 2 last seem to be 2 hacks about executing different SQL functions based on the platform such as |
You have to be logged in as a user with administration privileges to see this, yes.
If you have suggestions on how we could do these things better in a platform-agnostic way, we're all ears 😇 |
I don't, sorry, but you could migrate to |
I see that there has been a lot of information exchange on how to make the code work the same as it used to with 2.x but I still don't understand what problem you're trying to solve. Let's pause a little bit and discuss the problem, please. |
@morozov We're tyring to get details about the current connection. We do this for two reasons:
|
@bobdenotter could you be more specific? For instance, you know that the user uses a PDO MySQL driver version x.y.z. How do you use this information? How is it different than if they were using version a.b.c? |
@morozov Bolt is a CMS, so our users are not always that tech savvy. Being able to ask them "Run Also, even if the user knows, that doesn't help in making a piece of functionality work that has a different syntax on different DB platforms. |
A library or application that uses DBAL for a unified database access still needs to produce SQL statements that the database it is connected to understands. While standard SQL works for many tasks just fine, there are situations where knowing the database vendor and server version is imperative for emitting the correct SQL statements. DBAL internally uses the concept of platform classes to compensate for the differences among SQL dialects. So in a way, we already acknowledge that the concern exists. I don't see much harm in allowing a library or application to query information on the database engine and version through a stable and standardized interface. |
@derrabus are you answering me or the author of the issue? How is the SQL portability related to the driver version? I don't see a problem in introducing an API for that, I'm asking how it's expected to be used and what data it should return. @bobdenotter I haven't gotten an answer to my question, so I cannot help you. BTW, you can get access to the underlying PDO connection via |
I'm throwing in my thoughts on topic. 🙂
It isn't. You need database engine and server version for this and this is part of what is being queried in the code snippet the OP shared. Getting the server version is also becoming harder if we deprecate I have no strong opinions on the driver version, really. |
for that, the right approach is to check the database platform, not the wrapped connection |
Closing as there's no understanding of what problem the requested feature is supposed to solve, nor how exactly it's expected to work. It is still possible to have the behavior of DBAL 2.x by using the native connection. |
Sorry to read this issue is getting closed without resolution.. I'm not sure how i can explain any more clear what our usecase is.. :-/ |
@bobdenotter the resolution is not to implement any additional API in the DBAL. It is still possible to get the PDO-specific details of the connection via |
@morozov Ah, thanks! That will be available when |
@bobdenotter yes, right. |
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. |
Hey! I'm trying to get the driver name, client version and server version of a connection. In dbal 2.x, this used to be possible as used here:
https://github.com/bolt/core/blob/master/src/Doctrine/Version.php#L29-L48
But, since the deprecation of PDOConnection, that no longer works. What's the proper way of making this work with 3.x?
Thanks!
The text was updated successfully, but these errors were encountered: