32
32
use Magento \Framework \Stdlib \StringUtils ;
33
33
use Zend_Db_Adapter_Exception ;
34
34
use Zend_Db_Statement_Exception ;
35
- use Magento \Framework \DB \Adapter \SqlVersionProvider ;
36
35
37
36
// @codingStandardsIgnoreStart
38
37
@@ -252,11 +251,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface, Rese
252
251
*/
253
252
private $ parentConnections = [];
254
253
255
- /**
256
- * @var SqlVersionProvider
257
- */
258
- private $ sqlVersionProvider ;
259
-
260
254
/***
261
255
* const MYSQL_8_4_VERSION
262
256
*/
@@ -271,24 +265,21 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface, Rese
271
265
* @param SelectFactory $selectFactory
272
266
* @param array $config
273
267
* @param SerializerInterface|null $serializer
274
- * @param SqlVersionProvider|null $sqlVersionProvider
275
268
*/
276
269
public function __construct (
277
270
StringUtils $ string ,
278
271
DateTime $ dateTime ,
279
272
LoggerInterface $ logger ,
280
273
SelectFactory $ selectFactory ,
281
274
array $ config = [],
282
- SerializerInterface $ serializer = null ,
283
- SqlVersionProvider $ sqlVersionProvider = null
275
+ SerializerInterface $ serializer = null
284
276
) {
285
277
$ this ->pid = getmypid ();
286
278
$ this ->string = $ string ;
287
279
$ this ->dateTime = $ dateTime ;
288
280
$ this ->logger = $ logger ;
289
281
$ this ->selectFactory = $ selectFactory ;
290
282
$ this ->serializer = $ serializer ?: ObjectManager::getInstance ()->get (SerializerInterface::class);
291
- $ this ->sqlVersionProvider = $ sqlVersionProvider ?? ObjectManager::getInstance ()->get (SqlVersionProvider::class);
292
283
$ this ->exceptionMap = [
293
284
// SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
294
285
2006 => ConnectionException::class,
@@ -3083,7 +3074,9 @@ public function startSetup()
3083
3074
$ this ->rawQuery ("SET SQL_MODE='' " );
3084
3075
$ this ->rawQuery ("SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 " );
3085
3076
$ 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 )) {
3087
3080
$ this ->rawQuery ("SET RESTRICT_FK_ON_NON_STANDARD_KEY=0 " );
3088
3081
}
3089
3082
return $ this ;
0 commit comments