-
-
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
retrieve version from query. #2539
Conversation
…you get Dbal Connection from a laravel connection
Can you explain the usecase a bit more for those of us whom have never touched laravel? Also i am guessing "version()" does not exist on all platforms and/or agree on the return format, so your proposed solution is a nogo. |
Ok. When the connection is native PHP \PDO, it won't detect the version. |
I could add mysql testing so, I could have if ($this->_conn instanceof \PDO && $this->_conn->getAttribute(PDO::ATTR_DRIVER_NAME)==='mysql') {
try {
return $this->_conn->query('select version()')->fetchColumn();
} catch (\PDOException $e) {
//version query not supported
}
} |
If you provide doctrine with a Can you eventually demonstrate the issue with a failing test case? We don't merge anything that is not coming with corresponding test cases, sorry... |
if ($this->_conn instanceof \PDO && $this->_conn->getAttribute(PDO::ATTR_DRIVER_NAME)==='mysql') { | ||
try { | ||
return $this->_conn->query('select version()')->fetchColumn(); | ||
} catch (\PDOException $e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather have a failure here, since it's mysql, and yet something is going horribly wrong. This catch
block should go away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense to make tests for my own code. My problem was that when wrapping a PDO Connection of MySql , getDatabasePlatformVersion
returns null. Looking more into the code I see there is a requiresQueryForServerVersion
mechanism but for PDO this method return false.
I'll dig more into this problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you just described is what should be formalized into a test case.
Probably obsolete as of #4115. |
This is needed when you expecially when you get Dbal Connection from a laravel connection