Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres fix for a possible unavailable dbname #307

Merged
merged 2 commits into from
May 4, 2013

Conversation

antonioribeiro
Copy link
Contributor

No description provided.

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DBAL-499

We use Jira to track the state of pull requests and the versions they got
included in.

@@ -65,6 +65,10 @@ public function getName()
public function getDatabase(\Doctrine\DBAL\Connection $conn)
{
$params = $conn->getParams();
return $params['dbname'];

if (isset($params['dbname'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return (isset($params['dbname']))
    ? $params['dbname']
    : $conn->query('SELECT CURRENT_DATABASE()')->fetchColumn();

@antonioribeiro
Copy link
Contributor Author

@guilhermeblanco, I saw it was solved before and copied the code from Doctrine/DBAL/Driver/PDOMySql/Driver.php and decided to let them be similar in coding style:

    public function getDatabase(\Doctrine\DBAL\Connection $conn)
    {
        $params = $conn->getParams();

        if (isset($params['dbname'])) {
            return $params['dbname'];
        }
        return $conn->query('SELECT DATABASE()')->fetchColumn();
    }

Should I change both, keep mine or just change mine?

@beberlei
Copy link
Member

@antonioribeiro we update the code to our new style step by step, please change the code.

beberlei added a commit that referenced this pull request May 4, 2013
Postgres fix for a possible unavailable dbname
@beberlei beberlei merged commit 873b952 into doctrine:master May 4, 2013
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants