Skip to content

Commit

Permalink
Merge pull request #8656 from kenjis/add-comments-to-PDO_PGSQL-DSN
Browse files Browse the repository at this point in the history
docs: add commnets on Postgre::convertDSN()
  • Loading branch information
kenjis authored Mar 28, 2024
2 parents 2a63810 + 2636541 commit 87652c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions system/Database/Postgre/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public function connect(bool $persistent = false)
}

// Convert DSN string
// @TODO This format is for PDO_PGSQL.
// https://www.php.net/manual/en/ref.pdo-pgsql.connection.php
// Should deprecate?
if (mb_strpos($this->DSN, 'pgsql:') === 0) {
$this->convertDSN();
}
Expand Down
3 changes: 3 additions & 0 deletions tests/system/Database/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ public function testConnectionGroupWithDSNPostgreNative(): void
*/
public function testConvertDSN(string $input, string $expected): void
{
// @TODO This format is for PDO_PGSQL.
// https://www.php.net/manual/en/ref.pdo-pgsql.connection.php
// Should deprecate?
$this->dsnGroupPostgreNative['DSN'] = $input;
$conn = Config::connect($this->dsnGroupPostgreNative, false);
$this->assertInstanceOf(BaseConnection::class, $conn);
Expand Down

0 comments on commit 87652c9

Please sign in to comment.