Skip to content
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

Add try block in _prepareQuery #793

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

VonHirsch
Copy link
Contributor

@VonHirsch VonHirsch commented Oct 10, 2018

...so that database will reconnect automatically if connection was broken (tested)

if $db->autoReconnect = true the database would reconnect upon the next query but fail to reset() MysqliDb (for example select now() would work after a break in connection, but not queries requiring prepare.)

With the try / catch block MysqliDb will gracefully reconnect if the connection was broken in-between queries and continue to run the query as if nothing happened (LINE)

If the statement is null, it will also try to reconnect (this happens if the server is down and the query has attempted executed one or more times while the connection is down.) (LINE)

TODO: Better fix is to push code checking for reconnect up the stack further before the object is built up which avoids the "piling up" of parameters in the prepared statement as the query retries while the server is down:

e.g. mysqli_stmt->bind_param(string ssississississississississississississississississississississi, ...

@VonHirsch VonHirsch reopened this Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant