Skip to content

Commit

Permalink
Move the check
Browse files Browse the repository at this point in the history
  • Loading branch information
jdarwood007 committed Nov 26, 2023
1 parent 4bd7b43 commit 2face94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
13 changes: 6 additions & 7 deletions Sources/Db/APIs/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -1984,24 +1984,23 @@ protected function __construct(array $options = [])
$this->prefixReservedTables();
}

// For backward compatibility.
if (!is_object(self::$db_connection)) {
self::$db_connection = $this->connection;
}

// At this point, if we don't have a connection, nothing else can be done.
if (empty($this->connection)) {
return;
}

// For backward compatibility.
if (!is_object(self::$db_connection)) {
self::$db_connection = $this->connection;
}

$this->get_version();
$this->supports_pcre = version_compare($this->version, strpos($this->version, 'MariaDB') !== false ? '10.0.5' : '8.0.4', '>=');

// Ensure database has UTF-8 as its default input charset.
$this->query(
'',
'
SET NAMES {string:db_character_set}',
'SET NAMES {string:db_character_set}',
[
'db_character_set' => $this->character_set,
],
Expand Down
10 changes: 5 additions & 5 deletions Sources/Db/APIs/PostgreSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -2112,16 +2112,16 @@ protected function __construct(array $options = [])
ErrorHandler::displayDbError();
}

// For backward compatibility.
if (!is_object(self::$db_connection)) {
self::$db_connection = $this->connection;
}

// At this point, if we don't have a connection, nothing else can be done.
if (empty($this->connection)) {
return;
}

// For backward compatibility.
if (!is_object(self::$db_connection)) {
self::$db_connection = $this->connection;
}

// Ensure database has UTF-8 as its default input charset.
$this->query(
'',
Expand Down

0 comments on commit 2face94

Please sign in to comment.