Skip to content

Commit 9f8c05c

Browse files
committed
Merge branch 'fix/#2318-fix-listing-table-columns-when-using-external-or-os-authentication-on-oracledb-2.5' into 2.5
Close #2318 Close DBAL-831
2 parents 8697457 + 2736fd5 commit 9f8c05c

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

lib/Doctrine/DBAL/Platforms/OraclePlatform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ public function getListTableColumnsSQL($table, $database = null)
657657
$colCommentsTableName = "user_col_comments";
658658
$ownerCondition = '';
659659

660-
if (null !== $database) {
660+
if (null !== $database && '/' !== $database) {
661661
$database = $this->normalizeIdentifier($database);
662662
$database = $this->quoteStringLiteral($database->getName());
663663
$tabColumnsTableName = "all_tab_columns";

tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,63 @@ public function testQuotedTableNames()
706706
$this->assertEquals($createTriggerStatement, $sql[3]);
707707
}
708708

709+
/**
710+
* @dataProvider getReturnsGetListTableColumnsSQL
711+
* @group DBAL-831
712+
*/
713+
public function testReturnsGetListTableColumnsSQL($database, $expectedSql)
714+
{
715+
// note: this assertion is a bit strict, as it compares a full SQL string.
716+
// Should this break in future, then please try to reduce the matching to substring matching while reworking
717+
// the tests
718+
$this->assertEquals($expectedSql, $this->_platform->getListTableColumnsSQL('"test"', $database));
719+
}
720+
721+
public function getReturnsGetListTableColumnsSQL()
722+
{
723+
return array(
724+
array(
725+
null,
726+
"SELECT c.*,
727+
(
728+
SELECT d.comments
729+
FROM user_col_comments d
730+
WHERE d.TABLE_NAME = c.TABLE_NAME
731+
AND d.COLUMN_NAME = c.COLUMN_NAME
732+
) AS comments
733+
FROM user_tab_columns c
734+
WHERE c.table_name = 'test'
735+
ORDER BY c.column_name"
736+
),
737+
array(
738+
'/',
739+
"SELECT c.*,
740+
(
741+
SELECT d.comments
742+
FROM user_col_comments d
743+
WHERE d.TABLE_NAME = c.TABLE_NAME
744+
AND d.COLUMN_NAME = c.COLUMN_NAME
745+
) AS comments
746+
FROM user_tab_columns c
747+
WHERE c.table_name = 'test'
748+
ORDER BY c.column_name"
749+
),
750+
array(
751+
'scott',
752+
"SELECT c.*,
753+
(
754+
SELECT d.comments
755+
FROM all_col_comments d
756+
WHERE d.TABLE_NAME = c.TABLE_NAME
757+
AND d.COLUMN_NAME = c.COLUMN_NAME
758+
) AS comments
759+
FROM all_tab_columns c
760+
WHERE c.table_name = 'test' AND c.owner = 'SCOTT'
761+
ORDER BY c.column_name"
762+
),
763+
);
764+
}
765+
709766
/**
710767
* {@inheritdoc}
711768
*/

0 commit comments

Comments
 (0)