- Bugfixes done on MySQL adapter caused by some changes while adding Mssql.
- WIP on Repository and QueryBuilder
This commit is contained in:
1 parent
d12623cc5e
commit
8e91c3a418
7 files changed
+32
-21
No files matched your search
+8
-12
@@ -16,11 +16,11 @@ class MySQL implements AdapterInterface {
|
||||
|
||||
public string $password;
|
||||
|
||||
public string $charset;
|
||||
public string $charset = "utf8mb4";
|
||||
|
||||
public string $unixSocket;
|
||||
public ? string $socket;
|
||||
|
||||
public int $port;
|
||||
public int $port = 3306;
|
||||
|
||||
public function __construct(
|
||||
?string $hostname = null,
|
||||
@@ -74,8 +74,8 @@ class MySQL implements AdapterInterface {
|
||||
|
||||
public function buildDataSourceName() : string
|
||||
{
|
||||
if ( false !== ($this->unixSocket ?? false) ) {
|
||||
|
||||
if ( false !== ($this->socket ?? false) ) {
|
||||
$parts[] = "unix_socket={$this->socket}";
|
||||
}
|
||||
else {
|
||||
$parts[] = "host={$this->hostname}";
|
||||
@@ -87,10 +87,6 @@ class MySQL implements AdapterInterface {
|
||||
|
||||
$parts[] = "dbname={$this->database}";
|
||||
|
||||
if ( $this->socket ?? false ) {
|
||||
$parts[] = "socket={$this->socket}";
|
||||
}
|
||||
|
||||
if ( $this->charset ?? false ) {
|
||||
$parts[] = "charset={$this->charset}";
|
||||
}
|
||||
@@ -100,11 +96,11 @@ class MySQL implements AdapterInterface {
|
||||
|
||||
public function setup(array $configuration) : void
|
||||
{
|
||||
$configuration = array_change_key_case($configuration, \CASE_LOWER);
|
||||
$connection = array_change_key_case($configuration, \CASE_LOWER);
|
||||
|
||||
# Either Unix Socket is used, or Host / Port
|
||||
if ( false !== ( $this->unixSocket = $connection['unix_socket'] ?? false ) ) {
|
||||
if ( false === ( $this->hostname = $connection['host'] ?? false ) ) {
|
||||
if ( null === ( $this->socket = $connection['socket'] ?? null ) ) {
|
||||
if ( "" === ( $this->hostname = $connection['host'] ?? "" ) ) {
|
||||
throw new AdapterConfigurationException("Your `host` name is missing from your configuration array");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user