Skip to content

Commit 0b49409

Browse files
committed
AC-11995:Add compatibility with MySQL 8.4 LTS for Magento CE
1 parent a369072 commit 0b49409

File tree

1 file changed

+4
-11
lines changed
  • lib/internal/Magento/Framework/DB/Adapter/Pdo

1 file changed

+4
-11
lines changed

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
use Magento\Framework\Stdlib\StringUtils;
3333
use Zend_Db_Adapter_Exception;
3434
use Zend_Db_Statement_Exception;
35-
use Magento\Framework\DB\Adapter\SqlVersionProvider;
3635

3736
// @codingStandardsIgnoreStart
3837

@@ -252,11 +251,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface, Rese
252251
*/
253252
private $parentConnections = [];
254253

255-
/**
256-
* @var SqlVersionProvider
257-
*/
258-
private $sqlVersionProvider;
259-
260254
/***
261255
* const MYSQL_8_4_VERSION
262256
*/
@@ -271,24 +265,21 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface, Rese
271265
* @param SelectFactory $selectFactory
272266
* @param array $config
273267
* @param SerializerInterface|null $serializer
274-
* @param SqlVersionProvider|null $sqlVersionProvider
275268
*/
276269
public function __construct(
277270
StringUtils $string,
278271
DateTime $dateTime,
279272
LoggerInterface $logger,
280273
SelectFactory $selectFactory,
281274
array $config = [],
282-
SerializerInterface $serializer = null,
283-
SqlVersionProvider $sqlVersionProvider = null
275+
SerializerInterface $serializer = null
284276
) {
285277
$this->pid = getmypid();
286278
$this->string = $string;
287279
$this->dateTime = $dateTime;
288280
$this->logger = $logger;
289281
$this->selectFactory = $selectFactory;
290282
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
291-
$this->sqlVersionProvider = $sqlVersionProvider ?? ObjectManager::getInstance()->get(SqlVersionProvider::class);
292283
$this->exceptionMap = [
293284
// SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
294285
2006 => ConnectionException::class,
@@ -3083,7 +3074,9 @@ public function startSetup()
30833074
$this->rawQuery("SET SQL_MODE=''");
30843075
$this->rawQuery("SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0");
30853076
$this->rawQuery("SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'");
3086-
if (str_contains($this->sqlVersionProvider->getSqlVersion(), self::MYSQL_8_4_VERSION)) {
3077+
3078+
$version = $this->fetchPairs("SHOW variables LIKE 'version'")['version'] ?? '';
3079+
if (str_contains($version, self::MYSQL_8_4_VERSION)) {
30873080
$this->rawQuery("SET RESTRICT_FK_ON_NON_STANDARD_KEY=0");
30883081
}
30893082
return $this;

0 commit comments

Comments
 (0)