]> git.joonet.de Git - adminer.git/commitdiff
PostgreSQL hidden columns support
authorJakub Vrana <jakub@vrana.cz>
Fri, 21 May 2010 14:23:44 +0000 (16:23 +0200)
committerJakub Vrana <jakub@vrana.cz>
Fri, 21 May 2010 14:23:44 +0000 (16:23 +0200)
adminer/drivers/mssql.inc.php
adminer/drivers/mysql.inc.php
adminer/drivers/oracle.inc.php
adminer/drivers/pgsql.inc.php
adminer/drivers/sqlite.inc.php
adminer/select.inc.php

index ccbd6f29ebd6cfe38d81a83de1a367b193a0454a..4ba8fecc8e570c6275cc4386d68bd1e6aa12134c 100644 (file)
@@ -308,7 +308,7 @@ if (isset($_GET["mssql"])) {
                return true;
        }
 
-       function fields($table) {
+       function fields($table, $hidden = false) {
                global $connection;
                $return = array();
                $result = $connection->query("SELECT c.*, t.name type, d.definition [default]
index c46c54ef16c78d7ba4dd00954e6ccbc0ae8657ae..994c1a0f19f566f62b563b6371057f8e20e8312b 100644 (file)
@@ -380,9 +380,10 @@ if (!defined("DRIVER")) {
 
        /** Get information about fields
        * @param string
+       * @param bool display hidden table columns
        * @return array array($name => array("field" => , "full_type" => , "type" => , "length" => , "unsigned" => , "default" => , "null" => , "auto_increment" => , "on_update" => , "collation" => , "privileges" => , "comment" => , "primary" => ))
        */
-       function fields($table) {
+       function fields($table, $hidden = false) {
                global $connection;
                $return = array();
                $result = $connection->query("SHOW FULL COLUMNS FROM " . table($table));
index 87a45eb0a46e20d99523234612bf9fe8cc49d7b8..df6e6ec98f85418cba524be676673ec80ed35883 100644 (file)
@@ -201,7 +201,7 @@ if (isset($_GET["oracle"])) {
                return true;
        }
 
-       function fields($table) {
+       function fields($table, $hidden = false) {
                global $connection;
                $return = array();
                $result = $connection->query("SELECT * FROM all_tab_columns WHERE table_name = " . $connection->quote($table) . " ORDER BY column_id");
index a3ff81571a8875fb993d45ea3383b2b7d10c9a83..3ff313f1045f9c787de3702653337f28d5b44b8f 100644 (file)
@@ -217,7 +217,7 @@ AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema(
                return true;
        }
        
-       function fields($table) {
+       function fields($table, $hidden = false) {
                global $connection;
                $return = array();
                $result = $connection->query("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull, col_description(c.oid, a.attnum) AS comment
@@ -227,8 +227,10 @@ JOIN pg_attribute a ON c.oid = a.attrelid
 LEFT JOIN pg_attrdef d ON c.oid = d.adrelid AND a.attnum = d.adnum
 WHERE c.relname = " . $connection->quote($table) . "
 AND n.nspname = current_schema()
-AND a.attnum > 0
-ORDER BY a.attnum");
+AND NOT a.attisdropped
+" . ($hidden ? "" : "AND a.attnum > 0") . "
+ORDER BY a.attnum < 0, a.attnum"
+               );
                if ($result) {
                        while ($row = $result->fetch_assoc()) {
                                //! collation, primary
index cb5433eb3a64383c7e637bab67e898db26d8112c..fa66ff6764d88990bff42eb265e6f77a29a911c1 100644 (file)
@@ -267,7 +267,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
                return !$connection->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");
        }
 
-       function fields($table) {
+       function fields($table, $hidden = false) {
                global $connection;
                $return = array();
                $result = $connection->query("PRAGMA table_info(" . table($table) . ")");
index 018ed19e5499f1b5d30d553c43b5c52d319a968e..45e03c301a600dabffc9bee51ed9b01c878d1120 100644 (file)
@@ -2,7 +2,7 @@
 $TABLE = $_GET["select"];
 $table_status = table_status($TABLE);
 $indexes = indexes($TABLE);
-$fields = fields($TABLE);
+$fields = fields($TABLE, 1); // 1 - hidden
 $foreign_keys = column_foreign_keys($TABLE);
 
 $rights = array(); // privilege => 0
@@ -12,7 +12,7 @@ foreach ($fields as $key => $field) {
        $name = $adminer->fieldName($field);
        if (isset($field["privileges"]["select"]) && $name != "") {
                $columns[$key] = html_entity_decode(strip_tags($name));
-               if (ereg('text|blob', $field["type"])) {
+               if (ereg('text|clob|blob', $field["type"])) {
                        $text_length = $adminer->selectLengthProcess();
                }
        }