Implemented support for persistent connections in PDO and mysqli drivers#3515
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.
I'd prefer array_key_exists() over more dangerous ! empty().
There was a problem hiding this comment.
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.
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
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.