Commit cc012b68 authored by Simon Edwards's avatar Simon Edwards

Use all_col_comments when specifying a $database for getListTableColumnsSQL()

Using user_col_comments in the INNER JOIN when referencing all_tab_columns causes no results to be returned.
parent 0e4de6ba
...@@ -541,16 +541,18 @@ LEFT JOIN user_cons_columns r_cols ...@@ -541,16 +541,18 @@ LEFT JOIN user_cons_columns r_cols
$table = strtoupper($table); $table = strtoupper($table);
$tabColumnsTableName = "user_tab_columns"; $tabColumnsTableName = "user_tab_columns";
$colCommentsTableName = "user_col_comments";
$ownerCondition = ''; $ownerCondition = '';
if (null !== $database){ if (null !== $database){
$database = strtoupper($database); $database = strtoupper($database);
$tabColumnsTableName = "all_tab_columns"; $tabColumnsTableName = "all_tab_columns";
$colCommentsTableName = "all_col_comments";
$ownerCondition = "AND c.owner = '".$database."'"; $ownerCondition = "AND c.owner = '".$database."'";
} }
return "SELECT c.*, d.comments FROM $tabColumnsTableName c ". return "SELECT c.*, d.comments FROM $tabColumnsTableName c ".
"INNER JOIN user_col_comments d ON d.TABLE_NAME = c.TABLE_NAME AND d.COLUMN_NAME = c.COLUMN_NAME ". "INNER JOIN " . $colCommentsTableName . " d ON d.TABLE_NAME = c.TABLE_NAME AND d.COLUMN_NAME = c.COLUMN_NAME ".
"WHERE c.table_name = '" . $table . "' ".$ownerCondition." ORDER BY c.column_name"; "WHERE c.table_name = '" . $table . "' ".$ownerCondition." ORDER BY c.column_name";
} }
......
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