abstract protected function mysqlError( $conn = null );
protected function wasQueryTimeout( $error, $errno ) {
- return $errno == 2062;
+ // https://dev.mysql.com/doc/refman/8.0/en/client-error-reference.html
+ // https://phabricator.wikimedia.org/T170638
+ return in_array( $errno, [ 2062, 3024 ] );
}
- /**
- * @param string $table
- * @param array $uniqueIndexes
- * @param array $rows
- * @param string $fname
- */
public function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ ) {
$this->nativeReplace( $table, $rows, $fname );
}
$this->query( $sql, $fname );
}
- /**
- * @param string $table
- * @param array $rows
- * @param array $uniqueIndexes
- * @param array $set
- * @param string $fname
- * @return bool
- */
- public function upsert( $table, array $rows, array $uniqueIndexes,
- array $set, $fname = __METHOD__
+ public function upsert(
+ $table, array $rows, $uniqueIndexes, array $set, $fname = __METHOD__
) {
if ( $rows === [] ) {
return true; // nothing to do
}
// See https://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html
- return in_array( $errno, [ 1022, 1216, 1217, 1137 ], true );
+ return in_array( $errno, [ 1022, 1062, 1216, 1217, 1137, 1146, 1051, 1054 ], true );
}
/**
!preg_match( '/^SELECT\s+(GET|RELEASE|IS_FREE)_LOCK\(/', $sql );
}
+ public function buildStringCast( $field ) {
+ return "CAST( $field AS BINARY )";
+ }
+
/**
* @param string $field Field or column to cast
* @return string