-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Implemented support for persistent connections in PDO and mysqli drivers #3515
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
Conversation
fd54f77 to
f1968bb
Compare
|
At the moment, I don't see a reliable way to test the persistence of a connection across supported platforms/drivers. In pseudo-code, a test may look like following: $conn = connect($persistent = false);
$id1 = $conn->id;
$conn = connect($persistent = true);
$id2 = $conn->id;
assertNotEquals($id1, $id2);
$conn = connect($persistent = true);
$id3 = $conn->id;
assertEquals($id2, $id3);The results are:
|
|
Can we at least test that persistent connection flag is active when |
dcf863c to
773bd02
Compare
Good idea. Done.
If we use the |
773bd02 to
b98d1d2
Compare
| $dbname = $params['dbname'] ?? ''; | ||
| $host = $params['host']; | ||
|
|
||
| if (! empty($params['persistent'])) { |
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 prefer array_key_exists() over more dangerous ! empty().
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.
In this case it's irrelevant. array_key_exists() over a mistyped key will have the same effect.
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'm thinking of introducing a ConnectionParameters object which will be just a typed structure which will also contain username and password if they are specified. It could avoid optional $username and $pasword in driver/connection methods. Any suggestions/ideas?
b98d1d2 to
3bcfe82
Compare
3bcfe82 to
987c247
Compare
987c247 to
c8ae09c
Compare
jwage
left a comment
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.
Nice! quick and easy win 👍
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
|
Hi, @morozov, can you please backport this fix to upcoming 2.9.3 or 2.10.0? |
|
No, it depends on #3080 which is a breaking change. |
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
Implemented support for persistent connections in PDO and mysqli drivers
As of #3080, DBAL doesn't use a custom PDO statement class which enables the use of persistent connections with PDO drivers. Additionally, the support for persistent connections has been implemented for the
mysqlidriver.