-
-
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
Call detectDatabasePlatform
only once
#781
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DBAL-1127 We use Jira to track the state of pull requests and the versions they got |
@rosier requires a test case |
@@ -1597,7 +1593,7 @@ public function ping() | |||
} | |||
|
|||
try { | |||
$this->query($this->platform->getDummySelectSQL()); | |||
$this->query($this->getDatabasePlatform()->getDummySelectSQL()); |
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.
Why is this change necessary? Connection::ping()
calls Connection::connect()
as the beginning, so it ensures the platform is set.
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.
The platform isn't set anymore in connect()
with this PR.
In the current version of Connection
the following calls are triggered:
getDatabasePlatform()
=> detectDatabasePlatform()
=> getDatabasePlatformVersion()
=> connect()
at this point because the platform isn't set yet connect()
calls detectDatabasePlatform()
again.
This PR removes the call to detectDatabasePlatform()
from connect()
to stop that from happening.
@Ocramius |
@rosier try looking at the wrapped driver: that one can be mocked |
Call detectDatabasePlatform only once fixes #1068
detectDatabasePlatform
only once
Database platform detection is triggered twice if
Doctrine/DBAL/Connection::getDatabasePlatform()
is called beforeDoctrine/DBAL/Connection::connect()