3232use Magento \Framework \Stdlib \StringUtils ;
3333use Zend_Db_Adapter_Exception ;
3434use 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