Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

updates to Oracle driver #17

Closed
wants to merge 3 commits into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 10, 2012
  1. @helix84
  2. @helix84
  3. @helix84

    Add Oracle processlist support

    helix84 authored
    Also, deobfuscate processlist.inc.php
This page is out of date. Refresh to see the latest.
Showing with 29 additions and 7 deletions.
  1. +17 −6 adminer/drivers/oracle.inc.php
  2. +12 −1 adminer/processlist.inc.php
View
23 adminer/drivers/oracle.inc.php
@@ -190,8 +190,8 @@ function count_tables($databases) {
function table_status($name = "") {
$return = array();
$search = q($name);
- foreach (get_rows('SELECT table_name "Name", \'table\' "Engine" FROM all_tables WHERE tablespace_name = ' . q(DB) . ($name != "" ? " AND table_name = $search" : "") . "
-UNION SELECT view_name, 'view' FROM user_views" . ($name != "" ? " WHERE view_name = $search" : "")
+ foreach (get_rows('SELECT table_name "Name", \'table\' "Engine", avg_row_len*num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = ' . q(DB) . ($name != "" ? " AND table_name = $search" : "") . "
+UNION SELECT view_name, 'view', 0, 0 FROM user_views" . ($name != "" ? " WHERE view_name = $search" : "")
) as $row) {
if ($name != "") {
return $row;
@@ -329,28 +329,39 @@ function last_id() {
}
function schemas() {
- return array();
+ return get_vals("SELECT DISTINCT owner FROM dba_segments WHERE owner IN (SELECT username FROM dba_users WHERE default_tablespace NOT IN ('SYSTEM','SYSAUX'))");
}
function get_schema() {
- return "";
+ global $connection;
+ return $connection->result("SELECT sys_context('USERENV','SESSION_USER') FROM dual");
}
function set_schema($scheme) {
- return true;
+ global $connection;
+ return $connection->query("ALTER SESSION SET CURRENT_SCHEMA=" . idf_escape($scheme));
}
function show_variables() {
return get_key_vals('SELECT name, display_value FROM v$parameter');
}
+ function process_list() {
+ return get_rows('SELECT sess.process AS "process", sess.username AS "user", sess.schemaname AS "schema", sess.status AS "status", sess.wait_class AS "wait_class", sess.seconds_in_wait AS "seconds_in_wait", sql.sql_text AS "sql_text", sess.machine AS "machine", sess.port AS "port"
+FROM v$session sess LEFT OUTER JOIN v$sql sql
+ON sql.sql_id = sess.sql_id
+WHERE sess.type = \'USER\'
+ORDER BY PROCESS
+');
+ }
+
function show_status() {
$rows = get_rows('SELECT * FROM v$instance');
return reset($rows);
}
function support($feature) {
- return ereg("view|drop_col|variables|status", $feature); //!
+ return ereg("view|scheme|processlist|drop_col|variables|status", $feature); //!
}
$jush = "oracle";
View
13 adminer/processlist.inc.php
@@ -23,7 +23,18 @@
}
echo "<tr" . odd() . ">" . (support("kill") ? "<td>" . checkbox("kill[]", $row["Id"], 0) : "");
foreach ($row as $key => $val) {
- echo "<td>" . (($jush == "sql" ? $key == "Info" && $val != "" : $key == "current_query" && $val != "<IDLE>") ? "<code class='jush-$jush'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Edit') . '</a>' : nbsp($val));
+ echo "<td>";
+ if (
+ ($jush == "sql" && $key == "Info" && $val != "") || // MySQL
+ ($jush == "pgsql" && $key == "current_query" && $val != "<IDLE>") || // Postgres
+ ($jush == "oracle" && $key == "sql_text" && $val != "") // Oracle
+ ) {
+ echo "<code class='jush-$jush'>";
+ echo shorten_utf8($val, 100, "</code>");
+ echo ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Edit') . '</a>';
+ } else {
+ echo nbsp($val);
+ }
}
echo "\n";
}
Something went wrong with that request. Please try again.