PostgreSQL hidden columns support

This commit is contained in:
Jakub Vrana 2010-05-21 16:23:44 +02:00
parent 3308856f9e
commit 4c2268d381
6 changed files with 12 additions and 9 deletions

View 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]

View 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));

View 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");

View 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

View 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) . ")");

View 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();
}
}