Utilize oids in PostgreSQL
This commit is contained in:
parent
741b19bc79
commit
37d814649a
|
@ -196,7 +196,7 @@ if (isset($_GET["pgsql"])) {
|
||||||
|
|
||||||
function table_status($name = "") {
|
function table_status($name = "") {
|
||||||
$return = array();
|
$return = array();
|
||||||
foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN '' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\"
|
foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN '' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\", relhasoids AS \"Oid\"
|
||||||
FROM pg_class
|
FROM pg_class
|
||||||
WHERE relkind IN ('r','v')
|
WHERE relkind IN ('r','v')
|
||||||
AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())"
|
AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())"
|
||||||
|
|
|
@ -4,6 +4,9 @@ $table_status = table_status($TABLE);
|
||||||
$indexes = indexes($TABLE);
|
$indexes = indexes($TABLE);
|
||||||
$fields = fields($TABLE);
|
$fields = fields($TABLE);
|
||||||
$foreign_keys = column_foreign_keys($TABLE);
|
$foreign_keys = column_foreign_keys($TABLE);
|
||||||
|
if ($table_status["Oid"] == "t") {
|
||||||
|
$indexes[] = array("type" => "PRIMARY", "columns" => array("oid"));
|
||||||
|
}
|
||||||
|
|
||||||
$rights = array(); // privilege => 0
|
$rights = array(); // privilege => 0
|
||||||
$columns = array(); // selectable columns
|
$columns = array(); // selectable columns
|
||||||
|
@ -23,7 +26,7 @@ list($select, $group) = $adminer->selectColumnsProcess($columns, $indexes);
|
||||||
$where = $adminer->selectSearchProcess($fields, $indexes);
|
$where = $adminer->selectSearchProcess($fields, $indexes);
|
||||||
$order = $adminer->selectOrderProcess($fields, $indexes);
|
$order = $adminer->selectOrderProcess($fields, $indexes);
|
||||||
$limit = $adminer->selectLimitProcess();
|
$limit = $adminer->selectLimitProcess();
|
||||||
$from = ($select ? implode(", ", $select) : "*") . "\nFROM " . table($TABLE);
|
$from = ($select ? implode(", ", $select) : ($table_status["Oid"] == "t" ? "oid, " : "") . "*") . "\nFROM " . table($TABLE);
|
||||||
$group_by = ($group && count($group) < count($select) ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
|
$group_by = ($group && count($group) < count($select) ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
|
||||||
|
|
||||||
if ($_GET["val"] && is_ajax()) {
|
if ($_GET["val"] && is_ajax()) {
|
||||||
|
@ -258,17 +261,19 @@ if (!$columns) {
|
||||||
reset($select);
|
reset($select);
|
||||||
$rank = 1;
|
$rank = 1;
|
||||||
foreach ($rows[0] as $key => $val) {
|
foreach ($rows[0] as $key => $val) {
|
||||||
$val = $_GET["columns"][key($select)];
|
if ($table_status["Oid"] != "t" || $key != "oid") {
|
||||||
$field = $fields[$select ? $val["col"] : $key];
|
$val = $_GET["columns"][key($select)];
|
||||||
$name = ($field ? $adminer->fieldName($field, $rank) : "*");
|
$field = $fields[$select ? $val["col"] : $key];
|
||||||
if ($name != "") {
|
$name = ($field ? $adminer->fieldName($field, $rank) : "*");
|
||||||
$rank++;
|
if ($name != "") {
|
||||||
$names[$key] = $name;
|
$rank++;
|
||||||
$column = idf_escape($key);
|
$names[$key] = $name;
|
||||||
echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key) . ($order[0] == $column || $order[0] == $key || (!$order && $group[0] == $column) ? '&desc%5B0%5D=1' : '')) . '">' . apply_sql_function($val["fun"], $name) . "</a>"; // $order[0] == $key - COUNT(*) //! columns looking like functions
|
$column = idf_escape($key);
|
||||||
|
echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key) . ($order[0] == $column || $order[0] == $key || (!$order && $group[0] == $column) ? '&desc%5B0%5D=1' : '')) . '">' . apply_sql_function($val["fun"], $name) . "</a>"; // $order[0] == $key - COUNT(*) //! columns looking like functions
|
||||||
|
}
|
||||||
|
$functions[$key] = $val["fun"];
|
||||||
|
next($select);
|
||||||
}
|
}
|
||||||
$functions[$key] = $val["fun"];
|
|
||||||
next($select);
|
|
||||||
}
|
}
|
||||||
$lengths = array();
|
$lengths = array();
|
||||||
if ($_GET["modify"]) {
|
if ($_GET["modify"]) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ SQLite: display 0
|
||||||
Create table default data type: int
|
Create table default data type: int
|
||||||
Focus upper/lower fields by Ctrl+Up/Ctrl+Down
|
Focus upper/lower fields by Ctrl+Up/Ctrl+Down
|
||||||
Hide credentials for SQLite
|
Hide credentials for SQLite
|
||||||
|
Utilize oids in PostgreSQL
|
||||||
Homepage customization
|
Homepage customization
|
||||||
Use IN for search in numeric fields (Editor)
|
Use IN for search in numeric fields (Editor)
|
||||||
Use password input for _md5 and _sha1 fields (Editor)
|
Use password input for _md5 and _sha1 fields (Editor)
|
||||||
|
|
Loading…
Reference in a new issue