diff --git a/Sources/Db/APIs/MySQL.php b/Sources/Db/APIs/MySQL.php index 49cd8706e83..02610fb2d8f 100644 --- a/Sources/Db/APIs/MySQL.php +++ b/Sources/Db/APIs/MySQL.php @@ -2020,8 +2020,11 @@ protected function __construct(array $options = []) $this->prefixReservedTables(); } - $this->get_version(); - $this->supports_pcre = version_compare($this->version, strpos($this->version, 'MariaDB') !== false ? '10.0.5' : '8.0.4', '>='); + if (empty($this->connection) && !$non_fatal) + { + $this->get_version(); + $this->supports_pcre = version_compare($this->version, strpos($this->version, 'MariaDB') !== false ? '10.0.5' : '8.0.4', '>='); + } // For backward compatibility. if (!is_object(self::$db_connection)) { @@ -2029,14 +2032,15 @@ protected function __construct(array $options = []) } // Ensure database has UTF-8 as its default input charset. - $this->query( - '', - ' - SET NAMES {string:db_character_set}', - [ - 'db_character_set' => $this->character_set, - ], - ); + if (empty($this->connection) && !$non_fatal) + $this->query( + '', + ' + SET NAMES {string:db_character_set}', + [ + 'db_character_set' => $this->character_set, + ], + ); } /**