8000 [Oracle] Fix list table columns when using external or OS authentication with Oracle by butonic · Pull Request #2318 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Oracle] Fix list table columns when using external or OS authentication with Oracle #2318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ public function getListTableColumnsSQL($table, $database = null)
$colCommentsTableName = "user_col_comments";
$ownerCondition = '';

if (null !== $database) {
if (null !== $database && '/' !== $database) {
$database = $this->normalizeIdentifier($database);
$tabColumnsTableName = "all_tab_columns";
$colCommentsTableName = "all_col_comments";
Expand Down
54 changes: 54 additions & 0 deletions tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,60 @@ public function testQuotedTableNames()
$this->assertEquals($createTriggerStatement, $sql[3]);
}

/**
* @dataProvider getReturnsGetListTableColumnsSQL
* @group DBAL-831
*/
public function testReturnsGetListTableColumnsSQL($database, $expectedSql)
{
$this->assertEquals($expectedSql, $this->_platform->getListTableColumnsSQL('"test"', $database));
}

public function getReturnsGetListTableColumnsSQL()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tend to avoid testing against complete SQL strings when it comes to testing getList*() Methods as those tests are fragile and need to be adjusted on every change in SQL. I would rather do a contains check in the string to check whether all_tab_columns or user_tab_columns is present (which is the interesting difference).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging this regardless of the fragile test. We may simply rework the test, should some changes break this.

{
return array(
array(
null,
"SELECT c.*,
(
SELECT d.comments
FROM user_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME
AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments
FROM user_tab_columns c
WHERE c.table_name = 'test'
ORDER BY c.column_name"
),
array(
'/',
"SELECT c.*,
(
SELECT d.comments
FROM user_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME
AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments
FROM user_tab_columns c
WHERE c.table_name = 'test'
ORDER BY c.column_name"
),
array(
'scott',
"SELECT c.*,
(
SELECT d.comments
FROM all_col_comments d
WHERE d.TABLE_NAME = c.TABLE_NAME
AND d.COLUMN_NAME = c.COLUMN_NAME
) AS comments
FROM all_tab_columns c
WHERE c.table_name = 'test' AND c.owner = 'SCOTT'
ORDER BY c.column_name"
),
);
}

/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty newline to be introduced here

* {@inheritdoc}
*/
Expand Down
0