Support granted table to list up indexes
Signed-off-by: Takashi SHIRAI <shirai@nintendo.co.jp>
This commit is contained in:
parent
ee4ffe9b65
commit
6660789d04
|
@ -295,11 +295,11 @@ ORDER BY 1"
|
||||||
function indexes($table, $connection2 = null) {
|
function indexes($table, $connection2 = null) {
|
||||||
$return = array();
|
$return = array();
|
||||||
$owner = where_owner(" AND ", "aic.table_owner");
|
$owner = where_owner(" AND ", "aic.table_owner");
|
||||||
foreach (get_rows("SELECT uic.*, uc.constraint_type
|
foreach (get_rows("SELECT aic.*, ac.constraint_type
|
||||||
FROM user_ind_columns uic
|
FROM all_ind_columns aic
|
||||||
LEFT JOIN user_constraints uc ON uic.index_name = uc.constraint_name AND uic.table_name = uc.table_name
|
LEFT JOIN all_constraints ac ON aic.index_name = ac.constraint_name AND aic.table_name = ac.table_name AND aic.index_owner = ac.owner
|
||||||
WHERE uic.table_name = " . q($table) . "$owner
|
WHERE aic.table_name = " . q($table) . "$owner
|
||||||
ORDER BY uc.constraint_type, uic.column_position", $connection2) as $row) {
|
ORDER BY ac.constraint_type, aic.column_position", $connection2) as $row) {
|
||||||
$index_name = $row["INDEX_NAME"];
|
$index_name = $row["INDEX_NAME"];
|
||||||
$return[$index_name]["type"] = ($row["CONSTRAINT_TYPE"] == "P" ? "PRIMARY" : ($row["CONSTRAINT_TYPE"] == "U" ? "UNIQUE" : "INDEX"));
|
$return[$index_name]["type"] = ($row["CONSTRAINT_TYPE"] == "P" ? "PRIMARY" : ($row["CONSTRAINT_TYPE"] == "U" ? "UNIQUE" : "INDEX"));
|
||||||
$return[$index_name]["columns"][] = $row["COLUMN_NAME"];
|
$return[$index_name]["columns"][] = $row["COLUMN_NAME"];
|
||||||
|
|
Loading…
Reference in a new issue