-
Notifications
You must be signed in to change notification settings - Fork 117
Reconnect on lost DB connection #307
base: master
Are you sure you want to change the base?
Conversation
|
|
I will try to add support for other engines soon. I know about unit tests) but when i have written that code i had no idea how to test that functionality) For now i have some ideas, i will try) |
|
Ok, thats fine :) Does seem like a challenge to test! For documentation, I actually meant adding entry into docs/book markdown sources. |
|
Ah, get it) i will add docs about that option to adapter.md |
|
|
||
| return $this; | ||
| } | ||
| } |
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.
Maybe?
- if (! $mysqli->ping()) {
- $mysqli = $this->connection
- ->disconnect()
- ->connect()
- ->getResource();
-
- if ($mysqli->ping()) {
- if ($statement instanceof Statement) {
- $statement->initialize($mysqli);
- }
-
- return $this;
- }
- }
+ if ($mysqli->ping()) {
+ if ($statement instanceof Statement) {
+ $statement->initialize($mysqli);
+ }
+
+ return $this;
+ }
+
+ $mysqli = $this->connection
+ ->disconnect()
+ ->connect()
+ ->getResource();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.
Looks better.
Thank you sir)
|
@tptrixtop we need some unit test for this new feature. Consider that now we have also integration tests available. |
|
Sure, I am now working on same functionality for postgresql, it's almost finished and after i will try add same functionality for MS SQL and i will commit unit tests for all of that changes) |
|
@tptrixtop we still need tests for this feature. |
|
@ezimuel I know sir, i am working on it, right now) |
|
This repository has been moved to laminas/laminas-db. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
|
|
This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at laminas/laminas-db#55. |
This functionality allow to enable & configure reconnect functionality using
optionsparameter in adapter.When you are creating adapter for
mysqli:You can specify
reconnect_triesand if during your work connect will be lost adapter will try automatically reconnect to server.Fix for #302