@@ -251,6 +251,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface, Rese
251
251
*/
252
252
private $ parentConnections = [];
253
253
254
+ /***
255
+ * Get exact version of MySQL
256
+ *
257
+ * @var string
258
+ */
259
+ private $ mysqlversion ;
260
+
254
261
/**
255
262
* Constructor
256
263
*
@@ -3069,9 +3076,8 @@ public function startSetup()
3069
3076
$ this ->rawQuery ("SET SQL_MODE='' " );
3070
3077
$ this ->rawQuery ("SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 " );
3071
3078
$ 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 ' )) {
3075
3081
$ this ->rawQuery ("SET @OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=@@RESTRICT_FK_ON_NON_STANDARD_KEY " );
3076
3082
$ this ->rawQuery ("SET RESTRICT_FK_ON_NON_STANDARD_KEY=0 " );
3077
3083
}
@@ -3087,8 +3093,7 @@ public function endSetup()
3087
3093
{
3088
3094
$ this ->rawQuery ("SET SQL_MODE=IFNULL(@OLD_SQL_MODE,'') " );
3089
3095
$ 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 ' )) {
3092
3097
$ this ->rawQuery ("SET RESTRICT_FK_ON_NON_STANDARD_KEY=IF(@OLD_RESTRICT_FK_ON_NON_STANDARD_KEY=0, 0, 1) " );
3093
3098
}
3094
3099
return $ this ;
0 commit comments