diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-05-13 10:46:12 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-05-13 10:46:12 +0200 |
commit | fbe8d6144aeaed179aaccd7724aba51e4ca000a8 (patch) | |
tree | a9871cf7bfa549f0452b8ade9198bcb109efaa4b | |
parent | d5f59a57bf2689874f2171e0c4a2354d12597f34 (diff) | |
download | volse-hubzilla-fbe8d6144aeaed179aaccd7724aba51e4ca000a8.tar.gz volse-hubzilla-fbe8d6144aeaed179aaccd7724aba51e4ca000a8.tar.bz2 volse-hubzilla-fbe8d6144aeaed179aaccd7724aba51e4ca000a8.zip |
port db_indexes() from zap
-rwxr-xr-x | include/dba/dba_driver.php | 25 |
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 []; +} |