Skip to content

Commit f554229

Browse files
committed
MC-14884: MySQL Upgrade - v8
1 parent 9a69e0d commit f554229

File tree

1 file changed

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

1 file changed

+11
-10
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
135135
protected $_isDdlCacheAllowed = true;
136136

137137
/**
138-
* MySQL version(MySQL-8, MySQL-5.7, MariaDB)
138+
* Save if mysql engine is 8 or not.
139139
*
140-
* @var string
140+
* @var bool
141141
*/
142-
private $dbVersion;
142+
private $isMysql8Engine;
143143

144144
/**
145145
* MySQL column - Table DDL type pairs
@@ -1196,7 +1196,7 @@ public function showTableStatus($tableName, $schemaName = null)
11961196
}
11971197
$query = sprintf('SHOW TABLE STATUS%s LIKE %s', $fromDbName, $this->quote($tableName));
11981198
//checks which slq engine used
1199-
if (!preg_match('/^(8\.)/', $this->isMysql8EngineUsed())) {
1199+
if (!$this->isMysql8EngineUsed()) {
12001200
//if it's not MySQl-8 we just fetch results
12011201
return $this->rawFetchRow($query);
12021202
}
@@ -1209,17 +1209,18 @@ public function showTableStatus($tableName, $schemaName = null)
12091209
}
12101210

12111211
/**
1212-
* Get database version.
1212+
* Checks if the engine is mysql 8
12131213
*
1214-
* @return string
1214+
* @return bool
12151215
*/
1216-
private function isMysql8EngineUsed(): string
1216+
private function isMysql8EngineUsed(): bool
12171217
{
1218-
if (!$this->dbVersion) {
1219-
$this->dbVersion = $this->fetchPairs("SHOW variables LIKE 'version'")['version'];
1218+
if (!$this->isMysql8Engine) {
1219+
$version = $this->fetchPairs("SHOW variables LIKE 'version'")['version'];
1220+
$this->isMysql8Engine = (bool) preg_match('/^(8\.)/', $version);
12201221
}
12211222

1222-
return $this->dbVersion;
1223+
return $this->isMysql8Engine;
12231224
}
12241225

12251226
/**

0 commit comments

Comments
 (0)