Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Fixed bug that caused the PDO to throw an invalid keyword error #5069

Merged
merged 1 commit into from
Dec 3, 2013
Merged

Fixed bug that caused the PDO to throw an invalid keyword error #5069

merged 1 commit into from
Dec 3, 2013

Conversation

brian978
Copy link
Contributor

@brian978 brian978 commented Sep 3, 2013

Without the special case for the sqlsrv driver a PDOException with the following message is thrown: SQLSTATE[IMSSP]: An invalid keyword 'dbname' was specified in the DSN string.

@EvanDotPro
Copy link
Member

This is another case where we really need some tests, but this particular class wasn't really written to be easily testable, unfortunately. :-/

We need to figure out if we're going to accept PR's without tests in this case or try to make the class a bit more testable.

@brian978
Copy link
Contributor Author

brian978 commented Sep 6, 2013

We could test up to the point where it cannot connect to the server. Basically the test would check for the issue that is being fixed by the PR.

I was thinking something like this

/**
 * @expectedException \PDOException
 * @expectedExceptionMessage Could not open a connection to SQL Server
 */
public function testDoesNotCauseInvalidKeywordException()
{
    $this->connection->setConnectionParameters(
        array(
            'driver' => 'Pdo_Sqlsrv',
            'database' => 'testdb',
            'username' => 'testname',
            'password' => 'testpass',
            'hostname' => 'testhost',
        )
    );

    try {
        $this->connection->connect();
    } catch(AdapterRuntimeException $e) {
        throw $e->getPrevious();
    }
}

@ralphschindler
Copy link
Member

I'll be looking into supporting SQL Server via PDO, which we currently don't.
I'll also take that opportunity to make integration tests for PDO (similar to those in Db2 and Sqlsrv driver tests).

ralphschindler pushed a commit that referenced this pull request Dec 3, 2013
Merge branch 'fix/zend-db-adapter-driver-pdo' of git://github.com/brian978/zf2 into brian978-fix/zend-db-adapter-driver-pdo

* 'fix/zend-db-adapter-driver-pdo' of git://github.com/brian978/zf2:
  Fixed bug that caused the PDO to throw an invalid keyword error
ralphschindler pushed a commit that referenced this pull request Dec 3, 2013
Merge branch 'brian978-fix/zend-db-adapter-driver-pdo' into develop

* brian978-fix/zend-db-adapter-driver-pdo:
  Added some integration tests for PDO driver Statement & Connection class
  Fixed bug that caused the PDO to throw an invalid keyword error
@ralphschindler ralphschindler merged commit 0d89e4c into zendframework:develop Dec 3, 2013
@brian978 brian978 deleted the fix/zend-db-adapter-driver-pdo branch January 4, 2014 10:53
@ralphschindler ralphschindler self-assigned this Mar 11, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants