aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinclude/dba/dba_driver.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index ee0e06a91..cfb208e2d 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -485,3 +485,28 @@ function db_columns($table) {
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 [];
+}