11 protected static int $defaultMaxTryCount = 3;
13 protected static function executeDeadlockSafeQuery(
string $sql, ?
int $maxRetryCount =
null):
void
15 $maxRetryCount ??= self::$defaultMaxTryCount;
23 if (self::isDeadlock($e))
30 protected static function retryQuery(
string $sql, ?
int $maxRetryCount =
null):
void
32 $maxRetryCount ??= self::$defaultMaxTryCount;
45 if (self::isDeadlock($e))
48 if ($retryCount >= $maxRetryCount)
59 protected static function prepareFieldsToMinimizeDeadlocks(array $insert, array $uniqueKeys): array
63 foreach ($uniqueKeys as $key)
65 $sortBy[$key] = SORT_ASC;
68 Collection::sortByColumn($insert, $sortBy);
73 protected static function getIndexKey(array $row, array $uniqueKeys):
string
76 foreach ($uniqueKeys as $uniqueKey)
78 $values[] = $row[$uniqueKey];
81 return implode(
'|', $values);
86 return mb_stripos($exception->getMessage(),
'1213') !==
false;
static getConnection($name="")