port db_indexes() from zap
This commit is contained in:
parent
d5f59a57bf
commit
fbe8d6144a
@ -485,3 +485,28 @@ function db_columns($table) {
|
|||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function db_indexes($table) {
|
||||||
|
|
||||||
|
if($table) {
|
||||||
|
if(ACTIVE_DBTYPE === DBTYPE_POSTGRES) {
|
||||||
|
$r = q("SELECT indexname from pg_indexes where tablename = '%s'",
|
||||||
|
dbesc($table)
|
||||||
|
);
|
||||||
|
if($r) {
|
||||||
|
return ids_to_array($r,'indexname');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$r = q("show index from %s",
|
||||||
|
dbesc($table)
|
||||||
|
);
|
||||||
|
if($r) {
|
||||||
|
return ids_to_array($r,'Key_name');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user