php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74155 Ability to get parsed DSN
Submitted: 2017-02-23 11:46 UTC Modified: 2017-10-24 08:32 UTC
Votes:11
Avg. Score:4.4 ± 0.5
Reproduced:8 of 9 (88.9%)
Same Version:5 (62.5%)
Same OS:5 (62.5%)
From: sam at rmcreative dot ru Assigned:
Status: Open Package: PDO related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sam at rmcreative dot ru
New email:
PHP Version: OS:

 

 [2017-02-23 11:46 UTC] sam at rmcreative dot ru
Description:
------------
DSN string is currently parsed internally but isn't exposed via public API. It would be especially useful for database backup tools, migrations etc. where it's important to get database name, username etc.

Test script:
---------------
$connection = new PDO('mysql:host=localhost;dbname=test', $user, $password);

// mysql
echo $connection->getDriverName();

// localhost
echo $connection->getParameter('host');

// test
echo $connection->getParameter('dbname');



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-24 08:32 UTC] kalle@php.net
-Package: PDO Core +Package: PDO related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 16:01:27 2019 UTC