1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
<?php
/**
* PostgreSQL 9.1 support
*
* $Id: Postgres82.php,v 1.10 2007/12/28 16:21:25 ioguix Exp $
*/
include_once('./classes/database/Postgres92.php');
class Postgres91 extends Postgres92 {
var $major_version = 9.1;
/**
* Constructor
* @param $conn The database connection
*/
function __construct($conn) {
parent::__construct($conn);
}
// Help functions
function getHelpPages() {
include_once('./help/PostgresDoc91.php');
return $this->help_page;
}
// Administration functions
/**
* Returns all available process information.
* @param $database (optional) Find only connections to specified database
* @return A recordset
*/
function getProcesses($database = null) {
if ($database === null)
$sql = "SELECT datname, usename, procpid AS pid, waiting, current_query AS query, query_start
FROM pg_catalog.pg_stat_activity
ORDER BY datname, usename, procpid";
else {
$this->clean($database);
$sql = "SELECT datname, usename, procpid AS pid, waiting, current_query AS query, query_start
FROM pg_catalog.pg_stat_activity
WHERE datname='{$database}'
ORDER BY usename, procpid";
}
$rc = $this->selectSet($sql);
return $rc;
}
// Tablespace functions
/**
* Retrieves information for all tablespaces
* @param $all Include all tablespaces (necessary when moving objects back to the default space)
* @return A recordset
*/
function getTablespaces($all = false) {
global $conf;
$sql = "SELECT spcname, pg_catalog.pg_get_userbyid(spcowner) AS spcowner, spclocation,
(SELECT description FROM pg_catalog.pg_shdescription pd WHERE pg_tablespace.oid=pd.objoid AND pd.classoid='pg_tablespace'::regclass) AS spccomment
FROM pg_catalog.pg_tablespace";
if (!$conf['show_system'] && !$all) {
$sql .= ' WHERE spcname NOT LIKE $$pg\_%$$';
}
$sql .= " ORDER BY spcname";
return $this->selectSet($sql);
}
/**
* Retrieves a tablespace's information
* @return A recordset
*/
function getTablespace($spcname) {
$this->clean($spcname);
$sql = "SELECT spcname, pg_catalog.pg_get_userbyid(spcowner) AS spcowner, spclocation,
(SELECT description FROM pg_catalog.pg_shdescription pd WHERE pg_tablespace.oid=pd.objoid AND pd.classoid='pg_tablespace'::regclass) AS spccomment
FROM pg_catalog.pg_tablespace WHERE spcname='{$spcname}'";
return $this->selectSet($sql);
}
// Capabilities
function hasUserSignals() { return false; }
}
?>
|