Postgres fix for a possible unavailable dbname #307

Merged
merged 2 commits into from May 4, 2013

3 participants

@antonioribeiro

No description provided.

@doctrinebot

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.

@guilhermeblanco guilhermeblanco commented on an outdated diff Apr 19, 2013
lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
@@ -65,6 +65,10 @@ public function getName()
public function getDatabase(\Doctrine\DBAL\Connection $conn)
{
$params = $conn->getParams();
- return $params['dbname'];
+
+ if (isset($params['dbname'])) {
@guilhermeblanco
Doctrine member
return (isset($params['dbname']))
    ? $params['dbname']
    : $conn->query('SELECT CURRENT_DATABASE()')->fetchColumn();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@antonioribeiro antonioribeiro referenced this pull request in JeffreyWay/Laravel-4-Generators Apr 19, 2013
Closed

Fix for custom table names #56

@antonioribeiro

@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
Doctrine member

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

@beberlei beberlei merged commit 873b952 into doctrine:master May 4, 2013

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment