Commit ac36de57 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-206' into 2.2

parents 6e87f201 6a5ff0ef
...@@ -480,16 +480,13 @@ END;'; ...@@ -480,16 +480,13 @@ END;';
cols.position, cols.position,
r_alc.table_name \"references_table\", r_alc.table_name \"references_table\",
r_cols.column_name \"foreign_column\" r_cols.column_name \"foreign_column\"
FROM all_cons_columns cols FROM user_cons_columns cols
LEFT JOIN all_constraints alc LEFT JOIN user_constraints alc
ON alc.constraint_name = cols.constraint_name ON alc.constraint_name = cols.constraint_name
AND alc.owner = cols.owner LEFT JOIN user_constraints r_alc
LEFT JOIN all_constraints r_alc
ON alc.r_constraint_name = r_alc.constraint_name ON alc.r_constraint_name = r_alc.constraint_name
AND alc.r_owner = r_alc.owner LEFT JOIN user_cons_columns r_cols
LEFT JOIN all_cons_columns r_cols
ON r_alc.constraint_name = r_cols.constraint_name ON r_alc.constraint_name = r_cols.constraint_name
AND r_alc.owner = r_cols.owner
AND cols.position = r_cols.position AND cols.position = r_cols.position
WHERE alc.constraint_name = cols.constraint_name WHERE alc.constraint_name = cols.constraint_name
AND alc.constraint_type = 'R' AND alc.constraint_type = 'R'
...@@ -505,15 +502,17 @@ LEFT JOIN all_cons_columns r_cols ...@@ -505,15 +502,17 @@ LEFT JOIN all_cons_columns r_cols
public function getListTableColumnsSQL($table, $database = null) public function getListTableColumnsSQL($table, $database = null)
{ {
$table = strtoupper($table); $table = strtoupper($table);
$ownerCondition = '';
$tabColumnsTableName = "user_tab_columns";
$ownerCondition = '';
if(null !== $database){ if(null !== $database){
$database = strtoupper($database); $database = strtoupper($database);
$tabColumnsTableName = "all_tab_columns";
$ownerCondition = "AND c.owner = '".$database."'"; $ownerCondition = "AND c.owner = '".$database."'";
} }
return "SELECT c.*, d.comments FROM all_tab_columns c ". return "SELECT c.*, d.comments FROM $tabColumnsTableName c ".
"INNER JOIN all_col_comments d ON d.OWNER = c.OWNER AND d.TABLE_NAME = c.TABLE_NAME AND d.COLUMN_NAME = c.COLUMN_NAME ". "INNER JOIN user_col_comments 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