Skip to content

Commit

Permalink
Fixed an error that mostly occurs when running a heavy mysql backups/…
Browse files Browse the repository at this point in the history
…dumps at night.
  • Loading branch information
GregaMohorko committed May 1, 2019
1 parent bc1235d commit c513227
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/BlueDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* Bootstrap file for BlueDB library.
*
* Version 1.2.7.1
* Version 1.2.9.0
*
* @project BlueDB
* @author Grega Mohorko <[email protected]>
Expand Down
7 changes: 7 additions & 0 deletions src/DataAccess/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,13 @@ public static function prepareAndExecuteStatement($sqlPreparedStatement,$paramet

// execute
if(!$stmt->execute()){
if($stmt->errno==1615){
// prepared statement needs to be re-prepared
// this mostly occurs when running heavy mysql backups/dumps at night
// wait 50 milliseconds and try again
usleep(50000);
return self::prepareAndExecuteStatement($sqlPreparedStatement, $parameters);
}
throw new Exception("Error while executing prepared statement '".$sqlPreparedStatement."': [".$stmt->errno."] ".$stmt->error,$stmt->errno);
}

Expand Down
2 changes: 1 addition & 1 deletion src/IO/JSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static function toArray($entities,$fieldsToIgnore=null, $includeHiddenFie
}
if(!is_array($entities)){
// is a single entity
/* @var $fieldsToIgnore FieldEntity */
/* @var $entities FieldEntity */
return $entities->toArray($fieldsToIgnore,$includeHiddenFields);
}
return FieldEntity::toArrayList($entities, $fieldsToIgnore,$includeHiddenFields);
Expand Down

0 comments on commit c513227

Please sign in to comment.