Commit 07aac87a authored by Tim Schoondergang's avatar Tim Schoondergang

Merge branch...

Merge branch '19-errorno-1205-1047-en-1156-laten-switchen-naar-andere-server-na-5-pogingen-2' into 'master'

Resolve "errorno = 1205,1047 en 1156 laten switchen naar andere server na 5 pogingen"

Closes #19

See merge request !35
parents f862ee66 2f15d5de
{
"name": "timmit/db-mysql",
"description": "A simple DB layer in PHP for using MySQL(i)",
"version": "v4.2.1",
"version": "v4.3.0",
"keywords": ["DB", "MySQL", "MySQLi", "database", "DB layer", "database layer"],
"license": "MIT",
"homepage": "http://www.TiMMiT.nl/",
......
......@@ -212,13 +212,21 @@ class DB
{
self::addToStats(__FUNCTION__);
if ($writeNode) {
$link = self::$mlinkWrite;
$mlink = self::$mlinkWrite;
} else {
$link = self::$mlink;
$mlink = self::$mlink;
}
if (is_null($link) || !@mysqli_ping($link)) {
if (is_null($mlink)) {
return false;
}
$result = mysqli_query($mlink, 'SELECT 1;');
if (!$result) {
$errorno = mysqli_errno($mlink);
if (!empty($errorno)) {
return false;
}
}
return true;
}
......@@ -262,7 +270,12 @@ class DB
break;
case 2006:
case 1047:
case 1156:
case 1205:
if ($count >= self::$max_goneaway_count && $write) {
$write = false;
$count = 0;
}
if ($count < self::$max_goneaway_count) {
self::disconnect();
$count++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment