aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba/dba_driver.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-05-01 19:38:32 -0700
committerMario Vavti <mario@mariovavti.com>2018-05-02 09:30:45 +0200
commita9b71f5b4a6ed0f40b42c828a27fce472988fc30 (patch)
tree9fd2ae54fa7a988b6520eac71660844218e4bcd2 /include/dba/dba_driver.php
parentc99fb4b7f1f551926e87d093f1931556e14ff053 (diff)
downloadvolse-hubzilla-a9b71f5b4a6ed0f40b42c828a27fce472988fc30.tar.gz
volse-hubzilla-a9b71f5b4a6ed0f40b42c828a27fce472988fc30.tar.bz2
volse-hubzilla-a9b71f5b4a6ed0f40b42c828a27fce472988fc30.zip
The channel import page seems to have missed the big theme cleanup of the last couple of years.
Diffstat (limited to 'include/dba/dba_driver.php')
-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 b3298b673..9e9f24bb3 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -460,3 +460,28 @@ function db_logger($s,$level = LOGGER_NORMAL,$syslog = LOG_INFO) {
\DBA::$logging = false;
\DBA::$dba->debug = $saved;
}
+
+
+function db_columns($table) {
+
+ if($table) {
+ if(ACTIVE_DBTYPE === DBTYPE_POSTGRES) {
+ $r = q("SELECT column_name as field FROM information_schema.columns WHERE table_schema = 'public' AND table_name = '%s'",
+ dbesc($table)
+ );
+ if($r) {
+ return ids_to_array($r,'field');
+ }
+ }
+ else {
+ $r = q("show columns in %s",
+ dbesc($table)
+ );
+ if($r) {
+ return ids_to_array($r,'Field');
+ }
+ }
+ }
+
+ return [];
+} \ No newline at end of file