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

Merged
merged 1 commit into from Dec 3, 2013

Conversation

Projects
None yet
3 participants
@brian978
Contributor

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

This comment has been minimized.

Show comment Hide comment
@EvanDotPro

EvanDotPro Sep 4, 2013

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.

Member

EvanDotPro commented Sep 4, 2013

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

This comment has been minimized.

Show comment Hide comment
@brian978

brian978 Sep 6, 2013

Contributor

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();
    }
}
Contributor

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

This comment has been minimized.

Show comment Hide comment
@ralphschindler

ralphschindler Nov 15, 2013

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).

Member

ralphschindler commented Nov 15, 2013

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 added a commit that referenced this pull request Dec 3, 2013

Merging PR #5069
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 added a commit that referenced this pull request Dec 3, 2013

Merging PR #5069 into develop
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

1 check passed

default The Travis CI build passed
Details

@brian978 brian978 deleted the brian978:fix/zend-db-adapter-driver-pdo branch Jan 4, 2014

@ralphschindler ralphschindler self-assigned this Mar 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment