From 66abb39f392c233889d329390075f35a92327c48 Mon Sep 17 00:00:00 2001 From: mieszkou Date: Wed, 25 Sep 2024 00:09:35 +0200 Subject: [PATCH 1/2] fix: no port in sqlsrv connection string --- src/Db/Core.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Db/Core.php b/src/Db/Core.php index 7cfd503..b97e355 100644 --- a/src/Db/Core.php +++ b/src/Db/Core.php @@ -193,6 +193,9 @@ protected function dsn(): string $dsn = "sqlite:$dbname"; } elseif ($dbtype === 'sqlsrv') { $dsn = $dbtype . ":Server=" . $this->config('host'); + if ($this->config('port')) { + $dsn .= "," . $this->config('port'); + } $dsn .= ";Database=" . $this->config('database'); } else { $dsn = "$dbtype:host=$host"; From 332949f83994fd6c54e495042928bb77daee70ac Mon Sep 17 00:00:00 2001 From: mieszkou Date: Wed, 25 Sep 2024 01:00:24 +0200 Subject: [PATCH 2/2] fix: wrong variable name for dbname in sqlsrv --- src/Db/Core.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Db/Core.php b/src/Db/Core.php index b97e355..e9c3356 100644 --- a/src/Db/Core.php +++ b/src/Db/Core.php @@ -196,7 +196,7 @@ protected function dsn(): string if ($this->config('port')) { $dsn .= "," . $this->config('port'); } - $dsn .= ";Database=" . $this->config('database'); + $dsn .= ";Database=" . $this->config('dbname'); } else { $dsn = "$dbtype:host=$host";