@@ -251,6 +251,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface, Rese
251251 */
252252 private $ parentConnections = [];
253253
254+ /***
255+ * Get exact version of MySQL
256+ *
257+ * @var string
258+ */
259+ private $ mysqlversion ;
260+
254261 /**
255262 * Constructor
256263 *
@@ -3069,9 +3076,8 @@ public function startSetup()
30693076 $ this ->rawQuery ("SET SQL_MODE='' " );
30703077 $ this ->rawQuery ("SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 " );
30713078 $ this ->rawQuery ("SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' " );
3072-
3073- $ version = $ this ->fetchPairs ("SHOW variables LIKE 'version' " )['version ' ] ?? '' ;
3074- if (str_contains ($ version , '8.4 ' )) {
3079+ $ this ->mysqlversion = $ this ->fetchPairs ("SHOW variables LIKE 'version' " )['version ' ] ?? '' ;
3080+ if ($ this ->isMysql8EngineUsed () && str_contains ($ this ->mysqlversion , '8.4 ' )) {
30753081 $ this ->rawQuery ("SET @OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=@@RESTRICT_FK_ON_NON_STANDARD_KEY " );
30763082 $ this ->rawQuery ("SET RESTRICT_FK_ON_NON_STANDARD_KEY=0 " );
30773083 }
@@ -3087,8 +3093,7 @@ public function endSetup()
30873093 {
30883094 $ this ->rawQuery ("SET SQL_MODE=IFNULL(@OLD_SQL_MODE,'') " );
30893095 $ this ->rawQuery ("SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS=0, 0, 1) " );
3090- $ version = $ this ->fetchPairs ("SHOW variables LIKE 'version' " )['version ' ] ?? '' ;
3091- if (str_contains ($ version , '8.4 ' )) {
3096+ if ($ this ->isMysql8EngineUsed () && str_contains ($ this ->mysqlversion , '8.4 ' )) {
30923097 $ this ->rawQuery ("SET RESTRICT_FK_ON_NON_STANDARD_KEY=IF(@OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=0, 0, 1) " );
30933098 }
30943099 return $ this ;
0 commit comments