Commit 3e3dc3f2 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2604 from deeky666/DBAL-2595

[DBAL-2595] Fix retrieving last insert ID for FQN sequence name with OCI8
parents 9af1743a 4da603c9
......@@ -151,8 +151,6 @@ class OCI8Connection implements Connection, ServerInfoAwareConnection
return false;
}
OraclePlatform::assertValidIdentifier($name);
$sql = 'SELECT ' . $name . '.CURRVAL FROM DUAL';
$stmt = $this->query($sql);
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
......
<?php
namespace Doctrine\Tests\DBAL\Functional\Driver\OCI8;
use Doctrine\DBAL\Driver\OCI8\Driver;
use Doctrine\Tests\DbalFunctionalTestCase;
class OCI8ConnectionTest extends DbalFunctionalTestCase
{
/**
* @var \Doctrine\DBAL\Driver\OCI8\OCI8Connection
*/
protected $driverConnection;
protected function setUp()
{
if (! extension_loaded('oci8')) {
$this->markTestSkipped('oci8 is not installed.');
}
parent::setUp();
if (! $this->_conn->getDriver() instanceof Driver) {
$this->markTestSkipped('oci8 only test.');
}
$this->driverConnection = $this->_conn->getWrappedConnection();
}
/**
* @group DBAL-2595
*/
public function testLastInsertIdAcceptsFqn()
{
$this->_conn->executeUpdate('CREATE SEQUENCE dbal2595_seq');
$this->_conn->executeUpdate('CREATE TABLE DBAL2595(id NUMBER DEFAULT dbal2595_seq.NEXTVAL, foo NUMBER)');
$this->_conn->executeUpdate('INSERT INTO DBAL2595 (foo) VALUES (1)');
$schema = $this->_conn->getDatabase();
$this->assertSame(1, $this->driverConnection->lastInsertId($schema . '.dbal2595_seq'));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment